How to receive a topic successful on another PC using "echo / hz"?
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!
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. Butecho
andhz
require a direct communication between nodes. But again, not sure how that works in ROS2. AreROS_HOSTNAME
andROS_IP
still used in ROS2?As i understand ROS2 doesn't use
ROS_HOSTNAME
andROS_IP
anymore. The new requirement for nodes to communicate with each other is to have the sameROS_DOMAIN_ID
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?Ping does work without problems in both directions. Here the
export | grep ROS
:Did you ever resolve this issue?