micro-ROS / micro-ROS-Agent

ROS 2 package using Micro XRCE-DDS Agent.
Apache License 2.0
97 stars 51 forks source link

micro-ROS-Agent on ARM32v7 (Odroid XU4) #221

Open elgarbe opened 4 months ago

elgarbe commented 4 months ago

Hi, I need to use micro-ros-agent on docker on an ARM32v7. I build a docker image with ros2 humble from source, using it as base image, do I need to just follow the steps for build micro-ros-agent? (https://micro.ros.org/docs/tutorials/core/first_application_linux/) in a new dockerfile? don't you provide such an image, right?

pablogs9 commented 4 months ago

No we don't, the approach shall be to build the agent in the required platform

elgarbe commented 4 months ago

Ok, I managed to make an image with micro-ros-agent. It doesn't work as expected. I mean, it works but once connected to my custom board (stm32f777) I get this:

[1709577566.071391] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1709577566.073126] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 6
[1709577566.123838] info     | Root.cpp           | create_client            | create                 | client_key: 0x7A6BA362, session_id: 0x81
[1709577566.123967] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x7A6BA362, address: 0
[1709577566.124302] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 19, data: 
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1709577566.224730] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.225230] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.325752] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.326372] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.427721] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.428263] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.528770] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.529350] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.630760] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.631252] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.731791] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.732286] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.832684] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.833386] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577566.934704] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577566.935216] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577567.035780] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577567.036370] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577583.918916] info     | TermiosAgentLinux.cpp | fini                     | server stopped         | fd: 3
[1709577583.948241] error    | TermiosAgentLinux.cpp | init                     | open device error      | device: /dev/ttyACM0, errno: 6
[1709577583.969849] error    | TermiosAgentLinux.cpp | init                     | open device error      | device: /dev/ttyACM0, errno: 6
[1709577584.483926] error    | TermiosAgentLinux.cpp | init                     | open device error      | device: /dev/ttyACM0, errno: 6
[1709577584.986706] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1709577585.487454] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1709577585.487834] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1709577585.488052] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1709577585.488327] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1709577585.488689] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 36, data: 
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1709577585.488827] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 16, data: 
0000: 80 00 00 00 02 01 08 00 00 0A FF FD 02 00 00 00
[1709577585.489187] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 36, data: 
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1709577585.489611] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 36, data: 
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1709577585.490027] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x7A6BA362, len: 36, data: 
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1709577585.490249] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x7A6BA362, len: 24, data: 
0000: 80 00 00 00 00 01 10 00 58 52 43 45 01 00 01 0F 68 7E 95 F7 81 00 FC 01
[1709577585.490859] info     | Root.cpp           | delete_client            | delete                 | client_key: 0x7A6BA362
[1709577585.491354] info     | SessionManager.hpp | destroy_session          | session closed         | client_key: 0x7A6BA362, address: 0
[1709577585.491566] info     | Root.cpp           | create_client            | create                 | client_key: 0x687E95F7, session_id: 0x81
[1709577585.491763] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x687E95F7, address: 0
[1709577585.493070] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 36, data: 
0000: 80 00 00 00 06 01 1C 00 00 0A FF FD 00 01 01 0D 58 52 43 45 01 00 01 0F 00 01 0D 00 01 00 00 00
0020: 00 00 00 00
[1709577585.493347] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 19, data: 
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1709577585.594292] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577585.594636] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577585.695384] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577585.695920] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577585.796389] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577585.796928] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577585.897369] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577585.898054] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577585.999428] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577585.999958] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577586.100380] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577586.100972] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577586.202297] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577586.203101] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577586.304295] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577586.304921] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
[1709577586.405261] debug    | SerialAgentLinux.cpp | recv_message             | [==>> SER <<==]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0B 01 05 00 00 00 00 00 80
[1709577586.405856] debug    | SerialAgentLinux.cpp | send_message             | [** <<SER>> **]        | client_key: 0x687E95F7, len: 13, data: 
0000: 81 00 00 00 0A 01 05 00 00 00 00 01 80
^C[ros2run]: Interrupt

On 1709577585.490859 I reset my board and then the connection is established again. In my board some object fail when I try to create them. Is there an easy way to debug the problem with this messages? BTW: In my embedded system I create a node two topics and two publishers.

elgarbe commented 4 months ago

The problem is trying to create the node. I'm debuging my firmware, but some times the node is created and then micro-ros-agent gives: imagen

I'm not sure what am I missing...

elgarbe commented 4 months ago

Ok, I isolate the problem. I moved from USB to UART in order to simplify communications. I moved from my source build in docker on Odroid XU4 to official docker image on my laptop. I use humble version of microros/micro_ros_static_library_builder in my embedded system. So I was trying with humble docker image getting "Not enough memory error" then I've tried with iron version and everything works just fine:

image

whats the difference between humble and iron docker image?

pablogs9 commented 4 months ago

You need to have the same ROS 2 distro in all parts of your system. Humble and Iron may not be intercompatible.

elgarbe commented 4 months ago

That's right, but I have used humble for the static library and humble for the agent and it doesn't work. Then changed to iron agent and it started working.

pablogs9 commented 4 months ago

Is there any Iron node in your ROS 2 dataspace while you are running micro-ROS Humble?

elgarbe commented 4 months ago

Is there any Iron node in your ROS 2 dataspace while you are running micro-ROS Humble?

No, I just trying to get micros-ros working right now.

pablogs9 commented 4 months ago

So in that case, I need a replicator to have the same error on my local setup.

elgarbe commented 4 months ago

I have a custom board based on stm32f777. I'm not sure how you can replicate it. If humble library with humble agent are working ok then I will try to find the problem here. I can try starting with an empty system installing just humble.

BTW USB transport define a 2048 buffer size. I have to increase to 4096 in order to get it working. I was having issue on the node creation function, after that change using USB is working just fine.