File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed
Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,9 @@ class ProtocolCode(object):
234234 GET_CURRENT_COORD_INFO = "M114"
235235 GET_BACK_ZERO_STATUS = "M119"
236236 IS_MOVING_END = "M9"
237+ GET_GRIPPER_ANGLE = "M50"
238+ SET_SYSTEM_VALUE = "M51"
239+ GET_SYSTEM_VALUE = "M52"
237240
238241
239242class DataProcessor (object ):
Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ def _request(self, flag=""):
130130 return 1
131131 else :
132132 return 0
133+ elif flag in ['gripper' , 'system' ]:
134+ return int (data [data .find ("[" )+ 1 :- 1 ])
133135 elif flag == None :
134136 return 0
135137
@@ -600,4 +602,43 @@ def is_moving_end(self):
600602
601603 def sync (self ):
602604 while self .is_moving_end () != 1 :
603- pass
605+ pass
606+
607+ def get_gripper_angle (self ):
608+ """
609+
610+ """
611+ command = ProtocolCode .GET_GRIPPER_ANGLE + ProtocolCode .END
612+ self ._serial_port .write (command .encode ())
613+ self ._serial_port .flush ()
614+ self ._debug (command )
615+ return self ._request ("gripper" )
616+
617+ def set_system_value (self , id , address , value ):
618+ """_summary_
619+
620+ Args:
621+ id (int): 4 or 7
622+ address (int): 0 ~ 69
623+ value (int):
624+ """
625+ command = ProtocolCode .SET_SYSTEM_VALUE + " X{} " .format (id ) + "Y{} " .format (address ) + "Z{} " .format (value )+ ProtocolCode .END
626+ self ._serial_port .write (command .encode ())
627+ self ._serial_port .flush ()
628+ self ._debug (command )
629+
630+ def get_system_value (self , id , address ):
631+ """_summary_
632+
633+ Args:
634+ id (int): 4 or 7
635+ address (_type_): 0 ~ 69
636+
637+ Returns:
638+ _type_: _description_
639+ """
640+ command = ProtocolCode .GET_SYSTEM_VALUE + " J{} " .format (id ) + "S{} " .format (address ) + ProtocolCode .END
641+ self ._serial_port .write (command .encode ())
642+ self ._serial_port .flush ()
643+ self ._debug (command )
644+ return self ._request ("system" )
You can’t perform that action at this time.
0 commit comments