Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS_LOCALHOST_ONLY usage #105

Open
dhood opened this issue Feb 28, 2024 · 1 comment
Open

ROS_LOCALHOST_ONLY usage #105

dhood opened this issue Feb 28, 2024 · 1 comment

Comments

@dhood
Copy link

dhood commented Feb 28, 2024

Hello maintainers, thanks for your work. I've seen that ROS_LOCALHOST_ONLY support has been added in https://github.com/micro-ROS/docker/pull/69/files, (which I believe supersedes the approach suggested in micro-ROS/micro-ROS-Agent#49 ), but what I'm observing instead that it's blocking comms. Is any extra config needed?

Context: I have a number of robots each with "desktop nodes" and a teensy connected via microros. The microros agent uses serial comms. I want to use ROS_LOCALHOST_ONLY on the desktop nodes so that the robots don't discover each other. However when I enable it on the desktop nodes, I lose connection to the microros node. (This is not surprising since I lose access to any desktop nodes not using ROS_LOCALHOST_ONLY).

I was hoping that setting ROS_LOCALHOST_ONLY in the docker launch of the micro-ros agent would allow comms again, but no such luck. How can I integrate the microros agent into a ROS graph that's using ROS_LOCALHOST_ONLY?

  • Hardware description: teensy, using serial
  • Installation type: from docker image
  • Version or commit hash: humble

Steps to reproduce the issue

Standard microros agent with ROS_LOCALHOST_ONLY=0...

ronnie@walle:~/vxwave$ ./src/microros_agent_launch.sh 
Teensyduino device found: /dev/ttyACM0
Programming teensy was successful!
+ docker run -it --net=host --device=/dev/ttyACM0 --env ROS_LOCALHOST_ONLY=0 --env RMW_IMPLEMENTATION=rmw_fastrtps_cpp microros/micro-ros-agent:humble serial --dev /dev/ttyACM0
[1709109036.360346] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1709109036.360494] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
[1709109037.452976] info     | Root.cpp           | create_client            | create                 | client_key: 0x7E4CAEE3, session_id: 0x81
[1709109037.453044] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x7E4CAEE3, address: 0
[1709109037.460367] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0x7E4CAEE3, participant_id: 0x000(1)
[1709109037.460639] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x7E4CAEE3, topic_id: 0x000(2), participant_id: 0x000(1)
[1709109037.460812] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x7E4CAEE3, subscriber_id: 0x000(4), participant_id: 0x000(1)
[1709109037.461117] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x7E4CAEE3, datareader_id: 0x000(6), subscriber_id: 0x000(4)
[1709109037.461369] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x7E4CAEE3, topic_id: 0x001(2), participant_id: 0x000(1)

... connects only to desktop nodes that are also using ROS_LOCALHOST_ONLY=0:

ronnie@walle:~/vxwave$ export ROS_LOCALHOST_ONLY=0
ronnie@walle:~/vxwave$ ros2 topic echo /hardware/motor_current_pos_steps
header:
  stamp:
    sec: 1709109128
    nanosec: 96169930
  frame_id: ''
pose:
  position:
    x: 0.0
    y: 0.0
    z: 0.0
  orientation:
    x: 0.0
    y: 0.0
    z: 0.0
    w: 0.0
---

... and does not connect to, but can still be discovered by, desktop nodes with ROS_LOCALHOST_ONLY=1:

ronnie@walle:~/vxwave$ export ROS_LOCALHOST_ONLY=1
ronnie@walle:~/vxwave$ ros2 topic echo /hardware/motor_current_pos_steps
ronnie@walle:~/vxwave$ ros2 topic list
/hardware/hardware_error_status
/hardware/motor_current_pos_steps
/eef_pose
/parameter_events
/rosout

Microros agent with ROS_LOCALHOST_ONLY=1:


ronnie@walle:~/vxwave$ ./src/microros_agent_launch.sh 
Teensyduino device found: /dev/ttyACM0
error writing to Teensy

Programming teensy failed, trying again...
Programming teensy was successful!
+ docker run -it --net=host --device=/dev/ttyACM0 --env ROS_LOCALHOST_ONLY=1 --env RMW_IMPLEMENTATION=rmw_fastrtps_cpp microros/micro-ros-agent:humble serial --dev /dev/ttyACM0
[1709108701.442692] info     | TermiosAgentLinux.cpp | init                     | running...             | fd: 3
[1709108701.442869] info     | Root.cpp           | set_verbose_level        | logger setup           | verbose_level: 4
[1709108702.568359] info     | Root.cpp           | create_client            | create                 | client_key: 0x7E4CAEE3, session_id: 0x81
[1709108702.568495] info     | SessionManager.hpp | establish_session        | session established    | client_key: 0x7E4CAEE3, address: 0
[1709108702.583510] info     | ProxyClient.cpp    | create_participant       | participant created    | client_key: 0x7E4CAEE3, participant_id: 0x000(1)
[1709108702.584156] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x7E4CAEE3, topic_id: 0x000(2), participant_id: 0x000(1)
[1709108702.584425] info     | ProxyClient.cpp    | create_subscriber        | subscriber created     | client_key: 0x7E4CAEE3, subscriber_id: 0x000(4), participant_id: 0x000(1)
[1709108702.584992] info     | ProxyClient.cpp    | create_datareader        | datareader created     | client_key: 0x7E4CAEE3, datareader_id: 0x000(6), subscriber_id: 0x000(4)
[1709108702.585523] info     | ProxyClient.cpp    | create_topic             | topic created          | client_key: 0x7E4CAEE3, topic_id: 0x001(2), participant_id: 0x000(1)

can neither talk to or be discovered by desktop nodes with or without ROS_LOCALHOST_ONLY (the nodes discovered are desktop nodes):

ronnie@walle:~/vxwave$ export ROS_LOCALHOST_ONLY=1
ronnie@walle:~/vxwave$ ros2 topic echo /hardware/motor_current_pos_steps
WARNING: topic [/hardware/motor_current_pos_steps] does not appear to be published yet
Could not determine the type for the passed topic
ronnie@walle:~/vxwave$ export ROS_LOCALHOST_ONLY=1
ronnie@walle:~/vxwave$ ros2 topic list
/eef_pose
/parameter_events
/rosout
ronnie@walle:~/vxwave$ export ROS_LOCALHOST_ONLY=0
ronnie@walle:~/vxwave$ ros2 topic echo /hardware/motor_current_pos_steps
WARNING: topic [/hardware/motor_current_pos_steps] does not appear to be published yet
Could not determine the type for the passed topic
ronnie@walle:~/vxwave$ ros2 topic list
/eef_pose
/parameter_events
/rosout

Expected behavior

Setting ROS_LOCALHOST_ONLY=1 env var on docker launch lets the microros agent talk with the rest of the rosgraph using ROS_LOCALHOST_ONLY

Actual behavior

Setting ROS_LOCALHOST_ONLY=1 env var on docker launch prevents both discovery and comms.

Additional information

Highlighting that we are using serial comms to the micro in case it's relevant.

also network info from inside docker run -it --net=host --env RMW_IMPLEMENTATION=rmw_fastrtps_cpp --entrypoint /bin/bash microros/micro-ros-agent:humble docker container:

root@dhood-t14:/uros_ws# ip addr show 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 9c:2d:cd:7b:fd:0d brd ff:ff:ff:ff:ff:ff
3: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 3c:21:9c:2a:d1:ef brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.70/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3
       valid_lft 3421sec preferred_lft 3421sec
    inet6 2001:818:e24a:3300:d2e7:3b51:1052:e3bb/64 scope global temporary dynamic 
       valid_lft 86401sec preferred_lft 43201sec
    inet6 2001:818:e24a:3300:5b57:74f2:c69:1bb7/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 86401sec preferred_lft 43201sec
    inet6 fe80::269b:2407:48a6:db5d/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:dc:63:a5:38 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
...
@willSapgreen
Copy link

Hello @dhood ,
I have the similar issue and wonder if you have any work-around method?

My case:
A flight controller is connected to a Jetson board through GPIO ( ttyTHS0 )
When ROS_LOCALHOST_ONLY=0,
fmu topics are able to be discovered ( through ros2 topic list ).
When ROS_LOCALHOST_ONLY=1,
fmu topics are not able to be discovered.

Thank you for your precious time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants