Ask Your Question
0

micro-ROS not publishing or subscribing to topics

asked 2021-09-12 04:16:01 -0500

mintybim gravatar image

updated 2021-09-18 05:08:36 -0500

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
edit retag flag offensive close merge delete

Comments

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

kak13 gravatar image kak13  ( 2021-09-13 14:05:02 -0500 )edit

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 did export ROS_DOMAIN_ID=0 followed by ros2 topic list. Now it works, thanks!

mintybim gravatar image mintybim  ( 2021-09-18 05:13:37 -0500 )edit

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

kak13 gravatar image kak13  ( 2021-09-18 12:12:04 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-09-18 12:16:19 -0500

kak13 gravatar image

Yep! Been there! ROS DOMAIN ID is the issue.

Here is what you should do. Type export ROS_DOMAIN_ID=0 in all terminals where.

For anyone in future who aren't familiar with this, ROS_DOMAIN_ID allows you to communicate with other same ID. If you have a different ID, they will not able to detect each other. Turtlebot3 set your ros domain id to 30 in .bashrc and by default, you will have id 1. It's highly encouraged to set it so you can communicate with other ros2 (such as in a different terminal)

edit flag offensive delete link more
0

answered 2021-09-13 00:33:07 -0500

Pablogs gravatar image

Could you paste here the output of the agent with the flag -v6?

Also if you don't mind for those kinds of problems we prefer to use Github Issues.

edit flag offensive delete link more

Comments

Sorry, next time I'll make a Github issue. Anyway, I edited the original post to append the output with verbosity level 6.

mintybim gravatar image mintybim  ( 2021-09-18 05:10:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2021-09-12 04:16:01 -0500

Seen: 41 times

Last updated: Sep 18