micro-ROS / micro-ROS-Agent

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

Deserialization error #191

Closed slim71 closed 1 year ago

slim71 commented 1 year ago

Issue template

Steps to reproduce the issue

I'm just following the steps linked here, which for micro_ros_agent come up to:

# Source the ROS 2 installation
source /opt/ros/$ROS_DISTRO/setup.bash

# Create a workspace and download the micro-ROS tools
mkdir microros_ws
cd microros_ws
git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup

# Update dependencies using rosdep
sudo apt update && rosdep update
rosdep install --from-paths src --ignore-src -y

# Install pip
sudo apt-get install python3-pip

# Build micro-ROS tools and source them
colcon build
source install/local_setup.bash

# Download micro-ROS-Agent packages
ros2 run micro_ros_setup create_agent_ws.sh

# Build step
ros2 run micro_ros_setup build_agent.sh
source install/local_setup.bash

# Run agent with UDP method
ros2 run micro_ros_agent micro_ros_agent udp4 -p 2019 -r dds_xrce_profile.xml
# OR
# Run agent with Serial method (actual /dev/pts/x comes from `socat -d -d pty,raw,echo=0 pty,raw,echo=0`
ros2 run micro_ros_agent micro_ros_agent serial -b 115200  -r dds_xrce_profile.xml -D /dev/pts/2

Expected behavior

I should be able to see nodes with ros2 node list, and then inspect and interact with them.

Actual behavior

I get a deserialization error, constantly. No nodes are listed at all when using ros2 node list.

If useful, output from socat:

slim71@slim71-Ubuntu:~/Documents/git/ardupilot/libraries/AP_DDS$ socat -d -d pty,raw,echo=0 pty,raw,echo=0
2023/06/02 11:08:01 socat[12853] N PTY is /dev/pts/3
2023/06/02 11:08:01 socat[12853] N PTY is /dev/pts/4
2023/06/02 11:08:01 socat[12853] N starting data transfer loop with FDs [5,5] and [7,7]

Output from the micro_ros_agent:

slim71@slim71-Ubuntu:~/Documents/git/ardupilot/libraries/AP_DDS$ ros2 run micro_ros_agent micro_ros_agent serial -b 115200  -r dds_xrce_profile.xml -D /dev/pts/4
[1685697420.608133] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1685697420.608762] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
[1685697421.843167] info     | Root.cpp           | create_client            | create                 | client_key: 0xAAAABBBB, session_id: 0x81
[1685697421.843266] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0xAAAABBBB, address: 0
[1685697421.880301] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0xAAAABBBB, participant_id: 0x001(1)
[1685697421.886863] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x001(2), participant_id: 0x001(1)
[1685697421.886968] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x001(3), participant_id: 0x001(1)
[1685697421.887502] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x001(5), publisher_id: 0x001(3)
[1685697421.893612] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x002(2), participant_id: 0x001(1)
[1685697421.893697] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x002(3), participant_id: 0x001(1)
[1685697421.894192] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x002(5), publisher_id: 0x002(3)
[1685697421.901619] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x003(2), participant_id: 0x001(1)
[1685697421.901789] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x003(3), participant_id: 0x001(1)
[1685697421.902711] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x003(5), publisher_id: 0x003(3)
[1685697421.908066] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x004(2), participant_id: 0x001(1)
[1685697421.908235] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x004(3), participant_id: 0x001(1)
[1685697421.909205] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x004(5), publisher_id: 0x004(3)
[1685697421.910753] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x005(2), participant_id: 0x001(1)
[1685697421.910906] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x005(3), participant_id: 0x001(1)
[1685697421.911761] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x005(5), publisher_id: 0x005(3)
[1685697421.917585] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x006(2), participant_id: 0x001(1)
[1685697421.917797] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x006(3), participant_id: 0x001(1)
[1685697421.918687] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x006(5), publisher_id: 0x006(3)
[1685697421.925950] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x007(2), participant_id: 0x001(1)
[1685697421.926140] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x007(3), participant_id: 0x001(1)
[1685697421.927226] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x007(5), publisher_id: 0x007(3)
[1685697421.928447] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0xAAAABBBB, topic_id: 0x008(2), participant_id: 0x001(1)
[1685697421.928605] info     | ProxyClient.cpp    | create_publisher         | publisher created      | client_key: 0xAAAABBBB, publisher_id: 0x008(3), participant_id: 0x001(1)
[1685697421.929485] info     | ProxyClient.cpp    | create_datawriter        | datawriter created     | client_key: 0xAAAABBBB, datawriter_id: 0x008(5), publisher_id: 0x008(3)
[1685697430.999804] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 63 06 0D 01 34 00 7A 40 82 40 00 00 00 80 0C FA 49 BF 00 00 00 00 93 B3 0B BF 00 00 00 A0
0020: 32 F9 E7 3F 00 00 00 A0 32 32 E5 3F
[1685697470.215165] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 32 22 0D 01 34 00 7A 40 82 40 00 00 00 00 2A F6 4A BF 00 00 00 00 C1 97 0F BF 00 00 00 20
0020: 0A 18 E8 3F 00 00 00 20 1D 0F E5 3F
[1685697485.292305] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 27 2D 0D 01 34 00 7A 40 82 40 00 00 00 80 D9 2B 4B BF 00 00 00 00 D2 8E 0F BF 00 00 00 80
0020: 22 1F E8 3F 00 00 00 00 FC 06 E5 3F
[1685697522.465895] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 B5 47 0D 01 34 00 7A 40 82 40 00 00 00 40 B9 7A 4B BF 00 00 00 80 6E 60 11 BF 00 00 00 20
0020: ED 27 E8 3F 00 00 00 20 E2 FC E4 3F
[1685697535.518673] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 AE 50 0D 01 34 00 7A 40 82 40 00 00 00 60 08 F2 4A BF 00 00 00 00 18 7A 0B BF 00 00 00 E0
0020: CE 28 E8 3F 00 00 00 20 DE FB E4 3F
[1685697612.917536] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 69 87 0D 01 34 00 7A 40 82 40 00 00 00 80 91 C6 4A BF 00 00 00 00 F2 70 11 BF 00 00 00 E0
0020: D5 27 E8 3F 00 00 00 E0 FC FC E4 3F
[1685697680.248379] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 24 B7 0D 01 34 00 7A 40 82 40 00 00 00 C0 91 A1 15 BF 00 00 00 80 5A BB E6 BE 00 00 00 80
0020: DD 22 E8 3F 00 00 00 C0 B4 02 E5 3F
[1685697692.328997] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 ED BF 0D 01 34 00 7A 40 82 40 00 00 00 40 98 6F 3B 3F 00 00 00 80 D9 2C 00 3F 00 00 00 00
0020: E7 1A E8 3F 00 00 00 C0 D6 0B E5 3F
[1685697696.346461] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 AE C2 0D 01 34 00 7A 40 82 40 00 00 00 C0 C3 0F 41 3F 00 00 00 80 02 27 01 3F 00 00 00 A0
0020: 8E 17 E8 3F 00 00 00 E0 AA 0F E5 3F
[1685697714.422922] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 1B CF 0D 01 34 00 7A 40 82 40 00 00 00 00 95 C1 47 3F 00 00 00 00 2F CC 09 3F 00 00 00 A0
0020: 2E 06 E8 3F 00 00 00 60 7A 23 E5 3F
[1685697732.508682] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 49 DC 0D 01 34 00 7A 40 82 40 00 00 00 40 23 E7 49 3F 00 00 00 00 B8 44 0D 3F 00 00 00 E0
0020: D5 F3 E7 3F 00 00 00 E0 41 38 E5 3F
[1685697744.573233] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 7A E4 0D 01 34 00 7A 40 82 40 00 00 00 80 7B 54 4A 3F 00 00 00 00 60 1A 08 3F 00 00 00 20
0020: BD E8 E7 3F 00 00 00 E0 C1 44 E5 3F
[1685697754.621202] error    | InputMessage.cpp   | log_error                | deserialization error  | buffer: 
0000: 81 80 CF EB 0D 01 34 00 7A 40 82 40 00 00 00 40 2D B4 4A 3F 00 00 00 00 71 4B 07 3F 00 00 00 60
0020: A4 E0 E7 3F 00 00 00 60 D8 4D E5 3F

Additional information

I'm using micro_ros_agent together with Ardupilot in order to run some simulations. The ultimate goal is to be able to interact with nodes and topics in ROS2, since I'll have to build my project from that (with Ignition Gazebo).

Acuadros95 commented 1 year ago

The problem is most probably related to the XRCE Client side. Can you share your code for the micro-ROS app?

Also, does this error happen both using the UDP and serial mode?

slim71 commented 1 year ago

To be thorough:

I've actually managed to understand the core issue some hours ago. It was due to the ROS_DOMAIN_ID, which I had set before (through .bashrc). What helped me figure it out was this issue, which I hadn't seen before. I wish I did, since it was so simple... 😓