How to Ctrl-C out of a SMACH state machine? [closed]

asked 2013-04-13 16:21:03 -0500

Pi Robot gravatar image


I have a simple SMACH state machine that moves a robot through a series of waypoints using SimpleActionStates to wrap MoveBaseGoals for each of the waypoints. For example, here is how I define the SimpleActionState for one of the waypoints:

nav_goal = MoveBaseGoal()
nav_goal.target_pose.header.frame_id = 'map'
nav_goal.target_pose.pose = waypoint
move_base_state = SimpleActionState('move_base', MoveBaseAction, goal=nav_goal, 

What I have discovered is that if I type Ctrl-C after the state machine starts running (and the robot is moving between waypoints), there is a delay of 3-4 seconds before the robot stops moving. My on_shutdown() function looks like this:

def shutdown(self):
    rospy.loginfo("Stopping the robot...")

If instead of using SMACH I simply use an actionlib.SimpleActionClient to send MoveBaseGoals directly, I can execute a move_base.cancel_goal() during the on_shutdown() function which stops the robot immediately.

Is there some way I can terminate a SMACH state machine more quickly?

I am using ROS Groovy on Ubuntu 12.04.


edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-11-06 16:14:59.932926



Did you ever figure out how to ctrl-c out of a smach state in progress? Maybe some of the details are out of date above, but in Jade I've just started using smach_ros and I can't ctrl-c out of a SimpleActionState.

lucasw gravatar imagelucasw ( 2016-05-27 15:28:17 -0500 )edit