Skip to content

molumitu/idSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

452 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

idSim

Autonomous driving environment for generalization

Prerequisites

  • Eclipse SUMO: Version 1.15.0
    1. Install SUMO from https://sumo.dlr.de/docs/Downloads.php.
    2. Make sure to configure PYTHONPATH and SUMO_HOME properly. On Windows, if installing from an installer, this should have been added automatically. On Linux, modify ~/.bashrc with
      export PYTHONPATH=$PYTHONPATH:/usr/share/sumo/tools
      export SUMO_HOME=/usr/share/sumo

Installation

NOTE: idSim assumes conda-forge as the default channel. You should do either of the following:

  1. Set conda-forge as the default channel in .condarc;
  2. Add --channel conda-forge --override-channels option in every idSim-related conda {create|install} command.
conda create -n idsim python=3.9 numpy pandas 'shapely>=2' omegaconf typing_extensions 'cython>=3' libbezier
conda activate idsim
pip install . --no-build-isolation
# Or editable install:
# pip install -e . --no-build-isolation --config-settings editable_mode=strict

Usage

  1. Run scripts/generate_scenarios.py to create scenario files
  2. idsim.envs.env contains a Gymnasium-like environment: CrossRoad

Develop

Type hinting

If you are using vscode on Linux, add the following snippet to .vscode/settings.json

{
    // ...
    "python.analysis.extraPaths": [
        "/usr/share/sumo/tools"
    ],
    // ...
}

Debugging

Some rare logic error may take a long time to occur once. To capture this, we use try ... except ... in _step_simulator to dump relevant information. You could find this information in <system temp folder>/idsim-... folder (the path will be shown in error message). Inside the folder, the info.pkl pickle file contains config, the latest context and the last run's engine seed. The sumo_state.xml stores sumo state which may be loaded in sumo-gui for further debugging.

Pickle loading

The config and context contain platform-dependent Path object, which prevents loading on a different platform. To workaround this, monkey-patch e.g.

import pathlib
pathlib.PosixPath = pathlib.WindowsPath  # On windows

before loading.

Sumo state loading

Load info.pkl, evaluate info['context'].configuration_file. Load corresponding sumocfg in sumo-gui, choose Simulation -> Load to load sumo_state.xml.

Sumo GUI interaction

When debugging Python, simulationStep called after moveToXY could freeze sumo GUI. Either:

  1. Halt the simulation (either manually or with a SUMO breakpoint) when approaching the instant you want to debug, and single-step in sumo GUI; or
  2. Already debugging, before ANY interaction with sumo GUI, click Halt the simulation button first

TODO

Reinforcement learning related

  • Add traffic light observation | Now with a prototype

  • Reward design, mainly collision related

  • Trajectory/lane selection

  • Driving area boundary observation | Via lidar

  • Add surrounding vehicle

Internal

  • General & random traffic flow generation | Now with a prototype, improve flow-based, randomness, avoid traffic jam

  • Improve navigation, v_ref, regulation, tls

  • Sensor modeling

  • Fine-grained task requirements: turning direction, etc.

  • Unit test on some fundemantal logics

  • Dump & Replay

  • More general teleport (e.g., keyboard takeover for Experiment) (or REPL) | Basic support, usability blocked by #eclipse/sumo/10974

  • Performance optimization

  • More robust checks | Via shapely

  • Recheck render clean-up logic (e.g. close before step) | Via singleton_mode

  • Test moveToXY argument keepRoute=0b010/0b011 | Use keepRoute=0b011 is more suitable

  • Investigate sumo load state ego vehicle disappear | Maybe related to keepRoute=0b010, recheck if happened again

  • Subscribe person information (if native collision not working) | Subscribed with libsumo workaround

  • moveToXY edge and lane | Currently unnecessary as we do not have overlapping roads (e.g. bridge)

  • Role of --lateral-resolution | May not be important at present, choosing the same as lane_width

  • Investigate huge start/load slowdown after adding pedestrian at 5ba79c2 (220 it/s -> 7.5 it/s) | Seems pedestrian leads to this slowdown

Sumo related

  • Investigate Sumo native collision detection not working, check --collision.check-junctions | Remote controlled vehicle collision detection not working in junction, see #eclipse/sumo/10952; fixed with eclipse/sumo/3938188

  • Out-of-lane vehicle using moveToXY cause sumo-gui freeze when not calling simulationStep continuously | See #eclipse/sumo/10974

  • convertRoad with vClass produces wrong result near crossing | Not a sumo bug, vClass argument passed to wrong location isGeo

  • moveToXY failure at parallel internal junction (prevent 3-way 3-lane intersection) | See #eclipse/sumo/12065, may be released in 1.16.0

About

[IEEE TITS] RL Infrastructure, an efficient training environment for autonomous driving

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors