Comms

Author:
  • Max Pacheco Ramírez

Enable remote access to boat’s terminal

In order to control global, important, or not necessarily ROS-related commands on the remote computer, Getty services are implemented.

Set RF Modules

Holybro SiK Telemetry Radios are used for this task, configured at 115,200 kbps on a separate channel to avoid interference with the RTK information being sent from another pair of the same radios, or the radios from other teams.

Getty

Based on this blog detailing instructions for getty service configurations, the following lines are added to a new file /etc/systemd/system/custom-getty@.service in the Jetson:

# /etc/systemd/system/custom-getty@.service
[Unit]
Description=Custom Serial Getty on %I
Documentation=man:agetty(8)
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

[Service]
ExecStart=-/sbin/agetty -L 115200 %I vt220
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/ttyHOLY%I
TTYReset=yes
TTYVHangup=yes

[Install]
WantedBy=multi-user.target

To enable this service (every time before you’re starting the autonomy challenge), use the bash scripts on the .setup directory in vanttec_usv repository (if not in main branch, in branch develop). Also, if you’re having trouble with the service, see the README.md file on that hidden directory for debugging.

Connect!

Wowie! You should now be able to access the Jetson’s login prompt connecting to your XBee device using minicom on CLI:

sudo minicom -D /dev/ttyHOLY -b 115200 -c on

Remote access to ROS 2 topics

In order to have a visualization of the autonomous system’s status, because just doing a topic echo on the transparent mode from getty services isn’t as visually understandable as RViz, ROS 2 topics are sent on separate serial devices: the XBee S3B RF Modules.

XBee radios configuration

Using the XCTU Software, both XBee devices are set to a baud rate of 230,400 kbps and in API mode. The configuration parameters include:

  • AP (API Enable) = API Mode with Escapes [2]

  • BD (Interface Data Rate) = 230400 [7]

  • NI (Node Identifier) = BOAT_XBEE for boat device, STATION_XBEE for ground station

  • ID (Network ID) = Same value for both devices to ensure communication

ROS 2 nodes

In order to send the relevant variables for debugging from the remote device to the ground station, a ROS 2 interface through 2 nodes was developed. The logics for the XBee ROS 2 interface are:

  • Configuration

    • Uses a YAML configuration file to specify:

      • Topic names and message types

      • XBee port configurations

      • Update rates

      • Enabled/disabled topics

    • Allows easy modification of transmitted data without code changes

  • Boat Node (xbee_boat_node)

    • Subscribes to selected ROS 2 topics on the USV

    • Processes incoming messages into transmittable data

    • Packs data efficiently with message IDs and size information

    • Sends data chunks through XBee radio

    • Supports both numeric and string data types

    • Uses configurable update rate (default 10Hz)

  • Station Node (xbee_station_node)

    • Receives packed data from boat node

    • Unpacks data based on message type

    • Republishes data to corresponding ROS 2 topics with /usv_comms prefix

    • Handles different message types appropriately:

      • Standard messages (pose, velocity, etc.)

      • Object lists with mixed data types

    • Provides error handling and logging

  • Message Protocol

    • Efficient binary protocol for data transmission

    • Message structure:

      • Message ID (1 byte)

      • Message Size (2 bytes)

      • Packed data (variable length)

    • Type-aware packing for both numbers and strings

    • Error detection and validation

  • Key Features

    • Modular design with base class for common functionality

    • Configuration-driven topic selection

    • Robust error handling and logging

    • Automatic network discovery

    • Bandwidth-efficient message packing

    • Support for complex message types (like object lists)

  • Usage

    • Start nodes:

      # On the boat:
      ros2 run usv_comms xbee_boat_node
      
      # On the ground station:
      ros2 run usv_comms xbee_station_node
      
    • Monitor topics:

      # View republished topics
      ros2 topic list | grep "/usv_comms"
      

This implementation provides a reliable and configurable way to monitor the autonomous system’s state remotely, enabling better debugging and visualization through tools like RViz while maintaining efficient bandwidth usage through careful message packing and topic selection.