Start/Stop launch files via c Code and Taster

asked 2016-03-30 04:44:51 -0500

Twista3579 gravatar image

updated 2016-03-30 04:46:00 -0500

Hey all,

i have a Problem with the start/stop of my ros system. My custom bot is using the ros navigation stack and all works fine. Ros running on a raspberry pi with a ubuntu 14.04 tls. In my System exists one main launch file. This file should start and stop via a Taster. I am using the pigpio lib for the button interrupt. What is the best way to start this launch file after first button interrupt from my c Code and stop or kill all node after second button interrupt? All button interruptroutines already exists in my code.

I have two examples with a shellscript but i think this is not the best way

Start:

`system("bash  /home/shared/workspace/ros/navigation_ws/src/RosNavigation/welcome_bot_2dnav/launch/startRosNavigation.sh");

Or

 system("nohup /home/shared/workspace/ros/navigation_ws/src/RosNavigation/welcome_bot_2dnav/launch/startRosNavigation.sh > /dev/null 2>&1 &");`

Stop: --> find PID´s and kill

thanks for answers

Max

edit retag flag offensive close merge delete