0
$\begingroup$

Rosanswers logo

I'm using a launch file to start a driver node and another node at the same time. Meanwhile, I'm running another file, which is supposed to publish a message to a topic, to which the non-driver node in the launch file is subscribed. When I don't use the launch file and run the driver separately, everything works fine. The message is published and read correctly. However, when I use the launch file, the message appears not to be read.


Originally posted by mkt29 on ROS Answers with karma: 3 on 2011-07-13

Post score: 0


Original comments

Comment by mkt29 on 2011-07-13:
The message is published by a program outside of the launch file and it's being published constantly so I don't think that's the problem.

Comment by Dan Lazewatsky on 2011-07-13:
Is this a single message that one of your nodes is firing off when it starts, or a topic that is updated periodically? In launch files, the order that nodes start up in is not guaranteed, so one node could publish a message before the receiving node is ready.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Just a guess, but maybe you specified a different node name in the launch file than when calling ros::init in your subscriber node. If you use relative topic names, they will be in a namespace named according to your node name.

rostopic list and rostopic echo might help, too. Start up everything and try to find out if your topic is present twice, in different namespaces (just call rostopic list). Then do a rostopic info <topic> to verify the node names that publish/subscribe to the topic.

If my guess is correct, either change your nodes to use absolute node names or use topic remapping to fix the topic name or simply rename your node in the launch file.


Originally posted by Lorenz with karma: 22731 on 2011-07-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by mkt29 on 2011-07-14:
Yep, that was the problem. Thanks!

$\endgroup$
0
$\begingroup$

Rosanswers logo

you might want to take a look at the latch option for roscpp and for rospy.


Originally posted by hsu with karma: 5780 on 2011-07-13

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by mkt29 on 2011-07-13:
Hm, didn't work for me.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.