def TestReadOnly():
    servos = LX16AServos()
    tester = SmartServoManager(lX16AServos=servos)
    tester.AddMasterServo(servoId=5)
    tester.SetReadOnly(servoId=5, isReadOnly=True)
    tester.Start()
    while (True):
        value = tester.ReadServo(5)
        print(value)
        time.sleep(1)
def TestReadSpeed():
    servos = LX16AServos()
    tester = SmartServoManager(lX16AServos=servos)
    tester.AddMasterServo(servoId=1)
    tester.SetReadOnly(servoId=1, isReadOnly=True)
    tester.AddMasterServo(servoId=2)
    tester.SetReadOnly(servoId=2, isReadOnly=True)
    tester.AddMasterServo(servoId=3)
    tester.SetReadOnly(servoId=3, isReadOnly=True)
    tester.Start()
    while (True):
        value = tester.ReadServo(1)
def TestSlave():
    servos = LX16AServos()
    tester = SmartServoManager(lX16AServos=servos, ramp=0, maxSpeed=1)
    tester.AddMasterServo(servoId=5)
    tester.AddSlaveServo(servoId=6, masterServoId=5, reverseToMaster=-1)
    tester.Start()

    plus = 100

    while (True):
        plus = -plus
        tester.MoveServo(5, 500 + plus)
        while (tester.allTargetsReached == False):
            time.sleep(0.1)
Beispiel #4
0
    def __init__(self):
        self._servos = LX16AServos()
        self._servoManager = SmartServoManager(lX16AServos=self._servos,
                                               ramp=0,
                                               maxSpeed=1)
        self._arms = Arms(self._servoManager)
        self._neck = Neck(self._servoManager)
        self._servoManager.Start()
        self._neck.SetLeftRight(0)
        self._neck.SetUpDown(0)

        self._bodyLeds = RgbLeds([
            my_path + '/../Gfx/Body/hearth2.gif',
            my_path + '/../../RoobertGifs/e8nZC.gif',
            my_path + '/../../RoobertGifs/U9LwW86.gif',
            my_path + '/../../RoobertGifs/Spin_Toad.gif',
            my_path + '/../../RoobertGifs/haleye.gif',
            my_path + '/../../RoobertGifs/Yoshi_render.gif'
        ])
Beispiel #5
0
        self.Release()


def exit_handler():
    tester.Release()
    servoManager.Release()
    servos.Release()


if __name__ == "__main__":

    atexit.register(exit_handler)

    ended = False

    servos = LX16AServos()
    servoManager = SmartServoManager(lX16AServos=servos, ramp=0, maxSpeed=1)
    tester = Arms(servoManager)
    #tester.MirrorRightArmToLeft();

    #tester.PrintRightArmValues()
    tester.PrintLeftArmValues()

    servoManager.Start()
    #time.sleep(1);
    #tester.SetArm(gesture=Arms._rightCenteredValues, left=True);
    #tester.WaitTillTargetsReached();

    #while(True):
    #	print()
def bigTest():
    ended = False
    servos = LX16AServos()
    tester = SmartServoManager(
        lX16AServos=servos,
        servoIds=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
        ramp=0,
        maxSpeed=1)
    tester.SetMaxStepsPerUpdate(5, 2)
    tester.SetMaxStepsPerUpdate(6, 3)

    armHanging = [[1, 151], [2, 168], [3, 455], [4, 613], [5, 471], [6, 550]]
    wink1 = [[1, 374], [2, 451], [3, 693], [4, 816], [5, 565]]
    wink2 = [[1, 192], [2, 678], [3, 888], [4, 872], [5, 509]]
    strechSide = [[1, 299], [2, 249], [3, 663], [4, 660], [5, 848]]
    lookHand = [[1, 592], [2, 90], [3, 361], [4, 787], [5, 795]]
    ghettoFist1 = [[1, 105], [2, 140], [3, 525], [4, 910], [5, 116], [6, 420]]
    ghettoFist2 = [[1, 339], [2, 138], [3, 525], [4, 753], [5, 116], [6, 420]]

    closeHand = [[6, 420]]
    openHand = [[6, 550]]

    lookRightHand = [[13, 500 - 150], [14, 500 + 150], [15, 500 - 250]]
    lookFront = [[13, 500], [14, 500], [15, 500]]

    #tester.MoveServo(4,613);

    #while(True):
    if (True):

        tester.MoveToAndWait(lookFront + armHanging)
        time.sleep(1)

        tester.MoveToAndWait(openHand)
        tester.MoveToAndWait(closeHand)

        tester.MoveToAndWait(strechSide + lookRightHand)
        tester.MoveToAndWait(openHand)
        time.sleep(2)

        for wink in range(0, 1):
            tester.MoveToAndWait(wink1)
            tester.MoveToAndWait(wink2)

        tester.MoveToAndWait(armHanging)
        time.sleep(1)

        tester.MoveToAndWait(strechSide)
        time.sleep(2)

        tester.MoveToAndWait(armHanging)
        time.sleep(1)

    tester.MoveToAndWait(ghettoFist1)
    tester.MoveToAndWait(ghettoFist2)
    tester.MoveToAndWait(ghettoFist1)

    tester.MoveToAndWait(armHanging)
    time.sleep(2)

    tester.Release()
    print("done")