How to receive a topic successful on another PC using "echo / hz"?

asked 2020-10-22 06:04:12 -0500

twetzel gravatar image

I want to send a sensor_msg::image from PC1 to PC2. PC1 is a Raspberry Pi 4 with Ubuntu 18.04

uname -a
Linux ubuntu 4.19.105-v8-28 #28 SMP PREEMPT Mon Feb 24 17:59:40 PST 2020 aarch64    aarch64 aarch64 GNU/Linux

PC2 is an Virtual Machine also with Ubuntu 18.04

uname -a
Linux ubuntu 5.4.0-52-generic #57~18.04.1-Ubuntu SMP Thu Oct 15 14:04:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

On both machines the ros2 dashing is installed. PC1 has a node called "Cameranode" that publishes the image from a pi-cam. Both PCs have the same ROS_DOMAIN_ID set:

export ROS_DOMAIN_ID=220 # 232 max

As I start the node on PC1 and enter ros2 topic list on PC2 the topic is recognized at PC2:

student@ubuntu:~/mad2/mad_ws$ ros2 topic list 
/mad/camera/parameter_events
/mad/camera/rosimage
/mad/camera/rosout
/parameter_events
/rosout

And here the problem starts: ros2 topic echo /mad/camera/rosimage and ros2 topic hz /mad/camera/rosimage doesn't seem to work:

student@ubuntu:~/mad2/mad_ws$ ros2 topic echo /mad/camera/rosimage 
Could not determine the type for the passed topic
student@ubuntu:~/mad2/mad_ws$ ros2 topic hz /mad/camera/rosimage 
WARNING: topic [/mad/camera/rosimage] does not appear to be published yet

The message is build and sourced on both machines. I don't understand why echo doesn't determine the type and hz doesn't even find a message. Thank you for your help!

edit retag flag offensive close merge delete

Comments

I'm not yet familiar with ROS2, but I've seen this issue a bunch of times in ROS1. The issue is always about the ROS_HOSTNAME used by the nodes not being resolvable by the other nodes. topic list works because it is provided by the ROS master. But echo and hz require a direct communication between nodes. But again, not sure how that works in ROS2. Are ROS_HOSTNAME and ROS_IP still used in ROS2?

chfritz gravatar image chfritz  ( 2020-10-22 18:32:29 -0500 )edit

As i understand ROS2 doesn't use ROS_HOSTNAME and ROS_IP anymore. The new requirement for nodes to communicate with each other is to have the same ROS_DOMAIN_ID

twetzel gravatar image twetzel  ( 2020-10-23 09:52:27 -0500 )edit

I see, good to know. But these machines must still somehow announce themselves to others. Are the two machines able to ping each other using their respective hostnames? Also, can you do a export | grep ROS and post the result?

chfritz gravatar image chfritz  ( 2020-10-23 11:24:50 -0500 )edit

Ping does work without problems in both directions. Here the export | grep ROS:

ubuntu@ubuntu:~$ export | grep ROS
declare -x ROS_DISTRO="dashing"
declare -x ROS_DOMAIN_ID="220"
declare -x ROS_PYTHON_VERSION="3"
declare -x ROS_VERSION="2"
twetzel gravatar image twetzel  ( 2020-10-27 01:48:26 -0500 )edit