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

Start and stop ros nodes using service calls

asked 2020-11-16 08:23:02 -0500

shubhamjain gravatar image

Hello everyone, I am trying to create a Node Manager which is responsible to start and stop/kill a node based on service requests. The issue is roslaunch API launches the nodes in the main process but since the Service server works on separate thread, ROS services are not usable directly. I have already tried running the launch files using the system calls in service callbacks, but they are blocking the thread.

I can create a separate process using the subprocess API but is there any "ROS" way to do this as I have to have complete control on starting and killing the nodes? Is there any better way than ROS services to reach the objective?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-11-16 10:05:58 -0500

electrophod gravatar image

You can try using the rosnode's python API : http://docs.ros.org/en/kinetic/api/ro... and call the function to kill the node in the service callback function.

edit flag offensive delete link more
0

answered 2020-11-16 09:46:04 -0500

One way to get this done is using the ROS capability server. Your notion of a node manager sound quite similar to that. It allows you to define capabilities, which have their own launch files, and the capability server provides you with a service API to start/stop those capabilities.

edit flag offensive delete link more

Comments

Do you have any examples with this node? I am trying to use it for the same reason described in this question, but I am not getting it very well.

rezenders gravatar image rezenders  ( 2020-12-15 11:39:32 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-11-16 08:23:02 -0500

Seen: 1,027 times

Last updated: Nov 16 '20