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

Calling from launchfile

asked 2012-11-04 21:16:37 -0600

updated 2014-01-28 17:14:09 -0600

ngrennan gravatar image

There are a lot of threads on a bug in openni that crash the kinect because xnsensorserver is not shut down correctly. The solution seems to be to run this script ( from the launchfile to kill xnsensorserver automatically.

I tried to call this from my launchfile, but it just waits for ctrl-c without starting any of the nodes that should be started by the launchfile. Have anyone been successful in running this script? Currently I call the script by this command (in the end of the launchfile):

<param name="cleanup" command="$(find crops_fruit_localization)/include/"/>
edit retag flag offensive close merge delete


By putting this into a param command, are you trying some nasty hack that will have this executed before actual nodes? I'm not sure what this will result in.

dornhege gravatar image dornhege  ( 2012-11-04 22:27:17 -0600 )edit

No i would like it to execute after the other nodes have been executed. The script waits until the user press ctrl-c and then it kills xnsensorserver, so it does not remove anything until the program is terminated. The problem is that it prevents any other nodes to be started.

Ola Ringdahl gravatar image Ola Ringdahl  ( 2012-11-04 22:41:43 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-04 23:51:12 -0600

dornhege gravatar image

updated 2012-11-04 23:52:47 -0600

If it waits for Ctrl-C to kill the nodes, just put it in a normal <node> tag and everything should work. As it is, it is clear that it will wait as the param handling will wait for the command to finish to read in the parameter.

I'm not sure if Ctrl-C will conflict with roslaunch catching Ctrl-C to shutdown the launch. Then you'd need to wrap that script.

edit flag offensive delete link more


That seems logical, but how can I call a shell script within a node tag, do I have to add something to CMakeLists.txt?

Ola Ringdahl gravatar image Ola Ringdahl  ( 2012-11-05 00:27:06 -0600 )edit

No, you don't need to do anything. Just treat it like any other ROS node.

dornhege gravatar image dornhege  ( 2012-11-05 00:39:55 -0600 )edit

I have tried a couple of variations of <node pkg="fruit_localization" type="" name="cleanup"/> but I get an error saying it cannot launch it. I have tried putting the script in different folder (src/, bin/, include/) without success.

Ola Ringdahl gravatar image Ola Ringdahl  ( 2012-11-05 00:55:55 -0600 )edit

Can you rosrun it?

dornhege gravatar image dornhege  ( 2012-11-05 01:12:01 -0600 )edit

I just realized I misspelled the package name. Now everything works as it should :) Thanks for your help!

Ola Ringdahl gravatar image Ola Ringdahl  ( 2012-11-05 01:22:57 -0600 )edit

Question Tools

1 follower


Asked: 2012-11-04 21:16:37 -0600

Seen: 204 times

Last updated: Nov 04 '12