Page 1 of 1

Solving all tasks from withing one script

PostPosted: Thu 25. Sep 2014, 12:04
by proprentnerl
Hello again,

as I have written in another topic ros cannot handle time_jumps very well, especially tf.
So after solving a task, it is necessary to kill all nodes using tf frames which brings up the problem that there seems to be no sure kill method for all nodes except restarting the roscore (which is not possible in the final evaluation).
I tried to simply relaunch my launch file, which starts all nodes a new but can lead to conditions where a node subscribes to an old node which than gets killed.

Any help would be appreciated!
Lukas

Posted: Thu 25. Sep 2014, 12:04
by Advertising

Re: Solving all tasks from withing one script

PostPosted: Thu 25. Sep 2014, 12:36
by Peter Lehner
Hi,

proprentnerl wrote:I tried to simply relaunch my launch file, which starts all nodes a new but can lead to conditions where a node subscribes to an old node which than gets killed.

The problem I see is that the old ros nodes are not killed before you start your new nodes. Before relaunching your nodes you should probably check which of your old nodes are still running and kill them manually. You can use the 'rosnode' tool to do so:
Code: Select all
rosnode list
will list all current running nodes.
Code: Select all
rosnode kill YOUR_ROS_NODE
will kill the node with the name 'YOUR_ROS_NODE' and block until its shutdown.

Be careful though not to accidentally kill any of the simulator nodes.

Best,
Peter

Re: Solving all tasks from withing one script

PostPosted: Thu 25. Sep 2014, 12:44
by proprentnerl
rosnode kill is sadly not very reliable...
there is simply no reliable way to reset everything in ros without restarting the roscore