Description
Hello,
I have tested this repo with primitive types and everything works as expected.
I can't get it to work with non primitive type, however.
Test 1 - ROS2 to MQTT
Terminal 1: ros2 launch mqtt_client standalone.launch.ros2.xml
[mqtt_client-1] [INFO] [1722803980.839742950] [mqtt_client]: Connected to broker at 'tcp://localhost:1883' [mqtt_client-1] [INFO] [1722803980.839865437] [mqtt_client]: Subscribed MQTT topic 'mqtt_client/ros_msg_type/pingpong/ros' [mqtt_client-1] [INFO] [1722804034.407838293] [mqtt_client]: Subscribed ROS topic '/ping/ros' of type 'sensor_msgs/msg/Temperature'
Terminal 2:
>> ros2 topic pub /ping/ros sensor_msgs/msg/Temperature "{temperature: 100.5}" --once
publisher: beginning loop publishing #1: sensor_msgs.msg.Temperature(header=std_msgs.msg.Header(stamp=builtin_interfaces.msg.Time(sec=0, nanosec=0), frame_id=''), temperature=100.5, variance=0.0)
Terminal 3:
>> mosquitto_sub -h localhost -t "pingpong/ros"
Y@
Maybe an encoding issue?
Test 2 - MQTT to ROS
Terminal 1: same
Terminal 2:
>> ros2 topic echo /pong/ros
1722804779.802696 [0] recvUC: malformed packet received from vendor 1.16 state parse:HEARTBEAT <52545053 02010110 1af91001 f3542884 37bb9341 0e010c00 01100b74 60cc4736 @0x50 07011c00 00000804 00001b03 00000000 07000000 00000000 07000000 2e000000> (note: maybe partially bswap'd) smid 0x7 flags 0x1 otnh 28 rid 0x4080000 wid 0x31b0000 first 7 last 7
Terminal 3:
>> mosquitto_pub -h localhost -t "pingpong/ros" -m 100.5
I actually have no idea how to format the MQTT publisher message?
This is most likely user error but I'm not sure how to make this work.
Thank you in advance for any help.