Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.
Marvin Frick edited this page May 28, 2013 · 1 revision

##Quick Start

To use the TraCI Node movement in Shawn you need a movement simulator (e.g. [http://apps.sourceforge.net/mediawiki/sumo/index.php?title=Main_Page SUMO]) which acts as TraCI server. If you got the server running, start Shawn and make sure that in your config file a line like the following occurs:

<code><nowiki>
node_movement mode=TraCI remote_host=<remote_host> remote_port=<remote_port> feed_time=<feed_time> \
traffic_light_nodes=<traffic_light_nodes> vehicle_processors=<processor_name> \
traffic_light_processors=<processor_name>
</nowiki></code>
  • remote_host: Is a string and describes the host which the movement simulator (server) is executing. The value is optional. If not set the default remote_host is localhost.
  • remote_port: Is an integer and describes the port for the communication. The value is optional. If not set the default remote_port is 8888.
  • feed_time: Is a double and it describes the time the movement simulator should simulate before it starts to schedule the movements to Shawn. It is optional. If not set the default value is 0.0.
  • traffic_light_nodes: Is a boolean value and if set to true traffic light nodes are automatically set if the movement simulator supports traffic lights and if the scenario of the movement simulator has traffic lights.
  • vehicle_processors: A comma separated list of processors for the vehicle nodes.
  • traffic_light_processors: A comma separated list of processors for the traffic light nodes. Be aware of other node placement tasks like rect_world if provided in your config file. If so there will be other nodes not controlled by TraCI.

To run the simulation you have to call the simulation task as usual.

##Details

###Nodes

The vehicle nodes are automatically placed and moved by TraCI. If in your config file traffic_light_nodes is set to true traffic light nodes are also added if your movement simulator and scenario are supporting traffic lights. If you want to place nodes by your own from Shawn code call new_node(const TraCIID& traci_id, bool attach_processors_by_domain). This method returns a pointer to the new node if the request was successful, otherwise NULL. The first Parameter is the TraCIID. The TraCIID is a struct of two integer the domain and the id of the node within the domain. To understand the concept behind the TraCIID see [http://apps.sourceforge.net/mediawiki/sumo/index.php?title=TraCI#Command_Scenario_.28id_0x73.29 SUMO Wiki (TraCI)]. If a node with same TraCIID already exists the request wouldn't be successful and a null pointer will be returned. The second parameter (attach_processors_by_domain) is optional (default is true). If true the new node got the processors by his domain. The processors by domain are provided in your config file. Actually only vehicles and traffic lights are supported. It is not recommended to put vehicle nodes in the scenario by your own from Shawn because they will be deleted if they receive no movements. The placement of vehicle nodes automatically done by TraCI. Notice that the nodes in Shawn have an id. Don't mix it up with the TraCIID. To get the TraCIID to a node or vice versa take the methods:

  • const shawn::Node* find_node_by_traci_id(const TraCIID& traci_id)
  • shawn::Node* find_node_by_traci_id_w(const TraCIID& traci_id)
  • const TraCIID& find_traci_id_by_node(const shawn::Node& node). It is save to remove a node via the worlds remove_node method. The TraCI task is informed and updates also it's internal mapping.

###Commands

The commands are explained in [http://apps.sourceforge.net/mediawiki/sumo/index.php?title=TraCI SUMO Wiki (TraCI)].