class SerialDobotCalibrator(object): def __init__(self, port): self.dobot = Dobot(port, DEFAULT_BAUDRATE) def get_position(self): pose = self.dobot.get_pose() return {'x': pose['x'], 'y': pose['y'], 'z': pose['z']} def initialize(self): self.dobot.initialize()
def __init__(self, port): self.dobot = Dobot(port, DEFAULT_BAUDRATE)
def get_dobot(port): logging.info( 'Opening serial port {} to communicate with dobot.'.format(port)) return Dobot(port, DEFAULT_BAUDRATE)
self.dobot = dobot def do_init(self, _): print("initializing dobot") self.dobot.initialize() self.dobot.wait() def do_move(self, line): print(line) args = line.split(' ') self.dobot.move(float(args[0]), float(args[1]), float(args[2])) def do_lmove(self, line): print(line) args = line.split(' ') self.dobot.linear_move(float(args[0]), float(args[1]), float(args[2])) def do_getpose(self, _): print(self.dobot.get_pose()) # todo: キャリブレーション用コマンド def do_EOF(self, _): self.dobot.close() return True if __name__ == '__main__': c = DobotCUI(Dobot('/dev/ttyUSB0', DEFAULT_BAUDRATE)) c.cmdloop()
class SerialDobotCalibrator(object): def __init__(self, port): self.dobot = Dobot(port, DEFAULT_BAUDRATE) def get_position(self): pose = self.dobot.get_pose() return {'x': pose['x'], 'y': pose['y'], 'z': pose['z']} def get_rotation(self): pose = self.dobot.get_pose() return {'r': pose['r']} def initialize(self): self.dobot.initialize() def wait(self): self.dobot.wait() def move(self, x, y, z=0, r=0): self.dobot.move(x, y, z, r) def grip(self, on): self.dobot.grip(on) def pump(self, on): self.dobot.pump(on) def rotate_gripper(self, delta): pose = self.dobot.get_pose() self.dobot.adjust_r(pose['r'] + delta)