You find the source code for our examples in the software-folder:



A variable number of vehicles drive randomly on the map with no collisions:

Map representation

The program is based on the routing graph for the map layout. The original lane graph is defined as followed:

Each node represents the index in the lane graph to receive the information you need for your trajectory:

struct LaneGraph{

vector node_x;
vector node_y;
vector nodes_cos;
vector nodes_sin;
vector edges_start_index;
vector edges_end_index;
vector edges_x;
vector edges_y;
vector edges_sin;
vector edges_cos;

The graph edges correspond to center lines, along which a vehicle may drive. Parallel lanes are not modeled, instead extra edges are added for lane changes in discrete locations. All values from your lane graph are already included in the struct which you find in:

You can modify this lane graph by using the programs written in Matlab and can be found in:

Tools include: adding edges, deleting edges, deleting points and selecting points.

Class "LaneGraphTools"

In this class implement the follwing requirements:

move_along_route(): A function which helps you to move along the route. It moves the reference state along the given route by a given distance and takes into account the remaining distance on the current edge to next node and the changing to the next edge if neccessary. For example, assume that the distance between path nodes in the above image is 0.02 m (except for the end nodes 0/3, which are in the same location). We want to move the reference state by 0.055 m.

Inputs: route = (11, 42), state = (11, 1, (0.01+0.055))

The state input is then modified to (42, 1, 0.015).

Class "VehicleTrajectoryPlanningState"

In this class implement the follwing requirements:

Speed reduction

Class "MultiVehicleTrajectoryPlanner"

Main Program

Waiting Mode

The program shall start in waiting mode. It will transition into the running mode, when the following conditions are met.

Running Mode

The route planning and collision avoidance shall run independently of the vehicle's actual behaviour. It is assumed that the vehicles follow the reference trajectories with sufficient accuracy.

Define phases for your program:


Start via Lab Control Center

If you use the real lab application, make sure that the supporting software (LCC, IPS) is running and that the vehicles are online (only the ID LED is still blinking, all three other LEDs are turned on) and placed on the map. Assure that you activated Lab mode in the LCC. Then load your example in the LCC and hit "Deploy". The example does not start, if collision cannot be avoided. Therefore make sure not to have to many vehicles selected. Usually up to 10 vehicles will work fine.

Start via Terminal

In a new terminal, run:

cd ~/dev/software/central_routing_example
./run.bash 2,3,5,7,11

The list of integers in the run command must be the exact list of vehicle IDs for the active vehicles. The resulting trajectories will be shown in the LCC.