def foo_suck_3(self): time.sleep(0.1) # command = bytes([0xAA, 0xAA, 4, 131, 0x03, self.checksum]) command = Message() command.len = 2 + 2 command.id = 131 command.params = bytes([0x12, 0x00]) command.header = bytes([0xAA, 0xAA]) command.ctrl = 0x03 print(command.bytes()) # command.checksum = None self.ser.write(command.bytes())
def _set_end_effector_suction_cup(self, suck=False): msg = Message() msg.id = 62 msg.ctrl = 0x03 msg.params = bytearray([]) msg.params.extend(bytearray([0x01])) if suck is True: msg.params.extend(bytearray([0x01])) else: msg.params.extend(bytearray([0x00])) print(msg.bytes()) return self._send_command(msg)
def _set_ptp_cmd(self, x, y, z, r, mode): msg = Message() msg.id = 84 msg.ctrl = 0x03 msg.params = bytearray([]) msg.params.extend(bytearray([mode])) msg.params.extend(bytearray(struct.pack('f', x))) msg.params.extend(bytearray(struct.pack('f', y))) msg.params.extend(bytearray(struct.pack('f', z))) msg.params.extend(bytearray(struct.pack('f', r))) print(msg.bytes()) return self._send_command(msg)