@@ -30,6 +30,8 @@ def __init__(self, port, baudrate="115200", timeout=0.1, debug=False):
3030 self ._serial_port .rts = False
3131 self ._serial_port .open ()
3232 self .lock = threading .Lock ()
33+ self .has_reply_command = []
34+
3335
3436
3537 def _mesg (self , genre , * args , ** kwargs ):
@@ -80,7 +82,14 @@ def _mesg(self, genre, *args, **kwargs):
8082 ProtocolCode .GET_GRIPPER_MODE ,
8183 ProtocolCode .SET_SSID_PWD ,
8284 ProtocolCode .COBOTX_IS_GO_ZERO ,
83- ProtocolCode .GET_ERROR_DETECT_MODE
85+ ProtocolCode .GET_ERROR_DETECT_MODE ,
86+ ProtocolCode .POWER_ON ,
87+ ProtocolCode .POWER_OFF ,
88+ ProtocolCode .RELEASE_ALL_SERVOS ,
89+ ProtocolCode .RELEASE_SERVO ,
90+ ProtocolCode .FOCUS_ALL_SERVOS ,
91+ ProtocolCode .FOCUS_SERVO ,
92+ ProtocolCode .STOP
8493 ]:
8594 return self ._process_single (res )
8695 elif genre in [ProtocolCode .GET_ANGLES ]:
@@ -192,7 +201,7 @@ def write_move_c(self, transpoint, endpoint, speed):
192201
193202 def focus_all_servos (self ):
194203 """Lock all joints"""
195- return self ._mesg (ProtocolCode .FOCUS_ALL_SERVOS )
204+ return self ._mesg (ProtocolCode .FOCUS_ALL_SERVOS , has_reply = True )
196205
197206 def go_zero (self ):
198207 """Control the machine to return to the zero position.
@@ -460,4 +469,39 @@ def tool_serial_set_timeout(self, max_time):
460469
461470 def get_robot_status (self ):
462471 return self ._mesg (ProtocolCode .MERCURY_ROBOT_STATUS , has_reply = True )
472+
473+ def power_on (self ):
474+ """Open communication with Atom."""
475+ return self ._mesg (ProtocolCode .POWER_ON , has_reply = True )
476+
477+ def power_off (self ):
478+ """Close communication with Atom."""
479+ return self ._mesg (ProtocolCode .POWER_OFF , has_reply = True )
480+
481+ def release_all_servos (self ):
482+ """Relax all joints
483+ """
484+ return self ._mesg (ProtocolCode .RELEASE_ALL_SERVOS , has_reply = True )
485+
486+ def focus_servo (self , servo_id ):
487+ """Power on designated servo
488+
489+ Args:
490+ servo_id: int. joint id 1 - 7
491+ """
492+ self .calibration_parameters (class_name = self .__class__ .__name__ , id = servo_id )
493+ return self ._mesg (ProtocolCode .FOCUS_SERVO , servo_id , has_reply = True )
494+
495+ def release_servo (self , servo_id ):
496+ """Power off designated servo
497+
498+ Args:
499+ servo_id: int. joint id 1 - 7
500+ """
501+ self .calibration_parameters (class_name = self .__class__ .__name__ , id = servo_id )
502+ return self ._mesg (ProtocolCode .RELEASE_SERVO , servo_id , has_reply = True )
503+
504+ def stop (self ):
505+ """Stop moving"""
506+ return self ._mesg (ProtocolCode .STOP , has_reply = True )
463507
0 commit comments