View Full Version : Add shutdown actions to ArbotiX node?

Pi Robot
12-20-2010, 12:02 PM

I've been trying to figure out how to do a clean shutdown of my ArbotiX ROS node by adding a rospy.on_shutdown(self.shutdown) handler to arbotix_node.py where self.shutdown looks something like this:

def shutdown(self):
rospy.loginfo("Shutting down ArbotiX node...")
for name in self.sync_names:
rospy.loginfo("Disabling servo " + name)
self.servos[name].disableTorque() and I added the disableTorque() function to the DynamixelServo class in arbotix-node.py that looks like this:

def disableTorque(self):
self.device.disableTorque(self.id)When I Ctrl-C to kill the node (launched from a launch file), I get the following output on the terminal:

[arbotix-1] killing on exit
[INFO] 1292864239.520982: Shutting down ArbotiX node...
[INFO] 1292864239.521541: Disabling servo head_pan_joint

and then it hangs for about 20 seconds and finally exits with:

[arbotix-1] escalating to SIGTERM
[arbotix-1] escalating to SIGKILL
Shutdown errors:
* process[arbotix-1, pid 28723]: required SIGKILL. May still be running.
shutting down processing monitor...
... shutting down processing monitor complete

I actually have 13 servos in my joint list and head_pan_joint is the first so it doesn't get past head_pan_joint and even that joint is not disabled.

Can you see what I am doing wrong?


12-20-2010, 12:11 PM
Have you tried removing the loginfo calls?


Pi Robot
12-20-2010, 12:15 PM
Have you tried removing the loginfo calls?


Just tried that and it made no difference. I'm wondering if the joint_controller thread is being killed before it gets to the shutdown handler?