I have ROS2 Foxy set up on an Ubuntu 20.04 machine. When using RQt, I am able to see all the topics on my network just fine and I am able to subscribe to all of them and even plot them on a live graph. However, publishing doesn't work correctly and always publishes null/default messages. For example, if I try to publish a Bool message with the data as "true" then it still publishes "false". Same with any numeric types - whatever number I try to publish, it always publishes 0. See the image for examples: RQt screenshot
To debug, I have tried publishing these same messages from Python scripts and from the 'ros2 pub' command line utility. These always work just fine and my subscribers in RQt are able to see the correct values being published. Has anyone else dealt with this? What is the underlying cause and how to solve it? Is it perhaps fixed in ROS2 Galactic?
As user '2b-t' pointed out in the comments, this is an issue where working code was removed from
rqt_publisherin thefoxy-develbranch. So while RQt in ROS2 Foxy is broken, for now there is a workaround of cloningrqt_publisherinto your ROS2 workspace and manually adding in the missing code. It's easy and there's an example pull request created by a github user 'coalman321' which shows how to revert the offending commit here (https://github.com/ros-visualization/rqt_publisher/pull/28/files).Steps to fix:
cdinto thesrcdirectory your ROS2 workspacegit clone https://github.com/ros-visualization/rqt_publisher.gitcd rqt_publishergit checkout foxy-develgit revert 367049ecc4ce3cabcdback up to the root of your ROS2 workspacecolcon build --symlink-install --packages-up-to rqt_publishersource install/local_setup.bashNow when you run
rqtand publish a non-null value, it should work correctly! You can monitor the value either from command line e.g.ros2 topic echoor from the Topic Monitor within RQt itself.