@@ -101,6 +101,8 @@ def _mesg(self, genre, *args, **kwargs):
101101 return None
102102 if genre in [
103103 ProtocolCode .ROBOT_VERSION ,
104+ ProtocolCode .SOFTWARE_VERSION ,
105+ ProtocolCode .GET_ROBOT_ID ,
104106 ProtocolCode .IS_POWER_ON ,
105107 ProtocolCode .IS_CONTROLLER_CONNECTED ,
106108 ProtocolCode .IS_PAUSED , # TODO have bug: return b''
@@ -119,28 +121,46 @@ def _mesg(self, genre, *args, **kwargs):
119121 ProtocolCode .GET_END_TYPE ,
120122 ProtocolCode .GET_MOVEMENT_TYPE ,
121123 ProtocolCode .GET_REFERENCE_FRAME ,
122- ProtocolCode .GET_JOINT_MIN_ANGLE ,
123- ProtocolCode .GET_JOINT_MAX_ANGLE ,
124+ ProtocolCode .GET_FRESH_MODE ,
124125 ProtocolCode .SetHTSGripperTorque ,
125126 ProtocolCode .GetHTSGripperTorque ,
126127 ProtocolCode .GetGripperProtectCurrent ,
127128 ProtocolCode .InitGripper ,
128129 ProtocolCode .SET_FOUR_PIECES_ZERO
130+ # ProtocolCode.GET_SERVO_CURRENTS
129131 ]:
130132 return self ._process_single (res )
131133 elif genre in [ProtocolCode .GET_ANGLES ]:
132134 return [self ._int2angle (angle ) for angle in res ]
133- elif genre in [ProtocolCode .GET_COORDS , ProtocolCode .GET_TOOL_REFERENCE , ProtocolCode .GET_WORLD_REFERENCE ]:
135+ elif genre in [ProtocolCode .GET_ANGLE ]:
136+ return self ._int2angle (res [0 ]) if res else None
137+ elif genre in [ProtocolCode .GET_COORD ]:
138+ if real_command [5 ] < 4 :
139+ if real_command [2 ] == 3 :
140+ return self ._int2angle (res [0 ]) if res else None
141+ return self ._int2coord (res [0 ]) if res else None
142+ else :
143+ return self ._int2angle (res [0 ]) if res else None
144+ elif genre in [ProtocolCode .GET_ALL_BASE_COORDS , ProtocolCode .GET_COORDS , ProtocolCode .GET_TOOL_REFERENCE , ProtocolCode .GET_WORLD_REFERENCE , ProtocolCode .GET_BASE_COORDS , ProtocolCode .GET_BASE_COORD , ProtocolCode .BASE_TO_SINGLE_COORDS ]:
134145 if res :
135- r = []
146+ r = []
136147 for idx in range (3 ):
137148 r .append (self ._int2coord (res [idx ]))
138149 for idx in range (3 , 6 ):
139150 r .append (self ._int2angle (res [idx ]))
151+ if len (res ) == 12 :
152+ r1 = []
153+ for idx in range (6 , 9 ):
154+ r1 .append (self ._int2coord (res [idx ]))
155+ for idx in range (9 , 12 ):
156+ r1 .append (self ._int2angle (res [idx ]))
157+ return [r , r1 ]
140158 return r
141159 else :
142160 return res
143- elif genre in [ProtocolCode .GET_SERVO_VOLTAGES ]:
161+ elif genre in [ProtocolCode .GET_JOINT_MAX_ANGLE , ProtocolCode .GET_JOINT_MIN_ANGLE ]:
162+ return self ._int2coord (res [0 ])
163+ elif genre in [ProtocolCode .GET_SERVO_VOLTAGES , ProtocolCode .COLLISION ]:
144164 return [self ._int2coord (angle ) for angle in res ]
145165 else :
146166 return res
0 commit comments