Bridge Configuration

The RosFit bridge is configured through a single YAML file — rosfit-bridge.yaml. This file defines the device identity, MQTT connection, topic mappings, service bridges, shadow behavior, OTA settings, and logging.

Overview

The configuration is divided into six top-level sections:

SectionPurpose
rosfitDevice identity and version
connectionMQTT broker address, transport, TLS, and authentication
bridgeROS 2 ↔ MQTT topic and service mappings
shadowDevice shadow reporting behavior
otaOver-the-air update settings
loggingLog level, file output, and rotation

The bridge reads this file at startup. Changes require a restart unless you send a reload_config command via MQTT.

Full example

# rosfit-bridge.yaml — complete configuration example

rosfit:
  device_id: bot-01
  version: "1.0"

connection:
  provider: self-hosted          # "self-hosted" or "rosfit-cloud"
  host: emqx.rosfit.local
  port: 8883
  transport: tcp                 # "tcp" or "websocket"
  tls:
    enabled: true
    ca_cert: /etc/rosfit/certs/ca.crt
    client_cert: /etc/rosfit/certs/bot-01.crt
    client_key: /etc/rosfit/certs/bot-01.key
    verify_hostname: true
  auth:
    method: token                # "token", "certificate", or "username"
    token: mqtt_tok_a1b2c3d4

bridge:
  publish:
    - ros_topic: /odom
      mqtt_suffix: telemetry/odom
      msg_type: nav_msgs/Odometry
      qos: 1
      throttle_hz: 10
    - ros_topic: /battery_state
      mqtt_suffix: telemetry/battery
      msg_type: sensor_msgs/BatteryState
      qos: 1
      throttle_hz: 1
    - ros_topic: /scan
      mqtt_suffix: telemetry/scan
      msg_type: sensor_msgs/LaserScan
      qos: 0
      throttle_hz: 5
    - ros_topic: /diagnostics
      mqtt_suffix: telemetry/diagnostics
      msg_type: diagnostic_msgs/DiagnosticArray
      qos: 1
      throttle_hz: 0.2
    - ros_topic: /camera/image_compressed
      mqtt_suffix: telemetry/camera
      msg_type: sensor_msgs/CompressedImage
      qos: 0
      throttle_hz: 2

  subscribe:
    - mqtt_suffix: cmd/cmd_vel
      ros_topic: /cmd_vel
      msg_type: geometry_msgs/Twist
      qos: 1
    - mqtt_suffix: cmd/navigate
      ros_topic: /navigate_to_pose
      msg_type: geometry_msgs/PoseStamped
      qos: 1
    - mqtt_suffix: cmd/set_param
      ros_topic: /rosfit/set_param
      msg_type: std_msgs/String
      qos: 1

  services:
    - ros_service: /set_parameters
      mqtt_request: cmd/set_parameters/request
      mqtt_response: cmd/set_parameters/response
      srv_type: rcl_interfaces/SetParameters
      timeout_sec: 10
    - ros_service: /get_parameters
      mqtt_request: cmd/get_parameters/request
      mqtt_response: cmd/get_parameters/response
      srv_type: rcl_interfaces/GetParameters
      timeout_sec: 5

shadow:
  enabled: true
  report_on_change: true
  report_interval_sec: 30
  watched_params:
    - max_speed
    - camera_resolution
    - led_color
    - navigation_mode
    - firmware_version

ota:
  enabled: true
  download_dir: /tmp/rosfit/ota
  scripts:
    pre_update: /opt/rosfit/scripts/pre_update.sh
    install: /opt/rosfit/scripts/install.sh
    post_update: /opt/rosfit/scripts/post_update.sh
    rollback: /opt/rosfit/scripts/rollback.sh
  auto_rollback: true
  max_download_retries: 3
  verify_checksum: true

logging:
  level: info                    # debug, info, warn, error
  file: /var/log/rosfit/bridge.log
  max_size_mb: 50
  rotate_count: 5

rosfit

The rosfit section identifies the device and configuration version.

FieldTypeRequiredDescription
device_idstringyesUnique device identifier, must match the registered device ID
versionstringnoConfiguration schema version (default "1.0")
rosfit:
  device_id: bot-01
  version: "1.0"

connection

Defines how the bridge connects to the MQTT broker.

FieldTypeDefaultDescription
providerstringself-hostedself-hosted for your own broker, rosfit-cloud for managed service
hoststringlocalhostBroker hostname or IP
portinteger1883Broker port (1883 plain, 8883 TLS)
transportstringtcpTransport protocol (tcp or websocket)
tls.enabledbooleanfalseEnable TLS encryption
tls.ca_certstringPath to CA certificate file
tls.client_certstringPath to client certificate (for mTLS)
tls.client_keystringPath to client private key (for mTLS)
tls.verify_hostnamebooleantrueVerify the broker's hostname against the certificate
auth.methodstringtokenAuthentication method: token, certificate, or username
auth.tokenstringMQTT access token (used with token method)
auth.usernamestringMQTT username (used with username method)
auth.passwordstringMQTT password (used with username method)

bridge

Maps ROS 2 topics to MQTT and vice versa. The bridge automatically prefixes all MQTT topics with rosfit/{device_id}/.

publish (ROS 2 → MQTT)

Each entry maps a local ROS 2 topic to an MQTT suffix.

FieldTypeRequiredDescription
ros_topicstringyesROS 2 topic to subscribe to
mqtt_suffixstringyesMQTT topic suffix (prepended with rosfit/{device_id}/)
msg_typestringyesROS 2 message type (e.g. sensor_msgs/LaserScan)
qosintegernoMQTT QoS level: 0, 1, or 2 (default 1)
throttle_hznumbernoMaximum publish rate in Hz (default unlimited)

subscribe (MQTT → ROS 2)

Each entry maps an MQTT suffix to a local ROS 2 topic.

FieldTypeRequiredDescription
mqtt_suffixstringyesMQTT topic suffix to subscribe to
ros_topicstringyesROS 2 topic to publish on
msg_typestringyesROS 2 message type
qosintegernoMQTT QoS level (default 1)

services (ROS 2 service ↔ MQTT request/response)

Bridge ROS 2 services over MQTT using a request/response pattern.

FieldTypeRequiredDescription
ros_servicestringyesROS 2 service name
mqtt_requeststringyesMQTT suffix for the request topic
mqtt_responsestringyesMQTT suffix for the response topic
srv_typestringyesROS 2 service type
timeout_secnumbernoService call timeout (default 10)

shadow

Configures the AWS IoT-style device shadow behavior.

FieldTypeDefaultDescription
enabledbooleantrueEnable shadow state reporting
report_on_changebooleantrueReport immediately when a watched parameter changes
report_interval_secnumber30Periodic reporting interval in seconds
watched_paramsarray[]List of parameter names to include in the reported shadow state

The bridge publishes shadow updates to rosfit/{device_id}/shadow/reported and listens for desired state changes on rosfit/{device_id}/shadow/desired.

ota

Configures over-the-air firmware update behavior.

FieldTypeDefaultDescription
enabledbooleantrueEnable OTA update support
download_dirstring/tmp/rosfit/otaDirectory for downloaded firmware files
scripts.pre_updatestringScript to run before applying the update
scripts.installstringScript to run to apply the firmware
scripts.post_updatestringScript to run after successful update
scripts.rollbackstringScript to run on rollback
auto_rollbackbooleantrueAutomatically roll back if the post-update health check fails
max_download_retriesnumber3Number of download retry attempts
verify_checksumbooleantrueVerify firmware SHA256 checksum

logging

FieldTypeDefaultDescription
levelstringinfoMinimum log level (debug, info, warn, error)
filestringPath to log file (logs to stdout if omitted)
max_size_mbnumber50Maximum log file size before rotation
rotate_countnumber5Number of rotated log files to keep