The project is developed and verified based on the CommonRoad. The main problem is that the current calculation process of reachable sets is; first predict the trajectory of other vehicles, and then calculate the reachable sets. So the resulting reachable sets do not take into account the impact between vehicles. So this project uses MCTS to solve the vehicle interaction problem and obtain interaction-aware reachable sets.
- Tactical cooperative planning for autonomous highway driving using Monte-Carlo tree search
- Computing the drivable area of autonomous road vehicles in dynamic road scenes
- CommonRoad-Reach: A Toolbox for Reachability Analysis of Automated Vehicles
We recommend using Ubuntu 18.04 and 20.04. And use Anaconda to create a conda environment to manage the required packages and libraries.
-
CommonRoad-IO
pip install commonroad-io
-
CommonRoad Route Planner
pip install commonroad-route-planner
-
CommonRoad Drivabilibty Check
The intialization of this package refers to this CommonRoad dc Domumentation. We
git clone
the following branch:https://gitlab.lrz.de/cps/commonroad-drivability-checker/-/tree/development
and use the following command to initial:
bash build.sh -j 6 --cgal -i
-
CommonRoad Reach
The readme.md in this package provides a detailed activation tutorial. But it should be noted that:
You need to specify commonroad-drivability-checker package path that can be detected, that is,
DCRDC_DIR
instead ofCRDC_DIR
, otherwise the package will not be found.DCRDC_DIR="<your path>/commonroad-drivability-checker" pip install -v .
Secondly, use
cmake
to compile the filecmake .. -DPYTHON_VER="cpython-37" -DCRDC_DIR="<your path>/commonroad-drivability-checker"
Use the
make
to generatepycrreach.xxx.so
, which needs to be copied and moved to the file directorycommonroad-reachable-set/commonroad-reach
. Finally, you can run the file to test whether the activation is successful,
-
Test scenarios are download from CommonRoad Benchmark.
-
This folder contains two files, which implement the IDM follow-up model.
-
- config.py: Definition of gloable variables
- actions.py: Each Action is a value (acceleration)
- actions_range.py: Each Action is an range of acceleration
- basefunctions.py: This file applies to action is an acceleration range. The file integrates various functional equations: Collision detection, target area detection, reference path generation, idm agent definition, heuristic random selection, etc.
- basefunctions_O.py: This file is similar to basefunctions.py, but applied to acrion is a value.
- mcts_node.py: Basic componnets of MCTS.
- mcts_idm_sim_reach.py: Reliazation of MCTS. An interval action is used and in simulation stage, the sequence decision will be made. The behaviour of surrounding vehicles is stimulated by the IDM model and the behaviour of ego vehicle will be controlled by heuristic random selection based on the action system.
- mcts_v.py: Reliazation of MCTS. Action is a value and will be used only one sample tinme. In simulation stage, only the ego vehicle will be controlled by action sytem, the trajectories of other vehicles will be directly used to simulation.
- mcts_v5.py: Similar to mcts_v.py. Only one difference is that the action will be used for five sample times.
- mcts_idm_sim_v5.py: Reliazation of MCTS. In simulation stage, the surrouding vehicles will be simulated by IDM, the action for ego vehicle is a value.
- visualization.py: Visulization of the simulated result.
- Others: Test for different realization of MCTS.
-
This file is to test the MCST with the action( a value). Simulation results include the postion and acceleration over time. And a gif file for ego vehilce shows that the ego vehicle moved based on the action list from MCTS.
-
This file is to test the MCST with the action( an range). Simulation results include action list and will be output to calulate the reachable sets. And a gif file for ego vehilce shows the interaction-aware reachable sets over time.
Because we continuously update the maximum and minimum acceleration in the calculation of the reachable set, we need to update the zero state polygon at the same time when updating. And ensure that the reachable set is pruned at the end. So the source files in commonroad-reach need to be modified, and the modified files in the commonroad-reach need to replace the original files.
Run mcst_example.py with mcts_idm_sim_v5.py for the test scenario DEU_IV21-1_1_T-1.xml
.
The simularion result:
Ego vehicle (id = 7) first decelerating for keeping a distance to leader vehilce (id = 6). Then ego vehicle accelerates to the desired velocity. Wenn the velocity of ego vehicle is higher than the desired velocity, the ego vehicle dont accelerating any more. The gif shows the result.
Run reach_example.py with mcts_idm_sim_reach.py for the test scenario ZAM_Intersection-1_2_T-1.xml
.
The first picture is the original reachable sets. The second picture shows the simulation results with the desired velocity of ego vehicle (15 m/s). Interaction-aware reachable sets shows that ego vehicle crosses the intersection first, and when we reduce the desired velocity to 6, we get the third picture and find that the ego vehicle waits for another vehicle to cross the intersection.