micro-ROS / micro_ros_mbed

micro-ROS mbed sample code
Apache License 2.0
18 stars 7 forks source link

Agent produces DDS error #9

Closed spartacoos closed 3 years ago

spartacoos commented 3 years ago

Agent produces DDS error + mbed board does not appear in node list

Steps to reproduce the issue

1.Install ROS2 on your system (Ubuntu 20.04) by following these steps.

  1. Install Mbed CLI2, the project dependencies and compile this example onto the board.
  2. Open a terminal, compile (using colcon) and run this Python listener which subscribes to "mbed_int32_publisher".
  3. Open another terminal, run the agent sudo ./MicroXRCEAgent serial --dev /dev/ttyACM0 -v6

Actual behavior

DDS error: Screenshot from 2021-05-21 11-59-17

Expected behavior

From the Portenta example By simply using the portenta instead and changing the topic name to "micro_ros_arduino_node_publisher" on the listener script we get the correct output on the top right terminal: Screenshot from 2021-05-21 15-24-00

Additional information

I tried with both the Micro-XRCE agent (as seen above) and with the micro-ros-agent used as seen here but with "snapd:st-linkv21" instead of "snapd:pico.

Acuadros95 commented 3 years ago

Hello @spartacoos, Which branch are you using for the Micro-XRCE agent?

The snap agent version needs to be updated to fix this problem, could you try with the dockerized version?

docker run -it --rm --net=host -v /dev:/dev -v /dev/shm:/dev/shm --privileged microros/micro-ros-agent:foxy serial --dev /dev/ttyACM0 -v6

spartacoos commented 3 years ago

Hi @Acuadros95, I just tried with your approach and this makes it so that on the agent side there are no dds errors. However, the listener still can't receive the messages. Oddly enough, If I run ros2 node list I get an empty output. If I run ros2 topic list I only get "

/parameter_events
/rosout

but if I try to publish to it by running ros2 topic pub /mbed_int32_publisher std_msgs/msg/Int32 "data: 1" this works and the listener publishes I heard "1". Any idea what the issue could be here? It seems to me like the listener and publisher are not being discovered.

spartacoos commented 3 years ago

Also, if I try to run ros2 topic pub /mbed_int32_publisher std_msgs/msg/Int32 "data: 1" while the agent is running this makes it so that the listener doesn't output anything. If I try when the agent is not running then it works.

Acuadros95 commented 3 years ago

I can't replicate that issue on my computer, looks like a communication problem with the dockerized agent.

You can also try to recompile the agent, making sure you are using the latest version and then running it like on your first post: sudo ./MicroXRCEAgent serial --dev /dev/ttyACM0 -v6

Just make sure you build the latest commit from the foxy branch.

spartacoos commented 3 years ago

Fantastic! Thank you @Acuadros95, that seems to have worked!