micro-ROS / micro-ROS-Agent

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

Snap not connecting, Docker works though. #130

Closed madgrizzle closed 2 years ago

madgrizzle commented 2 years ago

Issue template

Steps to reproduce the issue

1) build and upload uf2 from micro_ros_raspberrypi_pico_sdk to pico. 2) install micro-ros-agent snap following directions 2) execute: micro-ros-agent serial --dev /dev/ttyACM0 baudrate=115200 -v6

Expected behavior

pico connects to micro-ros-agent

Actual behavior

pico hangs on rmw_uros_ping_agent and times-out

Additional information

I can get a connection using docker sudo docker run -it --rm --net=host -v /dev:/dev -v /dev/shm:/dev/shm --privileged microros/micro-ros-agent:galactic serial --dev /dev/ttyACM0 -v6

but when I run the snap, it sits hanging when the pico reaches the ping and eventually times out.

Is docker the only solution for galactic? If so, how do I change the ROS_DOMAIN_ID of the docker as it seems to run on 0 by default. I tried -e ROS_DOMAIN_ID=1 (which is what I use) and it didn't work.

Acuadros95 commented 2 years ago

Hi @madgrizzle, There are known issues with snap serial port connections, so the dockerized Agent is the way to go.

Is docker the only solution for galactic? If so, how do I change the ROS_DOMAIN_ID of the docker as it seems to run on 0 by default. I tried -e ROS_DOMAIN_ID=1 (which is what I use) and it didn't work.

This is configured on the client code, you can use multiple clients in different domain ids within the same agent. Check this example link or this tutorial link

madgrizzle commented 2 years ago

Thanks. So the problem is isolated to the snap and building from source doesn't experience the same problem?

Also thanks for the info on the domain. This is my first foray into ROS2.

Acuadros95 commented 2 years ago

So the problem is isolated to the snap and building from source doesn't experience the same problem?

Exactly, have fun!

madgrizzle commented 2 years ago

Thanks.. Why does the README say there's issues with using docker and not snap?

Acuadros95 commented 2 years ago

There is an unknown issue when dealing with serial ports shared with the micro-ROS agent running inside a Docker. Sometimes it works with a remarkable packet loss.

Note that it says shared serial ports. Avoid opening the used serial port with other programs such as minicom, as it will end with missing data on the Agent side.

But yes, I am going to add the snap issue.

Acuadros95 commented 2 years ago

Done https://github.com/micro-ROS/micro-ROS-Agent/pull/131, thanks for the catch!