Behavior Trees for Path Planning (Autonomous Driving)

2019-11-13 08:16:52

Path planning in self-driving cars

Path planning and decision making for autonomous vehicles in urban environments enable self-driving cars to find the safest, most convenient, and most economically beneficial routes from point A to point B. Finding routes is complicated by all of the static and maneuverable obstacles that a vehicle must identify and bypass. Today, the major path planning approaches include the predictive control model, feasible model, and behavior-based model. Let’s first get familiar with some terms to understand how these approaches work.

  • A path is a continuous sequence of configurations beginning and ending with boundary configurations. These configurations are also referred to as initial and terminating.
  • Path planning involves finding a geometric path from an initial configuration to a given configuration so that each configuration and state on the path is feasible (if time is taken into account).
  • A maneuver is a high-level characteristic of a vehicle’s motion, encompassing the position and speed of the vehicle on the road. Examples of maneuvers include going straight, changing lanes, turning, and overtaking.
  • Maneuver planning aims at taking the best high-level decision for a vehicle while taking into account the path specified by path planning mechanisms.
  • A trajectory is a sequence of states visited by the vehicle, parameterized by time and, most probably, velocity.
  • Trajectory planning or trajectory generation is the real-time planning of a vehicle’s move from one feasible state to the next, satisfying the car’s kinematic limits based on its dynamics and as constrained by the navigation mode.

This is the general view of self-driving autonomous system integration :

The blocks inside the container are the parts of the path planning procedure;

Trajectory generation :

For each efficient target, we compute the corresponding trajectory. We send commands to the controller as a set of waypoints, i.e., discrete points (supposedly closed to one another) spread across the trajectory, often at a fixed interval equal to the controller’s sampling time.

For my project, the trajectory is generated using cubic spline with four points : (Note: This explanation is in Frenet coordinates, we use the variables s and d to describe a vehicle’s position on the road. The s coordinate represents distance along the road (also known as longitudinal displacement) and the d coordinate represents a side-to-side position on the road (also known as lateral displacement). And r is the width of the road (in meters)

  • Current position (s, d)
  • Desired lane (s+30, r*lane+(r/2))
  • Desired lane (s+60, r*lane+(r/2))
  • Desired lane (s+90, r*lane+(r/2))

The controller then has to regenerate trajectory segments between two consecutive waypoints, such that manipulator reaches the next waypoint within the fixed time interval while staying within joint limits, velocity limits, and acceleration limits. However, the controller does not really consider even collision avoidance or anything else

Prediction:

We predict situations in over environment in order to get you to the destination safely and efficiently. For this project I had to build collision detection, that predicts a possible collision with two cars.

Behavior:

Behavior planner takes input :

  • map of the world,
  • route to the destination
  • prediction about what static and dynamic obstacles are likely to do

Output: Suggested maneuver for the vehicle which the trajectory planner is responsible for reaching collision-free, smooth and safe behavior.

Behavior Tree

A Behavior Tree (BT) is a mathematical model of plan execution used in computer science, robotics, control systems, and video games. They describe switchings between a finite set of tasks in a modular fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks, without worrying how the simple tasks are implemented. BTs present some similarities to hierarchical state machines with the key difference that the main building block of behavior is a task rather than a state. Its ease of human understanding make BTs less error-prone and very popular in the game developer community. BTs have been shown to generalize several other control architectures.

Pros of using Behavior trees

  • Useful when we have so many transitions and states
  • Transform hardly-visible state machine into the hierarchical system
  • Encapsulate and separate conditional tasks into classes
  • Easy automation tests for each task.
  • Better when pass/fail of tasks is central
  • Reusability
  • The appearance of goal-driven behavior
  • Multi-step behavior
  • Fast
  • Recover from errors

Cons of using Behavior trees

  • Clunky for state-based behavior
  • Changing behavior based on external changes
  • Isn’t really thinking ahead about unique situations
  • Only as good as the designer makes it (just follows the recipes)

Composite Node

A composite node is a node that can have one or more children. They will process one or more of these children in either a first to last sequence or random order depending on the particular composite node in question, and at some stage will consider their processing complete and pass either success or failure to their parent, often determined by the success or failure of the child nodes. During the time they are processing children, they will continue to return Running to the parent.

Leaf

These are the lowest level node type and are incapable of having any children.

Leaves are however the most powerful of node types, as these will be defined and implemented for your intelligent system to do the actions and behaviors specific or character specific tests or actions required to make your tree actually do useful stuff. A leaf node can be a condition or a Task(Action).

Condition

A condition can return true for success and false otherwise.

Task

The task can return true if it is completed, false, otherwise.

Sequences

The simplest composite node found within behavior trees, their name says it all. A sequence will visit each child in order, starting with the first, and when that succeeds will call the second, and so on down the list of children. If any child fails it will immediately return failure to the parent. If the last child in the sequence succeeds, then the sequence will return success to its parent.

It’s important to make clear that the node types in behavior trees have quite a wide range of applications. The most obvious use of sequences is to define a sequence of tasks that must be completed in entirety, and where the failure of one means further processing of that sequence of tasks becomes redundant.

In the example below is an example of Selector hierarchy, as a part of my behavioral tree used for the path planning project :

Execution: The main goal of this selector is to choose left child (detecting whether we have a car very close before us, and adapt the speed accordingly) or right child (drive normally)

This selector will return true if and only if all children return true according to the ordered steps of execution :

  1. The car is in second lane (IsCurentLane condition returns true/false)

— (If this block return false, then we stop examining the rest of the blocks in this sequence)

2. It is safe to switch lane (SafeToSwitchLane condition returns true)

— (if this block return false, then we stop examining the rest of the blocks in this sequence)

3. Successfully perform the switch task (SwitchLane task is successfully executed, returns true)

4. Goal achieved

Selector

Where a sequence is an AND, requiring all children to succeed to return success, a selector will return success if any of its children succeed and not process any further children. It will process the first child, and if it fails will process the second, and if that fails will process the third, until success is reached, at which point it will instantly return success. It will fail if all children fail. This means a selector is analogous with an OR gate, and as a conditional statement can be used to check multiple conditions to see if any one of them is true.

In the example below is an example of Sequence hierarchy, as a part of my behavioral tree used for the path planning project :

Execution: The main goal of this selector is to choose left child (detecting whether we have a car very close before us, and adapt the speed accordingly) or right child (drive normally)

This selector will return true only if one of its children returns true, execution is according to the following steps :

Left Child (Sequence): Returns true if there is car close before us and we are able to adapt our speed

  1. Is there a car close in front of us? (IsCarCloseBeforeUs condition passed)

— (If this block return false, then we stop examining the rest of the blocks in this sequence)

3. Approximate speed

— (If this block return false, then we stop examining the rest of the blocks in this sequence)

4. Drive

— (If Left Child return true, then we stop examining the rest of the blocks in this selector

— — — — — — — — — — -

Right Child (Task)

  1. Drive normally

Priority Selector

Very simple, It’s the same as a selector but this time they are ordered somehow. If the priority selector is used, child behaviors are ordered in a list and tried one after another.

For this project, I used a priority selector to select and prioritize which of the lanes we should drive/switch. Below there is a picture describing this behavior :

Priority Estimation

For this project I prioritize which of the lanes we should drive or switch based on the following formula :

The Bigger the reward is and smaller the penalty, priority for visiting the lane increases.

Behavior Tree Architecture for Path Planning

Bellow is the complete Path planning behavior tree architecture :

You can see the following video observing the simulation for a few minutes.

You can see my implementation on Github :

kirilcvetkov92/Path-planning
Contribute to kirilcvetkov92/Path-planning development by creating an account on GitHub.
github.com

Behavior Trees for Path Planning (Autonomous Driving)的更多相关文章

  1. Autonomous driving - Car detection YOLO

    Andrew Ng deeplearning courese-4:Convolutional Neural Network Convolutional Neural Networks: Step by ...

  2. Design and Implementation of Global Path Planning System for Unmanned Surface Vehicle among Multiple Task Points

    Design and Implementation of Global Path Planning System for Unmanned Surface Vehicle among Multiple ...

  3. Behavior trees for AI: How they work

    http://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php ...

  4. tensorfolw配置过程中遇到的一些问题及其解决过程的记录(配置SqueezeDet: Unified, Small, Low Power Fully Convolutional Neural Networks for Real-Time Object Detection for Autonomous Driving)

    今天看到一篇关于检测的论文<SqueezeDet: Unified, Small, Low Power Fully Convolutional Neural Networks for Real- ...

  5. A*算法改进——Any-Angle Path Planning的Theta*算法与Lazy Theta*算法

    本文是该篇文章的归纳http://aigamedev.com/open/tutorial/lazy-theta-star/#Nash:07 . 传统的A*算法中,寻找出来的路径只能是沿着给出的模型(比 ...

  6. Visual-Based Autonomous Driving Deployment from a Stochastic and Uncertainty-Aware Perspective

    张宁 Visual-Based Autonomous Driving Deployment from a Stochastic and Uncertainty-Aware Perspective Le ...

  7. 泡泡一分钟:BLVD: Building A Large-scale 5D Semantics Benchmark for Autonomous Driving

    BLVD: Building A Large-scale 5D Semantics Benchmark for Autonomous Driving BLVD:构建自主驾驶的大规模5D语义基准 Jia ...

  8. apollo规划控制视频-13 motion planning with autonomous driving

  9. Behavior Trees

    https://en.wikipedia.org/wiki/Behavior_Trees_(artificial_intelligence,_robotics_and_control) http:// ...

随机推荐

  1. Ingress使用示例

    Ingress概念介绍 service只能做四层代理 无法做七层代理(如https服务)      lvs只能根据第四层的数据进行转发 无法对七层协议数据进行调度 Ingress Controller ...

  2. Oracle数据表字段小写转大写

    BEGIN FOR c IN ( SELECT COLUMN_NAME cn FROM all_tab_columns WHERE table_name = '表名' ) loop BEGIN exe ...

  3. (六)Kubernetes Pod控制器-ReplicaSet和Deployment和DaemonSet

    Pod控制器相关知识 控制器的必要性 自主式Pod对象由调度器调度到目标工作节点后即由相应节点上的kubelet负责监控其容器的存活状态,容器主进程崩溃后,kubelet能够自动重启相应的容器.但对出 ...

  4. 调试用Chrome浏览器

    今天写HTML页面调试时出了问题:一个页面在本地的工作空间文件夹内可以打得开,在HBuilder里用Edge打不开. 我还以为是工作空间路径出问题了,重建了好几次空间和项目.. 询问了小页,他建议以后 ...

  5. 性能测试基础---LR关联2

    ·LR中的关联函数详解.在LR中,用于关联的函数一般有以下四个:web_reg_save_param 是通过字符串查找的方式来查找获取数据.web_reg_save_param_ex 是通过字符串查找 ...

  6. 模型融合---为什么说bagging是减少variance,而boosting是减少bias?

    1.bagging减少variance Bagging对样本重采样,对每一重采样得到的子样本集训练一个模型,最后取平均.由于子样本集的相似性以及使用的是同种模型,因此各模型有近似相等的bias和var ...

  7. nvidia-smi命令执行很慢,如何改进

    初次安装好nvidia的驱动,每次执行nvidia-smi命令时,要5秒以上. 可通过如下命令进行改进: nvidia-persistenced --persistence-mode

  8. 网页禁止右键,禁止F12,禁止选中,禁止复制,禁止缓存等操作

    一.禁止右键 //方法一 document.onmousedown = function () { ) { return false; } } //方法二 document.oncontextmenu ...

  9. 如何开发一个异常检测系统:异常检测 vs 监督学习

    异常检测算法先是将一些正常的样本做为无标签样本来学习模型p(x),即评估参数,然后用学习到的模型在交叉验证集上通过F1值来选择表现最好的ε的值,然后在测试集上进行算法的评估.这儿用到了带有标签的数据, ...

  10. spark的RDDAPI总结

    下面是RDD的基础操作API介绍: 操作类型 函数名 作用 转化操作 map() 参数是函数,函数应用于RDD每一个元素,返回值是新的RDD flatMap() 参数是函数,函数应用于RDD每一个元素 ...