This repository includes a Pedestrian Simulation Framework built on the CommonRoad scenario format. It simulates pedestrian behavior using a social force model and integrates policy-based movement planning for dynamic and realistic pedestrian predictions.
For a practical application of this pedestrian simulation model, explore our Pedestrian Aware Motion Planner.
- Social Force Model: Simulates pedestrian interactions and behaviors.
- Policy-based Planning: Implements movement policies for destination selection.
- Integration with CommonRoad: Direct compatibility with CommonRoad scenarios.
- Visualization: Detailed rendering of scenarios and pedestrian trajectories.
Click to expand
The software is developed and tested on recent versions of Linux. We strongly recommend using Ubuntu 22.04 or higher. For the Python installation, we suggest the usage of Virtual Environment with Python 3.11, Python 3.10 or Python 3.9 For the development IDE we suggest PyCharm
git clone <repository-url>
cd <repository-folder>
python3.11 -m venv venv
source venv/bin/activate
To install the project and its dependencies, ensure you have Poetry installed. Then, run the following commands:
Install the dependencies and the project:
poetry install
Alternatively, you can install the project's requirements using pip:
pip install .
Click to expand
-
Load a Scenario: Load a CommonRoad scenario that includes pedestrians using the
CommonRoadFileReader
:from commonroad.common.file_reader import CommonRoadFileReader scenario_path = 'path/to/scenario.xml' scenario, planning_problem_set = CommonRoadFileReader(scenario_path).open()
-
Initialize the Simulator: Instantiate the Pedestrian Simulator with the loaded scenario:
from pedestrian_simulator import PedestrianSimulator pedestrian_simulator = PedestrianSimulator(scenario)
-
Simulate Pedestrian Behavior: Advance the simulation for a specified number of steps:
for timestep in range(100): pedestrian_simulator.step_pedestrians(timestep)
Click to expand
The repository includes a Minimal Working Example (MWE) in main.py
to demonstrate the pedestrian simulation workflow:
You can include the pedestrian simulator in any CommonRoad scenario.
python3 main.py
Click to expand
The framework supports detailed visualization of:
- Pedestrian trajectories.
- Interaction forces.
- Vehicle predictions (if vehicles are present in the scenario).
Click to expand
The create_pedestrian_scenario
utility allows you to extend an existing CommonRoad scenario by adding pedestrians, sidewalks, and crosswalks. This tool is highly configurable to adapt to a variety of simulation needs.
- Add sidewalks and crosswalks to existing scenarios.
- Add pedestrians to the scenario.
- Customize parameters such as pedestrian speed, clustering distance, and position deviations.
- Visualize the generated scenario.
from pedestrian_simulator.tools.create_pedestrian_scenario import create_new_pedestrian_scenario
input_file = "path/to/scenario.xml"
scenario, planning_problem_set = create_new_pedestrian_scenario(
input_file=input_file,
pedestrian_speed=1.2, # Average pedestrian speed
pedestrians_per_cluster=2.0, # Number of pedestrians per cluster
position_deviation=0.2, # Deviation in positions within a cluster
cluster_distance=4.0, # Distance between pedestrian clusters
seed=42 # Random seed for reproducibility
)
# Save or visualize the scenario as needed
See also the MWE in create_pedestrian_scenario.py
for an example workflow.
Click to expand
For detailed explanations of the attributes and methods, refer to the source code. The key method of the simulator is:
step_pedestrians(timestep)
: Advance simulation by one timestep (starting from the given timestep).
Click to expand
Korbinian Moller, Professorship Autonomous Vehicle Systems, School of Engineering and Design, Technical University of Munich, 85748 Garching, Germany
Johannes Betz, Professorship Autonomous Vehicle Systems, School of Engineering and Design, Technical University of Munich, 85748 Garching, Germany
Click to expand
If you use this Pedestrian Simulator in your research, please cite the related paper:
t.b.d