Skip to content

Joining the arena

Matheus V. C. Cogo edited this page Oct 17, 2023 · 4 revisions

Joining the arena

MQTT entities

For MQTT entities, it is necessary to publish an ArenaHeartbeat message directly to the MQTT broker.

To "see" the arena, simply subscribe to all units' heartbeats using + wildcards: conceptio/unit/+/+/+/heartbeat. To see the position, subscribe to conceptio/unit/+/+/+/data/kinematics

ROS2 entities

Local ROS2

If you are integrating entities into the same local network as the arena, simply publish to ROS2 topics. Mqtt_mirror will listen to ROS2 topics and broadcast them to the MQTT broker, and vice-versa.

Remote ROS2

As ROS2 does discovery with UDP multicasting, communicating with ROS2 entities across the internet is troublesome. Instead of using a VPN (which may require extra permissions to run/setup), remote ROS2 entities can use the mqtt_client bridge.

The bridge allows ROS2 topics to be mapped to MQTT topics at the broker and vice-versa. The downside is that you must know all topic names when starting the node; mqtt_client does not allow you to subscribe to all topics using the # wildcard, nor it allows you to do late subscriptions. To deal with that, you can use our forked version of mqtt_client that has new services (NewRos2ToMqtt and NewMqttToRos2) for dynamic subscription (a pull request has been opened). Once you have all MQTT <-> ROS2 mappings, just follow the MQTT topic structure and instructions to join and "see" the arena.

To sum it up, here is how to join using a remote ROS2 environment:

  1. Clone the forked version of mqtt_client.
  2. Follow mqtt_client README to launch the node with your entity topic mappings (ROS2->MQTT).
  3. In your nodes, use the RequestArenaEntityList service to periodically fetch all entities currently alive in the arena, and then call the RegisterMqttToRos2 service for each new mapping.
  4. Subscribe to the /conceptio/arena/entity_updates topic and set up a callback to do something whenever a new entity is found or removed from the arena (ideally, your callback should call the RegisterMqttToRos2 service to set up a new mapping for this newly-found entity).

Clone this wiki locally