Skip to content

Communication with simulator and interpreter#

ZeroMQ communication

We use ZeroMQ Inter-Process communication to communicate with your simulator and traffic simulator.

Note! Simple Sensor Simulator is just a reference implementation. We can adapt any kinds of autonomous driving simulators if we can develop ZeroMQ interface to your simulator.

What is ZeroMQ#

ZeroMQ is an open-source messaging library. It supports TCP/UDP/Inter-Process messaging communication.
We use ZeroMQ in order to communicate with the simulator and interpreter. We use Request/Reply sockets in order to run the simulators synchronously.

Sequence diagram#

The traffic simulator has a ZeroMQ client and the simple sensor simulator has a ZeroMQ server. We use Protocol Buffers (protobuf) in order to serialize data.

sequenceDiagram participant Traffic Simulator participant Simple Sensor Simulator participant Autoware Traffic Simulator ->+ Simple Sensor Simulator : InitializeRequest Simple Sensor Simulator ->-Traffic Simulator : InitializeResponse Traffic Simulator ->+ Simple Sensor Simulator : SpawnVehicleEntityRequest Simple Sensor Simulator ->-Traffic Simulator : SpawnVehicleEntityResponse Traffic Simulator ->+ Simple Sensor Simulator : AttachLidarSensorRequest Simple Sensor Simulator ->-Traffic Simulator : AttachLidarSensorResponse Traffic Simulator ->+ Simple Sensor Simulator : AttachDetectionSensorRequest Simple Sensor Simulator ->-Traffic Simulator : AttachDetectionSensorResponse Traffic Simulator ->+ Simple Sensor Simulator : AttachOccupancyGridSensorRequest Simple Sensor Simulator ->-Traffic Simulator : AttachOccupancyGridSensorResponse Traffic Simulator ->+ Simple Sensor Simulator : AttachPseudoTrafficLightDetectorRequest Simple Sensor Simulator ->-Traffic Simulator : AttachPseudoTrafficLightDetectorResponse loop every frame Traffic Simulator ->+ Simple Sensor Simulator : UpdateEntityStatusRequest Simple Sensor Simulator ->-Traffic Simulator : UpdateEntityStatusResponse Traffic Simulator ->+ Simple Sensor Simulator : UpdateTrafficLightsRequest Simple Sensor Simulator ->-Traffic Simulator : UpdateTrafficLightsResponse Traffic Simulator ->+ Simple Sensor Simulator : UpdateFrameRequest Simple Sensor Simulator ->> Autoware : Send Pointcloud (ROS 2 topic) Simple Sensor Simulator ->> Autoware : Send Detection Result (ROS 2 topic) Simple Sensor Simulator ->> Autoware : Send Occupance Grid Map (ROS 2 topic) Simple Sensor Simulator ->> Autoware : Send Traffic Light Info (ROS 2 topic) Simple Sensor Simulator ->-Traffic Simulator : UpdateFrameResponse end

Schema of the message#

The traffic_simulator::API sends a request to the simulator. The request is serialized using protobuf and uses the port specified by the ROS Parameter port (default is 5555) to communicate with the simulator.

Protobuf definition#

The schema of protobuf is here.
Protobuf documentation is here. All data are serialized as string and sent via TCP by using ZeroMQ.

Required APIs for co-simulation#

The traffic simulator and the simple sensor simulator communicate with APIs. If you want to integrate the simulators with your simulator, only you have to do is preparing the following APIs:

API Request Response
initialize InitializeRequest InitializeResponse
update_frame UpdateFrameRequest UpdateFrameResponse
spawn_vehicle_entity SpawnVehicleEntityRequest SpawnVehicleEntityResponse
spawn_pedestrian_entity SpawnPedestrianEntityRequest SpawnPedestrianEntityResponse
spawn_misc_object_entity SpawnMiscObjectEntityRequest SpawnMiscObjectEntityResponse
despawn_entity DespawnEntityRequest DespawnEntityResponse
update_entity_status UpdateEntityStatusRequest UpdateEntityStatusResponse
attach_lidar_sensor AttachLidarSensorRequest AttachLidarSensorResponse
attach_detection_sensor AttachDetectionSensorRequest AttachDetectionSensorResponse
attach_occupancy_grid_sensor AttachOccupancyGridSensorRequest AttachOccupancyGridSensorResponse
attach_pseudo_traffic_light_detector AttachPseudoTrafficLightDetectorRequest AttachPseudoTrafficLightDetectorResponse
update_traffic_lights UpdateTrafficLightsRequest UpdateTrafficLightsResponse

Last update: May 1, 2024