ROS2 node not publishing when launched instead of run
I’m picking my way through ROS2 by building up a small robot. I have enough nodes now to be useful but it is getting tiring to run them all independently so I am now trying to create launch files for my laptop and the robot. The launch file seems to be doing what it is supposed to but the nodes aren’t publishing anything anymore.
More details: I have followed this tutorial: https://docs.ros.org/en/foxy/Tutorial... When I run a node normally and do ‘ros2 node list’, I see it as /myNode. If I use a launch file, I now see it as /myNamespace/myNode. That seems fine. Likewise, a published topic goes from /myTopic to /myNamespace/myTopic if I am using ‘ros2 topic list’.
If I do ‘ros2 topic echo /myTopic’ after having run the node separately, I see exactly the output that I would expect. If I used a launch file then I would expect do ros2 topic echo /myNamespace/myTopic but I don’t see anything at all.
What am I missing?
What does
ros2 doctor
command ouput when you run those nodes?They seem to be running. If I do ps -ef | grep 17868 for example then I see that the process is running.
Similarly:
Here is the output when I launch the launch file:
The log file just has the same stuff that was printed to the screen. There are no error messages.