Skip to content

Commit adbf6a7

Browse files
committed
Exit move_to_ connections immediately on signal
1 parent ce57f72 commit adbf6a7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/robot_callbacks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ def _move_to_angle(goal, publisher, controller):
127127
gamma = None
128128
vel_msg = Twist()
129129
hz_rate = rospy.Rate(_MOVE_HZ)
130-
while not controller.instance.is_collided() and (
131-
gamma is None or np.abs(gamma) > _MOVE_TOL_YAW):
130+
while (not controller.evt.is_set() and
131+
not controller.instance.is_collided() and
132+
(gamma is None or np.abs(gamma) > _MOVE_TOL_YAW)):
132133
# Get latest orientation error
133134
current = __SE3_to_SE2(_current_pose(controller))
134135
gamma = __yaw_from_SE2(np.matmul(np.linalg.inv(current), g))
@@ -155,8 +156,9 @@ def _move_to_pose(goal, publisher, controller):
155156
rho = None
156157
vel_msg = Twist()
157158
hz_rate = rospy.Rate(_MOVE_HZ)
158-
while not controller.instance.is_collided() and (rho is None or
159-
rho > _MOVE_TOL_DIST):
159+
while (not controller.evt.is_set() and
160+
not controller.instance.is_collided() and
161+
(rho is None or rho > _MOVE_TOL_DIST)):
160162
# Get latest position error
161163
current = __SE3_to_SE2(_current_pose(controller))
162164
error = np.matmul(np.linalg.inv(current), g)

0 commit comments

Comments
 (0)