marvis.mobility_input.sumo

SUMO co-simulation.

Classes

SUMOMobilityInput

SUMOMobilityInput is an interface to the SUMO simulation environment.


class marvis.mobility_input.sumo.SUMOMobilityInput(name='SUMO External Simulation', steps=1000, sumo_host='localhost', sumo_port=8813, sumo_cmd='sumo', config_path=None, step_length=1)[source]

Bases: marvis.mobility_input.mobility_input.MobilityInput

SUMOMobilityInput is an interface to the SUMO simulation environment.

This mobility input supports two modes:

  • Remote Mode: In this mode the testbed connects to an external already running SUMO instance.
    You configure the host and port where the SUMO server is running via the sumo_host and sumo_port argument.
  • Local Mode: In this mode the testbed starts a locally installed version of SUMO.
    You configure the simulation via the sumo_cmd and config_path argument. If SUMO is not installed globally you need to set the SUMO_HOME environment variable.
    Warning: This does not work when using marvis in the prebuilt docker containers. For instructions on how to use marvis without Docker, please refer to Local Installation Without Docker and Install SUMO On Simulation Host.
Parameters
  • name (str) – The name of the MobilityInput.

  • steps (int) – The number of steps to run the SUMO simulation.

  • sumo_host (str) – The host on which the SUMO simulation is running.

  • sumo_port (int) – The TraCI port.

  • sumo_cmd (str) – The command to start sumo when using the local mode (default: sumo).

  • config_path (str) – The path to the simulation configuration (.cfg).

  • steplength (float) – The length of each simulation step in seconds (default: 1). It only has effect in the local mode.

sumo_host

The host on which the SUMO simulation is running.

When running on a devcontainer, this is probably localhost.

sumo_port

The TraCI port.

Can be specified on the server with the --remote-port option.

sumo_cmd

The command to start sumo locally

config_path

The path to the simulation scenario configuration.

steps

The number of steps to simulate.

step_length

The length of every simulation step

step_counter

The number of steps to simulate in SUMO.

prepare(simulation)[source]

Connect to SUMO server.

start()[source]

Start a thread stepping through the sumo simulation.

add_node_to_mapping(node, sumo_vehicle_id, obj_type='vehicle')[source]
destroy()[source]

Stop SUMO.

name

The name of the input.

node_mapping

The mapping of simulation nodes to IDs identifying the nodes in the external simulation interface

Inheritance Diagramm

Inheritance diagram of marvis.mobility_input.sumo