Closed kappa95 closed 3 years ago
Hello @kappa95, I have replicated the issue and it is related to connection timing.
The function rclc_support_init
tries to connect with the agent with a timeout of 10 seconds, if the agent is not reachable in that time the scripts fails, not even reaching the LED activation. You can check this with the return value of the function, which returns false (RCL_RET_OK)
on a successful connection.
I have modified the example to solve this problem (PR #29), now it will wait for a reachable agent for up to 2 minutes using the function rmw_uros_ping_agent
. This should give enough time to start the agent and establish the connection.
Please give it a try and let us know the results
Hello @kappa95, I have replicated the issue and it is related to connection timing.
The function
rclc_support_init
tries to connect with the agent with a timeout of 10 seconds, if the agent is not reachable in that time the scripts fails, not even reaching the LED activation. You can check this with the return value of the function, which returns false(RCL_RET_OK)
on a successful connection.I have modified the example to solve this problem (PR #29), now it will wait for a reachable agent for up to 2 minutes using the function
rmw_uros_ping_agent
. This should give enough time to start the agent and establish the connection.Please give it a try and let us know the results
I have pulled the repo, I have seen the changes in the code. But I get the same issue:
$ ros2 node list
//
May i have missed some passes or package install? Is it correct to install micro-ros-agent
from snap or i need some particular version compatible with ROS Dashing or i need some specific dds/rmw implementation?
Update 2:
I tried also to use:
micro-ros-agent serial -m rtps --dev /dev/ttyACM0 baudrate=115200
with: RMW_IMPLEMENTATION=rmw_fastrtps_cpp ros2 node list
I changed also in the code: rclc_node_init_default(&node, "pico_node", "/", &support);
but nothing is changed.
Could you please try with the dockerized foxy agent?
docker run -it -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6
Could you please try with the dockerized foxy agent?
docker run -it -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6
Same results:
docker run -it -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6
[1619164483.342955] info | TermiosAgentLinux.cpp | init | running... | fd: 4
[1619164483.343359] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
Second terminal:
ros2 node list
//
Both terminal are sourced with ROS Dashing:
source /opt/ros/dashing/setup.bash
Could you check the serial port output without the agent, using miniterm or similar?
Disconnect and reconnect the board, then for the first 2 minutes there should appear a periodic message each second, like this:
sudo miniterm /dev/ttyACM0 115200
--- Miniterm on /dev/ttyACM0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
If nothing appears, check that your raspberry pico is actually on the /dev/ttyACM0 port, by disconnecting it and checking that it is not on the /dev/tty list using ls /dev/ttyACM*
.
Could you check the serial port output without the agent, using miniterm or similar?
Disconnect and reconnect the board, then for the first 2 minutes there should appear a periodic message each second, like this:
sudo miniterm /dev/ttyACM0 115200 --- Miniterm on /dev/ttyACM0 115200,8,N,1 --- --- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- ~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀ ��␂␀␀␀�␒~␀␀␐␀�␀␀␀␂␀␀
If nothing appears, check that your raspberry pico is actually on the /dev/ttyACM0 port, by disconnecting it and checking that it is not on the /dev/tty list using
ls /dev/ttyACM*
.
With miniterm, nothing appear: no messages. And the only device is the raspberry:
ls /dev/ttyACM*
/dev/ttyACM0
I tried the hello world program from the raspberry site and using minicom the serial connection worked on this port
After some investigation, the problem relies on the arm-none-eabi-gcc installed version: Ubuntu 18.04 uses 6.3.1, while the micro-ros library is compiled using 9.2.1. To check your actual version: arm-none-eabi-gcc --version
This commands will download a compatible version from source and set the cmake compiler path.
wget --directory-prefix=$HOME https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
tar -xvf $HOME/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -C $HOME
echo "export PICO_TOOLCHAIN_PATH=$HOME/gcc-arm-none-eabi-9-2020-q2-update" >> ~/.bashrc
source ~/.bashrc
Anyway, check the version output on the cmake command is at least 9.x.x:
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 9.3.1
-- The CXX compiler identification is GNU 9.3.1
-- The ASM compiler identification is GNU
After some investigation, the problem relies on the arm-none-eabi-gcc installed version: Ubuntu 18.04 uses 6.3.1, while the micro-ros library is compiled using 9.2.1. To check your actual version:
arm-none-eabi-gcc --version
This commands will download a compatible version from source and set the cmake compiler path.
wget --directory-prefix=$HOME https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 tar -xvf $HOME/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -C $HOME echo "export PICO_TOOLCHAIN_PATH=$HOME/gcc-arm-none-eabi-9-2020-q2-update" >> ~/.bashrc source ~/.bashrc
Anyway, check the version output on the cmake command is at least 9.x.x:
-- Defaulting build type to 'Release' since not specified. PICO compiler is pico_arm_gcc PICO_GCC_TRIPLE defaulted to arm-none-eabi -- The C compiler identification is GNU 9.3.1 -- The CXX compiler identification is GNU 9.3.1 -- The ASM compiler identification is GNU
Thank you so much! Something now is changed:
docker run -it -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6
[1619178075.701850] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1619178075.702175] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[1619178075.714481] info | Root.cpp | create_client | create | client_key: 0x2B5411CA, session_id: 0x81
[1619178075.714548] info | SessionManager.hpp | establish_session | session established | client_key: 0x726929866, address: 0
[1619178075.714607] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x2B5411CA, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1619178075.717420] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x2B5411CA, len: 24, data:
0000: 80 00 00 00 00 01 10 00 58 52 43 45 01 00 01 0F 2B 54 11 CA 81 00 FC 01
[1619178075.717486] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x726929866, address: 0
[1619178075.717542] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x2B5411CA, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1619178075.719486] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x2B5411CA, len: 24, data:
0000: 80 00 00 00 00 01 10 00 58 52 43 45 01 00 01 0F 2B 54 11 CA 81 00 FC 01
[1619178075.719580] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x726929866, address: 0
[1619178075.719652] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x2B5411CA, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1619178075.824008] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x2B5411CA, len: 24, data:
0000: 80 00 00 00 00 01 10 00 58 52 43 45 01 00 01 0F 2B 54 11 CA 81 00 FC 01
[1619178075.824408] info | SessionManager.hpp | establish_session | session re-established | client_key: 0x726929866, address: 0
[1619178075.824503] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x2B5411CA, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
The Led on the Raspberry now is on But still:
ros2 node list
//
Another note: It seems that using:
micro-ros-agent serial --dev /dev/ttyACM0 baudrate=115200 -v6
is not working because it stays:
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
[1619179129.875510] info | TermiosAgentLinux.cpp | init | running... | fd: 4
[1619179129.876131] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
UPDATE: :smiley: :star_struck: Now it is working, I recompiled again after a clean of the build and now it is working. Still I don't understand why there is still // in node list:
ros2 node list
//
/pico_node
In any case is working only with:
docker run -it -v /dev:/dev --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6
I tried also the one with: ...micro-ros-agent:dashing serial ...
but that is not working.
But now is working! :star_struck:
Thank you so much
Thank you for the feedback!
I uses Ubuntu 20.04 and ros2 foxy. Is it possible to run the example code correctly?
I am trying to executing the example:
pico_micro_ros_example.c
following this guide The building seems ok: it returns from visual studio code this:I generate the uf2 file and I have uploaded it as in the guide. I have followed all the next steps of the guide and after:
micro-ros-agent serial --dev /dev/ttyACM0 baudrate=115200
I get:
The raspberry pico doesn't blink and I don't find the topics and nodes. i.e. :
I am using ROS2 Dashing with Ubuntu 18.04.5 LTS.
Update: I don't know if it could be useful for solving the issue, but I checked the return value from
rmw_uros_set_custom_transport()
function using a simple if condition for blinking the led if the return value is false. And it shows that it is false.