Communication with simulator and interpreter#
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.
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 |