Inconsistent output of “ros2 param list”

asked 2020-11-21 14:58:59 -0500

DrakeP gravatar image

updated 2021-03-23 00:26:20 -0500

I'm currently running ROS2 Foxy in a Docker container on WSL2. I'm going through the ROS2 tutorials so I have nodes /turtlesim and /teleop_turtle running. For some reason, the output of ros2 param list is inconsistent - one or both of the nodes are occasionally excluded from the output. Rebooting the Docker container doesn't help. ros2 doctor says a fair amount of UserWarnings but ultimately says All 4 checks passed. Running ros2 daemon status before testing ros2 param list (as recommended here) does not resolve the issue. What is causing this param list issue, and how can I resolve it?

Environment

  • OS: Windows 10 Home, version 10.0.19041 Build 19041
  • Processor: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s)
  • Docker version: 19.03.13, build 4484c46d9d (full version info at bottom of post)
  • Ubuntu version (WSL2): Ubuntu 20.04.1 LTS
  • ROS2: from docker container, see below

Steps to reproduce issue

Open three terminals.

In terminal 1:

docker pull osrf/ros:foxy-desktop
xhost +local:root > /dev/null 2>&1 
docker run -it -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw osrf/ros:foxy-desktop
# I'm now inside container
ros2 run turtlesim turtlesim_node # start turtlesim_node

In terminal 2:

docker exec -it <container> bash -c "source /opt/ros/foxy/setup.bash && bash"
# I'm now inside container
ros2 run turtlesim turtle_teleop_key # start turtle_teleop_key

In terminal 3:

docker exec -it <container> bash -c "source /opt/ros/foxy/setup.bash && bash"
# I'm now inside container
while true; do ros2 param list; echo "*** separator ***"; done

Sample output from terminal 3, showing that sometimes one or both of the nodes are excluded from ros2 param list:

/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***
/teleop_turtle:
  scale_angular
  scale_linear
  use_sim_time
/turtlesim:
  background_b
  background_g
  background_r
  use_sim_time
*** separator ***

The output of while true; do ros2 node list; ros2 topic list; ros2 service list; echo "*** separator ***"; done is consistent, however (i.e. every iteration shows the below without any info being erroneously excluded):

/teleop_turtle
/turtlesim
/parameter_events
/rosout
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
/clear
/kill
/reset
/spawn
/teleop_turtle/describe_parameters
/teleop_turtle/get_parameter_types
/teleop_turtle/get_parameters
/teleop_turtle/list_parameters
/teleop_turtle/set_parameters
/teleop_turtle/set_parameters_atomically
/turtle1/set_pen
/turtle1/teleport_absolute
/turtle1/teleport_relative
/turtlesim/describe_parameters
/turtlesim/get_parameter_types
/turtlesim/get_parameters
/turtlesim/list_parameters
/turtlesim/set_parameters
/turtlesim/set_parameters_atomically
*** separator ***

Additional information

Docker version:

Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:52 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit ...
(more)
edit retag flag offensive close merge delete

Comments

Could you specifically point out what you see as inconsistent? Few folks are going to scan through 100 lines of terminal output to eye-spy the issues with ros2 param. Also may want to ensure that bidirectional ROS connectivity is working if your using multiple containers and various virtual network interfaces.

ruffsl gravatar image ruffsl  ( 2020-11-24 15:05:42 -0500 )edit

@ruffsl thank you for your comment. The issue is fairly straightforward; ros2 param list sometimes excludes one or both of the 2 nodes running, and the terminal output demonstrates this. I've edited the post to make this more explicit. I am also using a single container and on one machine only, so I don't think your last point applies (correct me if I'm wrong).

DrakeP gravatar image DrakeP  ( 2020-11-24 19:07:57 -0500 )edit

Ah, that is odd. If you can reproduce this issue on a separate machine, you may want to report is as an issue under this repo: https://github.com/ros2/ros2cli . My guess is that the daemon for the ros2cli is not being started, so each time an ros2cli command is run, it has to rediscover other ros2 nodes, a process that is made more consistent with use of a persistent running daemon to cache discovery info over time. See here for more info: https://answers.ros.org/question/3273...

ruffsl gravatar image ruffsl  ( 2020-11-27 19:16:02 -0500 )edit

@ruffsl Thank you for the helpful link. It seems I still have the same issue, even after following the recommendation to call ros2 daemon status before testing ros2 param list. I do not have a separate machine with which to try reproducing at the moment, unfortunately.

DrakeP gravatar image DrakeP  ( 2020-11-30 18:00:05 -0500 )edit

While Windows 10 is supported, and Ubuntu is supported, Docker-containers-on-Ubuntu-in-WSL2-on-Windows-10 is not part of the standard list of systems -- nor is it included in CI or testing rounds.

@DrakeP: is this reproducable on a regular Ubuntu machine? Or perhaps in a VM (I know WSL2 is technically a VM, but there's still some funky stuff going on inside it)? Both VMWare and VBox (fi) have free versions.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-23 03:08:50 -0500 )edit