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

Terminate ROS program

asked 2016-12-16 06:39:27 -0500

Akhilesh gravatar image

Hi I am new in ROS. In my program, I am launching a launch file and through which my .cpp file is executing. In this .cpp, I check for a condition, if it doesn't satisfy I have to terminate the program. To terminate this I have tried ros::shutdown() but it not working enough. How should I terminate this.

Thanks a lot for your help.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-12-16 23:13:44 -0500

Akhilesh gravatar image

I found the solution. I added the required="true" option to one of the <node> tags in my launch file. e.g. <node ns="stereo" pkg="uvc_camera" type="tara_node" name="uvc_camera" output="screen" required="true">

edit flag offensive delete link more
1

answered 2016-12-16 11:19:49 -0500

rbbg gravatar image

Hi Akhilesh,

What is going wrong when calling ros::shutdown()? Have a look at this similar question: Properly bring down active node.

It points to the roscpp docs on shutting down and another question with a detailed answer. You should be able to find all the information you need over there.

Good luck!

edit flag offensive delete link more

Comments

Hi rbbg,

Thanks for responding. Actually I tried with the above step that you shared, but when I was calling ros::shutdown(), the node was being stopped but roslaunch was existing. Hence I was not able to come out of the program.

Akhilesh gravatar image Akhilesh  ( 2016-12-16 23:23:30 -0500 )edit

So I followed one step that I have mentioned in my answer and now it is working properly and shutting down too.

Akhilesh gravatar image Akhilesh  ( 2016-12-16 23:25:07 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-12-16 06:39:27 -0500

Seen: 19,741 times

Last updated: Dec 16 '16