ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
If I understand your question: when you run the simulator.py node before missioncontrol.py everything is okay, but when you run the two nodes simultaneously (using the launch file) no data is passed between them. In other terms: the start up order is very important in your case.
First, the documentation of roslaunch specify clearly that :
Roslaunch intentionally does not provide any control on the order or timing of node start up
So if you want that the simulator.py node run before missioncontrol.py, you can simply add a waiting time in the code of this last one, for example:
rospy.sleep(2)
This will force the second node to sleep for two seconds so that the first node will have all the time necessary to initialize and publish its messages.
However, this is like a "brute force" solution, and a nicer one will be to use the following function:
wait_for_message(topic, topic_type, timeout=None)
which will block the execution of the script until a message is published in the specified topic.