ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Triggering a launch file using service and client nodes

asked 2013-07-22 23:50:21 -0500

Hemu gravatar image

updated 2013-11-18 19:16:55 -0500

tfoote gravatar image

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.

edit retag flag offensive close merge delete

Comments

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.

Hemu gravatar image Hemu  ( 2013-10-14 23:42:15 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-14 10:37:33 -0500

Phuicy gravatar image

updated 2013-10-14 10:38:07 -0500

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

Guy

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-07-22 23:50:21 -0500

Seen: 823 times

Last updated: Jul 22 '13