Skip to content

Commit

Permalink
Moved resetting and claiming estop out of spot ros startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dniewinski committed Sep 18, 2020
1 parent 5034e19 commit de6b029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions spot_driver/scripts/spot_ros.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,6 @@ def main(self):

rospy.on_shutdown(self.shutdown)

self.spot_wrapper.resetEStop()

self.auto_claim = rospy.get_param('~auto_claim', False)
self.auto_power_on = rospy.get_param('~auto_power_on', False)
self.auto_stand = rospy.get_param('~auto_stand', False)
Expand Down
5 changes: 4 additions & 1 deletion spot_driver/scripts/spot_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def __init__(self, username, password, token, hostname, logger, rates = {}, call
self._rear_image_task = AsyncImageService(self._image_client, self._logger, max(0.0, self._rates.get("rear_image", 0.0)), self._callbacks.get("rear_image", lambda:None), self._rear_image_requests)
self._idle_task = AsyncIdle(self._robot_command_client, self._logger, 10.0, self)

self._estop_endpoint = EstopEndpoint(self._estop_client, 'ros', 9.0)
self._estop_endpoint = None

self._async_tasks = AsyncTasks(
[self._robot_state_task, self._robot_metrics_task, self._lease_task, self._front_image_task, self._side_image_task, self._rear_image_task, self._idle_task])
Expand Down Expand Up @@ -354,6 +354,7 @@ def updateTasks(self):

def resetEStop(self):
"""Get keepalive for eStop"""
self._estop_endpoint = EstopEndpoint(self._estop_client, 'ros', 9.0)
self._estop_endpoint.force_simple_setup() # Set this endpoint as the robot's sole estop.
self._estop_keepalive = EstopKeepAlive(self._estop_endpoint)

Expand All @@ -378,6 +379,7 @@ def releaseEStop(self):
if self._estop_keepalive:
self._estop_keepalive.stop()
self._estop_keepalive = None
self._estop_endpoint = None

def getLease(self):
"""Get a lease for the robot and keep the lease alive automatically."""
Expand Down Expand Up @@ -480,3 +482,4 @@ def velocity_cmd(self, v_x, v_y, v_rot, cmd_duration=0.1):
v_x=v_x, v_y=v_y, v_rot=v_rot, params=self._mobility_params),
end_time_secs=end_time)
self._last_motion_command_time = end_time

0 comments on commit de6b029

Please sign in to comment.