

enableWheelsRotation: Defines if the wheels of the vehicles should rotate or not (wheels rotation has an impact on the simulation speed but makes the simulation look more realistic).enableTrafficLights: Defines if the traffic lights synchronization should be used or not.useNetconvert: Defines if NETCONVERT should be called before launching SUMO, this should be disabled if a *.net is already provided.gui: Defines if the command-line or GUI version of SUMO should be used.

Here are the parameters of the SumoInterface PROTO (which inherits from the Supervisor node): Here the 'trafficLightID' is equal to '-1320' and the trafficLightIndex is equal to '2'" In the traffic lights mode you can simply select a traffic light and right click on one of the connections to get all the required information. If the LEDs names are respected, the state of the traffic light will be automatically updated in Webots from SUMO by the interface.Ī simple way to get the traffic light Ids and indexes is to open the network file in Netedit. If the simulation contains traffic lights, the name of the corresponding LEDs node of these traffic lights in Webots should respect the following syntax: trafficLightID_trafficLightIndex_r/y/g. Similarly, the class motorbike will randomly select between the Motorbike and the Scooter PROTO.įinally, the classes trailer and truck will select the Truck PROTO, respectively with and without a trailer. If the abstract vehicle class of the vehicle is bus Webots will use the Bus PROTO. If the SUMO abstract vehicle class (vClass vehicle attribute, refer to SUMO documentation for more information about this attribute) of the vehicle is passenger (default), one of the available car PROTO models will be randomly selected and created in Webots. If some vehicles whose DEF name is WEBOTS_VEHICLEX (with X being the vehicle number starting from 0) are present in the simulation, the interface will automatically add them and update their position and orientation in SUMO in order to close the loop. Automatic Injection of Webots Vehicles in SUMO The SUMO Interface example simulation showcases this possibility in a very simple manner. The controller can in turn enable the sensors and record the output of the sensors in a file (or send them to an external process). Then, you can add sensors in its sensor slots and assign a controller to the vehicle. You simply need to add your vehicle in the simulation and set an appropriate DEF name as explained previously. It is very convenient to use the vehicles controlled by SUMO to collect sensor data in realistic traffic conditions. If some vehicles whose DEF name is SUMO_VEHICLEX are already present in the world at the simulation start, then the interface will automatically use them before creating new vehicles, this can be useful to avoid real-time addition of vehicles (which can make the simulation speed drop for a very short time).įurthermore, when a vehicle enters the SUMO network, if a vehicle whose DEF name is identical to the ID of the vehicle in SUMO is present in the simulation, this vehicle is then associated to the one in SUMO. Use Vehicles Already Present in the World You need therefore to install XQuartz (version 2.7.8 or later) for the interface to work. The vehicle DEF name is set to SUMO_VEHICLEX, with X being the vehicle number (starting from 0). The interface will automatically start SUMO and run it in synchronization with Webots time.Įach time a new vehicle enters the SUMO simulation, it will be created in Webots too and its position and orientation will be continually updated. Note: Currently version 0.30 of SUMO is distributed with Webots, but if the SUMO_HOME environment variable is defined, Webots will use the version of SUMO specified in this variable. If those configuration files do not exist, the interface will look for a configuration file with any other name (it is not recommended to have several configuration files for SUMO or NETCONVERT in the same folder as you don't know which one is going to be used). The configuration files called ccfg and sumo.sumocfg will be loaded by default. sumocfg), for more information please refer to the SUMO documentation. rou.xml, etc.) and the configuration files (.netccfg and. This folder should contain the usual files defining a network in SUMO (.edg.xml.

In order to use this interface, a SumoInterface PROTO node should to be added to the world.Īnd a folder called worldName_net should be present at the same level as the world file. This interface is written in Python in a Supervisor controller and uses TraCI to communicate with SUMO. The advantage of interfacing SUMO with Webots is that it allows to easily generate traffic using a large number of vehicles in real-time. An interface with a microscopic traffic simulator called SUMO (Simulation of Urban MObility) has been developed using a Supervisor node.
