micro-ROS not publishing or subscribing to topics
I'm following these guides here:
https://github.com/micro-ros/micro_ros_setup
https://micro.ros.org/docs/tutorials/core/first_application_rtos/freertos/
Host:
Ubuntu 20.04
ROS2 Foxy
Board:
STM32 Nucleo-144 F767ZI
Firmware created with:
ros2 run micro_ros_setup create_firmware_ws.sh freertos nucleo_f767zi
Firmware configured with:
ros2 run micro_ros_setup configure_firmware.sh ping_pong --transport serial
micro-ROS agent is run with:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-STMicroelectronics_STM32_STLink_0672FF3530384E5043161319-if02
Note: The board is connected via microUSB (Board) to USB (Host) and the --dev flag allows for hitting the TAB key on the keyboard, which already suggests the correct serial port to the STM32_STLink.
[1631436844.462724] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1631436844.463369] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
[1631436846.283707] info | Root.cpp | create_client | create | client_key: 0x1247AB10, session_id: 0x81
[1631436846.318823] info | SessionManager.hpp | establish_session | session established | client_key: 0x1247AB10, address: 0
[1631436850.012475] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631436858.425578] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
Note: a few minutes pass between the previous and the next line.
[1631437271.578840] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631437275.106846] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631437337.350620] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631437361.529819] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631437403.083854] info | Root.cpp | delete_client | delete | client_key: 0x1247AB10
[1631437403.083934] info | SessionManager.hpp | destroy_session | session closed | client_key: 0x1247AB10, address: 0
Since this is the ping_pong example, ros2 should be able to echo the /ping topic while the connection is open:
ros2 topic echo /microROS/ping
However, this command results in:
WARNING: topic [/microROS/ping] does not appear to be published yet
Could not determine the type for the passed topic
Edit: increased verbosity level to 6
$ ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-STMicroelectronics_STM32_STLink_0672FF3530384E5043161319-if02 -v6
[1631959197.450823] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1631959197.451169] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[1631959201.133528] info | Root.cpp | create_client | create | client_key: 0x1247AB10, session_id: 0x81
[1631959201.133756] info | SessionManager.hpp | establish_session | session established | client_key: 0x1247AB10, address: 0
[1631959201.134067] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x1247AB10, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1631959209.370283] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x1247AB10, len: 24, data:
0000: 80 00 00 00 00 01 10 00 58 52 43 45 01 00 01 0F 12 47 AB 10 81 00 FC 01
[1631959209.370532] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x1247AB10, address: 0
[1631959209.370753] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x1247AB10, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
Can you confirm if it's set in the same ROS DOMAIN ID? I had similar issue as that another day. Also if you happen to make a new post in github issue, please share it here so I can join the conversation
After restarting the host and the board, I started it with
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-STMicroelectronics_STM32_STLink_0672FF3530384E5043161319-if02 -v6 ROS_DOMAIN_ID=0
and only then I plugged in the board. In another terminal window i didexport ROS_DOMAIN_ID=0
followed byros2 topic list
. Now it works, thanks!So it was the ROS Domain ID after all! Could you mark it as check once I post an answer? So others in future can find the answer for their own problem too