Git Product home page Git Product logo

plymouth-traffic-env's Introduction

Test Code

  1. Put the foler named sumo (currently private) including the configuration file to this project.
  2. Change the location of the SUMO installment at traffic_envs.config.py line 8,
os.environ["SUMO_HOME"] = "$your_sumo_path"
  1. Run the following code to see the traffic simulation environment:
python env_test.py

Installment of Dependents

Dependents of this project

Create new conda env (see more for conda cmds)::

conda create -n $env_name python=3.8
conda activate $env_name

Install dependents of the project:

pip install e .

I also put a max-pressure controller in this environment as an example controller. This controller uses the PyTorch package, you should download the PyTorch to use the max-weight controller.

The current max-weight controller is not tested yet. There might be some errors with it.

Installment of SUMO

Windows system

Directly download the sumo from the official website SUMO.

The official python api of SUMO is TraCI. It uses a TCP-based server for the user to interact with the simulation environment. However, this API is very slow there are too many vehicles in the network. Libsumo is almost the same with TraCI for the usage but is far more efficient than TraCI. However, the installment of Libsumo in Windows is not tested yet.

Installment of SUMO (with Libsumo) in Linux

Replacing the libsumo with traci can speed up the communication between the simulation and the python project about 10 times (for this project).

Currently I only tried the installment in Linux system (Ubuntu). The installment document is available at Libsumo (Linux: Libsumo for Linux). Here is what I installed the libsumo, which is slightly different from the document provided in the previous link:

Create and activate a new conda env (see more for conda cmds):

conda create -n sumo python=3.8
conda activate sumo

Install all of the required tools and libraries

sudo apt-get install cmake python g++ libxerces-c-dev libfox-1.6-dev libgdal-dev libproj-dev libgl2ps-dev swig

Get the source code (there is no requirement for the path of this downloaded code, this is only used for this installing):

git clone --recursive https://github.com/eclipse/sumo

Build the SUMO binaries:

export SUMO_HOME="$PWD/sumo"
mkdir sumo/build/cmake-build && cd sumo/build/cmake-build

Then the following cmd is different from the docs provided in the official link (Libsumo for Linux). The reason is that here we choose to install the sumo to the created conda env:

cmake ../.. -DCMAKE_INSTALL_PREFIX=$env_path

where $env_path is the path to the created conda env (usually ~/Anaconda/envs/$env_name).

Finally, run the following cmds:

make -j$(nproc)
make install

To verify the installment:

python
import traci
import libsumo

plymouth-traffic-env's People

Contributors

xingminw avatar zhuhj-tery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.