ROS Connector#

The Duckiematrix comes with a ROS connector that allows for the connection of Duckietown robots to the Duckiematrix.

Both physical and virtual Duckietown robots can be connected to the Duckiematrix using a ROS connector. Physical robots connected to the Duckiematrix allow for hardware-in-the-loop simulation of agents, while virtual robots provide a fully simulated solution.

The intercommunication between ROS and the Duckiematrix happens at the level of the hardware drivers. In particular, virtual versions of the drivers found in the dt-duckiebot-interface repository are implemented using the Python SDK. This allows for virtual sensor (e.g., camera, time-of-flight, etc.) data to be bridged from the Duckiematrix to the ROS network (ROS messages). Similarly, virtual actuator (e.g., motor, LED, etc.) drivers receive control commands from the ROS network and then relay these commands to the Duckiematrix engine.

Fig. 7 shows the underlying architecture of hardware drivers for a Duckiebot connected to an instance of the Duckiematrix, while Fig. 8 shows the architecture of hardware drivers for a real-world Duckiebot (no Duckiematrix).

../_images/block-ros-connector-hw-drivers-sim.png

Fig. 7 Architecture of hardware drivers for a Duckiebot connected to a Duckiematrix.#

../_images/block-ros-connector-hw-drivers-real.png

Fig. 8 Architecture of hardware drivers for a real-world Duckiebot (no Duckiematrix).#

Attach a Duckietown robot to a Duckiematrix entity#

For a Duckietown robot to act and sense inside the Duckiematrix, it needs a proxy in the Duckiematrix (a Duckiematrix entity) to attach to. A robot outside the Duckiematrix is said to be attached to a Duckiematrix entity when all of its sensors and actuators are linked to their virtual counterparts inside the Duckiematrix.

To attach a Duckietown robot to a Duckiematrix entity, run the following command, where ROBOT is the name of the robot and ENTITY is the name of the entity (e.g., map_0/vehicle_0):

dts matrix attach [-e ENGINE_HOSTNAME] ROBOT ENTITY