Rosanswers logo

I want to trigger a launch file using a client node when the service node returns a boolean value true. I have created a simple client and service. The response of the service node is a boolean variable. How can I trigger the launch file when the client receives true in the response for its request? I am using ROS Fuerte on Ubuntu 12.04.

Originally posted by Hemu on ROS Answers with karma: 156 on 2013-07-22

Post score: 2

Original comments

Comment by Hemu on 2013-10-14:
Thanks a lot.I had tried putting all nodes in a single launch file. I created a message type which contained the boolean variable.Each node in the launch file subscribes the message.I tried to trigger each node in the launch file separately.I was not aware of system commands.I will try to use them.


1 Answer 1


Rosanswers logo

I have needed to do a similar launching process,and I found two possible methods. Two possible methods:

  1. Roslaunch has an API, with which you can achieve your desired result. More specifically the Roslaunchrunner has function called launchnode. However this API is very experimental, and does occasionally crash
  2. Other alternative, make your own .launch file, and then have your node run it at command line.

Obviously, 1 is more desirable. But I ended up using 2 as its more stable, at least that is what I found

For 2, in C++ you could use the system command. In python you can use os.system or more advisably subprocess library

I hope this helpful. SORRY it wouldnt let me leave it as an answer


Originally posted by Phuicy with karma: 46 on 2013-10-14

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

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