Skip to content

Commit 81b33d2

Browse files
BergerKing333jmblixt3
authored andcommitted
idk how to test this
1 parent 0134533 commit 81b33d2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/rovr_control/rovr_control/dig_location_server.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import rclpy
2-
from rclpy.action import ActionClient, ActionServer
2+
from rclpy.action import ActionClient, ActionServer, CancelResponse
33
from rclpy.node import Node
44
from rovr_control.costmap_2d import PyCostmap2D
55
from rovr_interfaces.srv import DigLocation
@@ -104,6 +104,14 @@ async def drive_to_dig_location(self, goal_handle: ServerGoalHandle):
104104

105105
return result
106106

107+
def cancel_callback(self, cancel_request: ServerGoalHandle):
108+
self.get_logger().info("Cancelling drive to dig location")
109+
if self.nav_handle.status == GoalStatus.STATUS_EXECUTING:
110+
self.nav_handle.cancel_goal_async()
111+
if not self.nav_handle.is_done():
112+
self.nav_handle.cancel_goal_async()
113+
return CancelResponse.ACCEPT
114+
107115
# yaw in rads.
108116
# yaw = 0 at x axis, positive is counter clockwise
109117
def get_goal_pose(self, x, y, yaw):

0 commit comments

Comments
 (0)