Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 21 additions & 23 deletions spot_wrapper/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,16 +977,16 @@ def assertEStop(self, severe=True):
self._estop_keepalive.settle_then_cut()

return True, "Success"
except:
return False, "Error"
except Exception as e:
return False, f"Exception while attempting to estop: {e}"

def disengageEStop(self):
"""Disengages the E-Stop"""
try:
self._estop_keepalive.allow()
return True, "Success"
except:
return False, "Error"
except Exception as e:
return False, f"Exception while attempting to disengage estop {e}"

def releaseEStop(self):
"""Stop eStop keepalive"""
Expand Down Expand Up @@ -1017,7 +1017,7 @@ def release(self):
self.releaseEStop()
return True, "Success"
except Exception as e:
return False, str(e)
return False, f"Exception while attempting to release the lease: {e}"

def disconnect(self):
"""Release control of robot as gracefully as posssible."""
Expand All @@ -1043,9 +1043,7 @@ def _robot_command(self, command_proto, end_time_secs=None, timesync_endpoint=No
)
return True, "Success", command_id
except Exception as e:
self._logger.error(
"Unable to execute robot command, exception was" + str(e)
)
self._logger.error(f"Unable to execute robot command: {e}")
return False, str(e), None

@try_claim
Expand Down Expand Up @@ -1142,7 +1140,7 @@ def clear_behavior_fault(self, id):
)
return True, "Success", rid
except Exception as e:
return False, str(e), None
return False, f"Exception while clearing behavior fault: {e}", None

@try_claim
def power_on(self):
Expand All @@ -1156,7 +1154,7 @@ def power_on(self):
self._logger.info("Powering on")
self._robot.power_on()
except Exception as e:
return False, str(e)
return False, f"Exception while powering on: {e}"

return True, "Success"

Expand Down Expand Up @@ -1358,7 +1356,7 @@ def ensure_arm_power_and_stand(self):
except Exception as e:
return (
False,
"Exception occured while Spot or its arm were trying to power on",
f"Exception occured while Spot or its arm were trying to power on: {e}",
)

if not self._is_standing:
Expand Down Expand Up @@ -1388,7 +1386,7 @@ def arm_stow(self):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while trying to stow"
return False, f"Exception occured while trying to stow: {e}"

return True, "Stow arm success"

Expand All @@ -1409,7 +1407,7 @@ def arm_unstow(self):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while trying to unstow"
return False, f"Exception occured while trying to unstow: {e}"

return True, "Unstow arm success"

Expand All @@ -1430,7 +1428,7 @@ def arm_carry(self):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while carry mode was issued"
return False, f"Exception occured while carry mode was issued: {e}"

return True, "Carry mode success"

Expand Down Expand Up @@ -1531,7 +1529,7 @@ def arm_joint_move(self, joint_targets):
return True, "Spot Arm moved successfully"

except Exception as e:
return False, "Exception occured during arm movement: " + str(e)
return False, f"Exception occured during arm movement: {e}"

@try_claim
def force_trajectory(self, data):
Expand Down Expand Up @@ -1599,7 +1597,7 @@ def create_wrench_from_msg(forces, torques):
time.sleep(float(traj_duration) + 1.0)

except Exception as e:
return False, "Exception occured during arm movement"
return False, f"Exception occured during arm movement: {e}"

return True, "Moved arm successfully"

Expand All @@ -1620,7 +1618,7 @@ def gripper_open(self):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while gripper was moving"
return False, f"Exception occured while gripper was moving: {e}"

return True, "Open gripper success"

Expand All @@ -1641,7 +1639,7 @@ def gripper_close(self):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while gripper was moving"
return False, f"Exception occured while gripper was moving: {e}"

return True, "Closed gripper successfully"

Expand Down Expand Up @@ -1670,7 +1668,7 @@ def gripper_angle_open(self, gripper_ang):
time.sleep(2.0)

except Exception as e:
return False, "Exception occured while gripper was moving"
return False, f"Exception occured while gripper was moving: {e}"

return True, "Opened gripper successfully"

Expand Down Expand Up @@ -1740,7 +1738,7 @@ def hand_pose(self, data):
except Exception as e:
return (
False,
"An error occured while trying to move arm \n Exception:" + str(e),
f"An error occured while trying to move arm \n Exception: {e}",
)

return True, "Moved arm successfully"
Expand Down Expand Up @@ -1795,7 +1793,7 @@ def grasp_3d(self, frame, object_rt_frame):
self._robot.logger.info("Finished grasp.")

except Exception as e:
return False, "An error occured while trying to grasp from pose"
return False, f"An error occured while trying to grasp from pose: {e}"

return True, "Grasped successfully"

Expand Down Expand Up @@ -2201,7 +2199,7 @@ def dock(self, dock_id):
self._last_stand_command = None
return True, "Success"
except Exception as e:
return False, str(e)
return False, f"Exception while trying to dock: {e}"

@try_claim
def undock(self, timeout=20):
Expand All @@ -2213,7 +2211,7 @@ def undock(self, timeout=20):
blocking_undock(self._robot, timeout)
return True, "Success"
except Exception as e:
return False, str(e)
return False, f"Exception while trying to undock: {e}"

def get_docking_state(self, **kwargs):
"""Get docking state of robot."""
Expand Down