- Group 26
- 4798740 Stan Marseille
- 5096979 Pieter Klopper
- 5171598 Jolle Verhoog
- 5452333 Marcin Poplawski
Dynamic_environment.mp4
This repository implements a motion planning system for autonomous vehicle, simulated in a gym_envs_urdf environment. It uses a kinematic bicycle model for realistic motion, combining Motion Primitives and the A* algorithm for efficient real-time path optimization. The system includes:
- A global planner for navigating static environments.
- A local planner for avoiding dynamic obstacles in real-time.
simulation.py: Combines helper files and provides visualization for the full simulation.
-
maps(Simulation Environments):rectangular_environment.py: Straight road setup with wall boundaries and static obstacles.l_shaped_environment.py: Corner road setup with wall boundaries, static obstacles, and dynamic obstacles.
-
planners(Planning Algorithms):global_planner.py: Implements pathfinding with A* algorithm, heatmap-based centering, and polynomial smoothing.motion_primitives.py: Framework for generating smooth, collision-free trajectories and visualizing them.
-
urdf(Robot and Visualization Files) -
images(Outputs Folder)
- Python >= 3.8
- pip3
- git
-
Set Up the Environment:
- Clone and install the
gym_envs_urdflibrary:git clone git@github.com:maxspahn/gym_envs_urdf.git
- Clone and install the
-
Clone This Repository:
- Clone the PDM Group 26 repository:
git clone git@github.com:marpopl/PDM-Group26.git
- Clone the PDM Group 26 repository:
- Choose the environment by setting
L_shapedandRectangularbooleans in the simulation script.
By default Test D is executed for rectangular environment, and Test I for L-shaped environment.
To change between different tests you need to uncomment relevant lines in simulation.py (lines 132-161 for rectangular and lines 188-217 for L-shaped) and, if needed, modify the safety_margin (default to 1.0) in planners/motion_primitives.py (line 13).
The velocity is set at the beginning of run_prius_with_walls function in simulation.py (line 104). It is set to 1.0 by default, although can be changed (if too large velocity is selected the path will not be created).
PID control gains are defined at line 290 of simulation.py and can be adjusted.
Optionally, obstacle parameters for rectangular (lines 124-125) and L-shaped (lines 174-179) environments can be edited in the function run_prius_with_walls in simulation.py, with detailed descriptions of parameter meaning in maps/rectangular_environment.py and maps/l_shaped_environment.py.
In simulation.py under # local planner settings three safety margins are set (lines 304-306) and are relevant for Tests G-L in L-shaped environment with dynamic obstacles. These margins work by default for Test I and can be adjusted.
-
Activate the Environment:
- Source the
gym_envs_urdfvirtual environment:source urdfenvs/bin/activate
- Source the
-
Run the Main Program:
- Navigate to the repository and execute the main script:
cd PDM-Group26 python3 simulation.py
- Navigate to the repository and execute the main script:
- Virtual Environment Activation: Ensure
gym_envs_urdfis correctly installed and sourced before running the simulation. - Parameter Configuration: Ensure parameters in
run_prius_with_wallsare properly set for the chosen environment. - Too high velocity: Line 154 of
motion_primitives.pywill return a KeyError if the selected velocity is too high. Try setting velocity to default value of 1.0.