Git Product home page Git Product logo

behaviouralplanner's Introduction

Behavioural Planner

A finite-statemachine based behavioural planner module written in C++. This project was built in collaboration with Rowan Dempster during my 2020 Summer COOP. The exact responsibilities are highlighted in the Features section.

The behaviour planner system plans the set of high level driving actions/maneuvers, to safely achieve the driving mission under vaiours driving situations. Behaviour planner considers the rules of the road, static, and dynamic objects around the vehicle. The behavioural planner is part of the hierachical framework for an autonomous vehicle. For more information, on behavioural planner, I recommend checkingout this research paper by Junqing Wei. The result of the Readme aims to provide a highlevel break down of my part of the project.

autonomous vehicle hierarchy

Input

Routing Input:

  • A queue of global commands
autonomous vehicle hierarchy
For example, the route illustrated in the image above would contain 3 global commands.

Perception Input:

  • Coordinates of traffic signs
  • Type of traffic signs
  • Coordinates of traffic lights
  • Traffic light signals
  • Stopline
  • Coordinates of pedestrian
  • Other

Output

  • Signal to follow lane
  • Signal to lane change
  • Signal to turn
  • Signal to stop

Core Features

  • Driving Commands (following lane, stop, turn, lane change) (Ray)
  • React to pedestrian (Rowan)
  • React to traffic light (Rowan)
  • React to stop signs (Rowan)

How it works

This section focuses on the driving commands functionality that I worked on. It will not focus on how react to pedestrian nor other features.

Finite-state Machine Architecture

The behavioural module uses a finite-state machine architecture. Each external and internal component is represented by a finite state machine. For example, each pedestrian, each traffic light, is represented by a finte-state machine.

abstract state-machine code
Each finite-state machine holds the current state and a transition graph. When a trigger event occurs, the finite-state machine transitions into the next state based on said transition graph. Since the finite statemachine is deterministic, each trigger only has one single resulting state. Here, two stat-machines will be explained in details: the ego state machine and the global command state machine. Together, these two state machine allows the behavioural planner to give driving commands.

Ego State Machine

Ego state machine holds the state of the car. The following is an illustration of its transition graph. Each arrow represents a trigger.

abstract state-machine code

The ego state machine functions together with the global command state machine to drive the car. The following is an illustration of its transition graph. Again, each arrow represents a trigger.

abstract state-machine code

Here is an example of how the two state-machines work together. The upper stream routing module sends the global commands [(right_turn, x1, y1), (left_turn, x2, y2), (stop, x3, y3)].

  • Gobal commands are sent

Both ego and global command starts at the waiting_for_command stage. Once the behavioural planner receives the set of global commands, the global command state machine pops the first command and transitions to the turning_right state. Now that ego state machine knows that there are commands, it transitions to the following_lane stage. Assuming we started at the right lane, we do not need to change lange. Therefore we are still at following_lane stage.

  • Reaches coordinates x1, y1

Global command state machine transitions to done stage since we arrived at x1, y1. Global state machine pops the command. Since the current cummand is now left-turn, the global state machine transitions to turning_left stage. Ego state machine sees that the global state machine is in turning_left stage. Since it is currently on the right lane, the car needs to change to the left lane to prepare for the left turn. Therefore the ego state machine transitions to changing lane left. Once the ego vehicle has stabilized, it transitions back to following lane.

  • Reaches coordinates x2, y2

Global command state machine transitions to done stage since we arrived at x2, y 2. Global state machine pops the command. Since the current command is stopm . Here, the behavioural planner creates a stop line. at x3, y3. Assuming x3, y3 is on the same lane, ego vehicle stays on following_lane stage.

  • Reaches coordinates x3, y3

Global command state machine transitions to done stage since we arrived at x3, y3. Global state machine pops the command. Since no command is in the queue, the global stat machine transitions to the waiting_for_command stage. Since the ego vehicle reaches the stop line, it transitions to the stopping stage. Since the global state machine is in waiting_for_command stage, ego also transitions to the waiting_for_command stage.

Here is a video illustrating the process described above.

What is Next

  • Increase the amount features such as other interacting with other vehicles.
  • Increase the amount of states needed.
  • Maintaining the architecture as we encounter more scenarios.

behaviouralplanner's People

Contributors

rayruizheli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.