Exemple #1
0
def initMotors():
    global servos
    MAXANGLE = 850
    MINANGLE = 310
    #initialize servos
    servos = ax12.Ax12()
    #set max min angles in the motors
    for mt in range (1, 6+1):
        if(mt%2==1):
            servos.setAngleLimit(mt, MINANGLE, MAXANGLE)
        else:
            servos.setAngleLimit(mt, 1024-MAXANGLE, 1024-MINANGLE)
        #need to sleep between each command
        sleep(0.05)

    p = 800
    for i in range(2):
        for mt in range(1,6+1):
            #even motors now doesn't change
            pp = p if mt%2==1 else 1024-p
            servos.moveSpeedRW(mt,pp,250)
            sleep(0.01)
        servos.action()
        p = 1320 - p
        sleep(3.7)
Exemple #2
0
def initMotors():
    global servos

    servos = ax12.Ax12()
    p = 800
    for i in range(2):
        for mt in range(1, 6 + 1):
            pp = p if mt % 2 == 0 else 1024 - p
            servos.moveSpeedRW(mt, pp, 450)
            sleep(0.01)
        servos.action()
        p = 1320 - p
        sleep(3.7)
Exemple #3
0
GPIO.setup(26, GPIO.IN)
GPIO.setup(12, GPIO.IN)
GPIO.setup(16, GPIO.IN)
GPIO.setup(20, GPIO.IN)

# - - - - - - - - - - - - - - - -
# - - - GLOBAL OBJECTS  - - - - -
# - - - - - - - - - - - - - - - -

jD = JsonDump()

imageProObj = ImPro()

spi = spidev.SpiDev()
spi.open(0, 0)
servos = ax12.Ax12()
switchObj = SwitchObj()

servoHandlerObj = [0]
servoHandlerObj.append(servoHandler(1, 500, servos))
servoHandlerObj.append(servoHandler(2, 500, servos))
servoHandlerObj.append(servoHandler(3, 500, servos))
servoHandlerObj.append(servoHandler(4, 500, servos))


# - - - - - - - - - - - - - - - -
# - CHECK MOVE DEMANDED FLAGS - -
# - - - - - - - - - - - - - - - -
def checkMoveDemandedFlags(servoID):
    controlBit = False
    for i in range(len(servoID)):
Exemple #4
0
def servoSetup():
    global servo
    servo = ax12.Ax12()
    servo.__init__()
    print "hola"
    servo.setLedStatus(1, 0)
Exemple #5
0
def servoSetup():
    global servo
    servo = ax12.Ax12()
    servo.__init__()

    servo.setLedStatus(1, 1)