Ask Your Question
0

Roslaunch not working

asked 2015-06-02 18:58:14 -0500

prr_shyam gravatar image

updated 2015-06-02 20:47:23 -0500

ahendrix gravatar image

I have two nodes - Mission Control and Simulator. Mission control publishes to command topic and subscribes to telemetry topic while simulator node subscribes to command topic and publishes to telemetry topic. When I use rosrun both runs fine but only mission control node runs when I use roslaunch command. the printed message on the terminal is "The Goal Latitude is 33 and Goal Longitude is -84" and it keeps on running ... No error message. I also know that both nodes are running (used rosnode list to check it). Also both telemetry topic and commands topic are running (rostopic list) The following is my XML code. Please help. Thanks in advance.

<launch>
  <group> 
    <node pkg="groundcontrolstation" type="missioncontrol.py" name="mission_control"  output="screen"/>
    <node pkg="groundcontrolstation" type="simulator.py" name="simulator" output="screen" />
  </group>
</launch>
edit retag flag offensive close merge delete

Comments

1

As already said in your duplicate post, please include any error messages you get. There is not enough information in your post to help you.

gvdhoorn gravatar image gvdhoorn  ( 2015-06-03 01:20:54 -0500 )edit

hello as I mentioned above in the post , I am not getting any error message the node keeps on running but one more thing I found out was while using rosrun I have to run simulator node before mission control node for it to work otherwise between the nodes no data is passed. Thank you

prr_shyam gravatar image prr_shyam  ( 2015-06-03 10:19:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-03 17:42:04 -0500

Horse-man gravatar image

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.

edit flag offensive delete link more

Comments

Thanks a lot. It works now.

prr_shyam gravatar image prr_shyam  ( 2015-06-05 13:31:32 -0500 )edit

you're welcome.

Horse-man gravatar image Horse-man  ( 2015-06-05 16:03:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-06-02 18:58:14 -0500

Seen: 681 times

Last updated: Jun 03 '15