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

C++
cd ~\dev\software\central_routing_example

Goal

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.

Sources:

C++
cd ~/dev/software/central_routing_example/src/lane_graph.hpp
MATLAB
cd ~/dev/software/matlab_scripts/map_print/map_print2/lane_graph.m

Each node is a base point for the trajectory. 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.

Preparation I : Write a class "LaneGraphTools"

In this class implement the follwing requirements:

cd ~/dev/software/central_routing_example/src/LAneGraphTools.cpp

Preparation II: Write a class called "VehicleTrajectoryPlanningState"

In this class implement the follwing requirements:

 cd ~/dev/software//central_routing_example/src/geometry.hpp
     cd ~/dev/software/central_routing_example/src/VehicleTrajectoryPlanningState.cpp#L121
cd ~/dev/software/central_routing_example/src/VehicleTrajectoryPlanningState.cpp#L162

Preparation III: Write a class called "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:

Apply

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.