Robobot MQTT topics: Difference between revisions

From Rsewiki
Line 67: Line 67:


At times, the Teensy sends a comment or a debug message. Such messages are sent with the ''info'' topic. The data is always preceded with a ''#''.
At times, the Teensy sends a comment or a debug message. Such messages are sent with the ''info'' topic. The data is always preceded with a ''#''.
=== Command topics (to Teensy interface) ===
These topics start as:
* robobot/cmd/ti/
Examples are:
1738498850.8640 0 drive robobot/cmd/ti/log 1
1738498851.3836 0 drive robobot/cmd/ti/rc 0.0 0.0
1738498851.3969 0 drive robobot/cmd/ti/rc 0.250 -1.000 1738498851.3969011
1738498851.8492 0 drive robobot/cmd/ti/alive 2025-02-02 13:20:50.861066
1738498851.8627 0 drive robobot/cmd/ti/rc 0.250 0.119 1738498851.8626823
1738498852.2016 0 drive robobot/cmd/ti/alive 2025-02-02 13:20:50.861066
=== Master topic ===
One drive master is accepted only. To control that

Revision as of 10:04, 15 February 2025

Back to Robobot

MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight protocol that transports messages between processes and networks.

The used MQTT server is Mosquitto from https://mosquitto.org/

The interface library used in both the Teensy_interface and the MQTT_client is paho-mqtt: https://eclipse.dev/paho/files/paho.mqtt.python/html/index.html

Robobot

Robobot uses MQTT

The MQTT server connects the Teensy_interface with the behaviour part of the robot.

Data topics (from firmware)

Data messages mainly originate from the Teensy firmware, where data can be subscribed.

  • topic: robobot/#

All used topics start with the keyword robobot/. The # is a wildcard that matches all sub-topics.

  • topic: robobot/drive/T0/#

The sub-topic robobot/drive/ is used for all data messages sourced by the teensy_interface (data from the drive function and generated by the first (and only) Teensy T0).

Data messages

Data types described in Help page Teensy_8 generate messages starting with a keyword and some parameters. The keyword is used as subtopic, e.g.:

  • robobot/drive/T0/pose is a pose message

The parameters are then the MQTT message "payload", examples of a pose messages are:

  • robobot/drive/T0/pose 1738930269.8039 2232.5911 0.583 0.702 2.5420 3.1241

After the topic robobot/drive/T0/pose are the payload.

The payload is always pure text (7-bit ASCII), and the first data is always a timestamp in seconds (since 1 Jan 1970).

In this case, the remaining data are Teensy time (sec), x and y position, heading (radians), and tilt (radians).

Examples:

robobot/drive/T0/gyro2   1738930269.7980 -0.448853 0.816986 -4.012695 2232.585
robobot/drive/T0/vel     1738930269.7992 2232.5859 -0.003 -0.008 -0.0200 -0.003 3
robobot/drive/T0/pose    1738930269.7992 2232.5859 0.583 0.702 2.5420 3.1239
robobot/drive/T0/mvel    1738930269.7999 -0.003 -0.008
robobot/drive/T0/acc2    1738930269.8004 0.018066 -0.026367 0.984863 2232.587
robobot/drive/T0/current 1738930269.8004 0.000 0.000
robobot/drive/T0/dist    1738930269.8027 0.623 0.469
robobot/drive/T0/livn    1738930269.8061 203 195 193 202 197 200 209 217 195
robobot/drive/T0/vel     1738930269.8062 2232.5930 -0.003 -0.008 -0.0200 -0.003 4
robobot/drive/T0/mvel    1738930269.8073 -0.003 -0.008
robobot/drive/T0/pose    1738930269.8096 2232.5959 0.583 0.702 2.5420 3.1241
robobot/drive/T0/conf    1738499287.6484 0.0750 0.0750 19.000 68 0.2300 0.0020 0
robobot/drive/T0/gyro2   1738930269.8107 -0.815063 -1.807526 -4.348389 2232.597
robobot/drive/T0/info    1738918215.7251 # got confw: r1=0.075, r2=0.075, G=19, PPR=68, WB=0.23

Most parameters are numeric but could contain text like the last message.

At times, the Teensy sends a comment or a debug message. Such messages are sent with the info topic. The data is always preceded with a #.

Command topics (to Teensy interface)

These topics start as:

  • robobot/cmd/ti/

Examples are:

1738498850.8640 0 drive robobot/cmd/ti/log 1 1738498851.3836 0 drive robobot/cmd/ti/rc 0.0 0.0 1738498851.3969 0 drive robobot/cmd/ti/rc 0.250 -1.000 1738498851.3969011 1738498851.8492 0 drive robobot/cmd/ti/alive 2025-02-02 13:20:50.861066 1738498851.8627 0 drive robobot/cmd/ti/rc 0.250 0.119 1738498851.8626823 1738498852.2016 0 drive robobot/cmd/ti/alive 2025-02-02 13:20:50.861066

Master topic

One drive master is accepted only. To control that