Skip to content

Commit

Permalink
Mercury API Pause and Stop Interface Add Slow Stop Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
anla-xu committed Mar 26, 2024
1 parent e5cbb8c commit e2532de
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion pymycobot/mercury_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,31 @@ def get_pos_over_shoot(self):
"""Get position deviation value
"""
return self._mesg(ProtocolCode.MERCURY_GET_POS_OVER_SHOOT, has_reply=True)


def stop(self, deceleration=False):
"""Robot stops moving
Args:
deceleration (bool, optional): Whether to slow down and stop. Defaults to False.
Returns:
int: 1 - Stop completion
"""
if deceleration:
return self._mesg(ProtocolCode.STOP, has_reply=True)
else:
return self._mesg(ProtocolCode.STOP, 1, has_reply=True)

def pause(self, deceleration=False):
"""Robot pauses movement
Args:
deceleration (bool, optional): Whether to slow down and stop. Defaults to False.
Returns:
int: 1 - pause completion
"""
if deceleration:
return self._mesg(ProtocolCode.PAUSE, has_reply=True)
else:
return self._mesg(ProtocolCode.PAUSE, 1, has_reply=True)

0 comments on commit e2532de

Please sign in to comment.