Skip to content

Python APIs to control Plexe models in SUMO

Notifications You must be signed in to change notification settings

SafrasIqbal/plexe-pyapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plexe APIs for Python

This repository includes the APIs for the platooning functions provided by Plexe in SUMO.

Installation

Clone the repository and then install the APIs using pip:

cd plexe-pyapi
sudo pip install .

or

pip install --user .

if you don't want to install the APIs system-wide. To uninstall them:

sudo pip uninstall PlexeAPI

or

pip uninstall PlexeAPI

if you have chosen the user installation.

Usage

The APIs are provided by a single class (plexe.Plexe) which should be added as a StepListener to traci. Look at the following snippet for an example:

from plexe import Plexe, ACC
import traci

sumo_cmd = ["sumo-gui", "-c", "sumo.cfg"]
traci.start(sumo_cmd)
plexe = Plexe()
traci.addStepListener(plexe)

traci.simulationStep()
plexe.set_active_controller("vehicle.0", ACC)
plexe.set_cc_desired_speed("vehicle.0", 30)
plexe.set_fixed_lane("vehicle.0", 0)

Examples

The examples folder includes some demo applications showing Plexe features within SUMO using the TraCI interface via Python. The demos include:

  • A join maneuver demo, where a vehicle approaches a platoon of 8 cars and joins it in a certain position.
  • An engine demo, which shows the features of the realistic engine model by running a sort of drag race between three different vehicle models: an Alfa Romeo 147, an Audi R8, and a Bugatti Veyron.

The code of the first example is implemented inside the joindemo.py file, while the second inside enginedemo.py. You can simply run them using

python3 joindemo.py

and

python3 enginedemo.py

After running for a certain amount of time, both demo resets and automatically start from scratch (demo mode).

Alternatively, you can run them together with a dashboard, which shows the RPM, the speed, the gear, and the acceleration of the vehicle being tracked in the GUI. By tracking a different vehicle, the dashboard shows the data of the chosen one.

To run the demos together with the dashboard type

python dashboard-demo.py joindemo.py

and

python dashboard-demo.py enginedemo.py

Running the dashboard requires you to install PyQt5. These demos currently work with versions of Plexe SUMO starting from Plexe 2.1, which can be downloaded here. Checkout and compile the plexe-2.1 or the master branch.

For more information on Plexe, visit http://plexe.car2x.org.

Installing PyQt5

On Python 3 PyQt5 is available as a binary package on pip. After installing Qt5 on your machine, PyQt5 can simply be installed by typing

sudo pip install PyQt5

or

pip install --user PyQt5

for a non system-wide installation.

For Python 2.7, the user is required to download and compile the source packages for sip and for PyQt5. Download the lastest version of sip from here. Unpack the sources and cd into the directory. Then type the following commands to configure, build, and install sip:

python configure.py --sip-module PyQt5.sip
make
sudo make install

Then download the PyQt5 sources from here. Unpack the sources and cd into the directory. Then type the following commands to configure, build, and install PyQt5:

python configure.py
make
sudo make install

References

If you use Plexe for your scientific work please consider citing it using the following reference:

Michele Segata, Stefan Joerer, Bastian Bloessl, Christoph Sommer, Falko Dressler
and Renato Lo Cigno, "PLEXE: A Platooning Extension for Veins," Proceedings of
6th IEEE Vehicular Networking Conference (VNC 2014), Paderborn, Germany,
December 2014.

For LaTeX, use the following BibTeX:

@inproceedings{segata2014plexe,
  author = {Segata, Michele and Joerer, Stefan and Bloessl, Bastian and Sommer,
            Christoph and Dressler, Falko and Lo Cigno, Renato},
  title = {{PLEXE: A Platooning Extension for Veins}},
  booktitle = {6th IEEE Vehicular Networking Conference (VNC 2014)},
  pages = {53-60},
  year = {2014},
  month = {December},
  address = {Paderborn, Germany},
  publisher = {IEEE},
  doi = {10.1109/VNC.2014.7013309}
}

About

Python APIs to control Plexe models in SUMO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%