MAVLINKHUD

Hardware Integration

Executive Summary

ArduPilot supports Remote ID hardware via two primary protocols: MAVLink (Serial) and DroneCAN. The hardware acts as the transmitter (WiFi/Bluetooth), while the flight controller acts as the data source (GPS, Telemetry).

Theory & Concepts

  • MAVLink: The module connects to a UART. ArduPilot pushes OPEN_DRONE_ID_* MAVLink messages to it.
    • Pros: Simple to debug (readable messages).
    • Cons: Burns a UART, slightly higher CPU overhead for framing.
  • DroneCAN: The module connects to the CAN bus. ArduPilot publishes dronecan.remoteid.* messages.
    • Pros: Robust bus, daisy-chainable, no UART needed.
    • Cons: Requires DroneCAN-capable hardware.

2. The Feedback Loop

Communication isn't one-way. The transmitter sends back ARM_STATUS messages to ArduPilot. If the transmitter says "Error" or stops talking, ArduPilot prevents arming (if DID_OPTIONS EnforceArming is set).

Codebase Investigation

1. DroneCAN Backend

Located in libraries/AP_OpenDroneID/AP_OpenDroneID_DroneCAN.cpp.

  • Uses Canard::Publisher to broadcast:
    • dronecan_remoteid_Location (High Rate)
    • dronecan_remoteid_BasicID (Low Rate)
  • Receives dronecan_remoteid_ArmStatus via callback handle_arm_status.

Located in libraries/AP_OpenDroneID/AP_OpenDroneID.cpp.

  • Checks _mav_port parameter to determine which Serial port to use.
  • Uses standard mavlink_msg_open_drone_id_location_send_struct() functions.

Source Code Reference

How To: Set up Cube ID (DroneCAN)

1. Wiring

Connect the Cube ID to the CAN1 or CAN2 port on your flight controller using the 4-pin JST-GH cable.

2. Configuration

Set the following parameters:

  • CAN_P1_DRIVER: 1 (Enable Driver 1)
  • CAN_D1_PROTOCOL: 1 (DroneCAN)
  • DID_ENABLE: 1
  • DID_CANDRIVER: 1 (Use CAN Driver 1)
  • DID_MAVPORT: -1 (Disable Serial)

3. Verification

  1. Reboot.
  2. Go to Setup > Optional Hardware > UAVCAN.
  3. Click SLCAN Mode CAN1.
  4. You should see the Cube ID appear in the node list.
  5. Check the MAVLink Inspector for OPEN_DRONE_ID_ARM_STATUS. Status should be 0 (Good to Arm) after GPS lock is obtained.