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

Can nodes be made to automatically restart on segmentation faults? [closed]

asked 2012-07-15 00:35:44 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Is there a convenient way to tell roslaunch to automatically restart nodes if/when they segfault or otherwise die.

I realize that in an ideal world, I'd just fix the errors properly. However, parts of the code aren't mine and I'll be using them in a live demo. So I'd prefer to have them run in a 'best effort' mode. :)

One obvious option would be to launch the buggy nodes using a bash script:

while : ; do rosrun package node; done

but I was wondering if there was a more idiomatic ROS style?

Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Procópio
close date 2018-02-07 06:40:29.700511

1 Answer

Sort by » oldest newest most voted
5

answered 2012-07-15 02:38:13 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

roslaunch provides the respawn attribute. E.g.:

<roslaunch>
  <node name="foo" pkg="package" type="node" respawn="true" />
</roslaunch>

Check out the documentation here.

edit flag offensive delete link more

Comments

Yes respawn will to the job. But may the questioner shut more be concerned about the segmentation fault and its causes, rather then just search for a work around. By the way, the most common cause of segfault is bad memory handling and faulty assumptions about availability of resources.

tlinder gravatar image tlinder  ( 2012-07-15 11:22:22 -0500 )edit

Thanks Lorenz.. that's exactly what I was looking for. I feel a bit silly now for not having noticed it in the documentation.

Benjamin Johnston gravatar image Benjamin Johnston  ( 2012-07-15 22:52:22 -0500 )edit

Question Tools

Stats

Asked: 2012-07-15 00:35:44 -0500

Seen: 8,237 times

Last updated: Jul 15 '12