Exemple #1
0
    def __init__(self):
        self.targetAngle = [0]*6
        self.currentAngle = [0]*6
        self.currentSpeed = [0]*6
        self.maxSpeed = [0]*6
        self.currentScanDirection = [1]*3
        self.currentSpeedLimit = StewartPlatform.SERVO_SPEED_LIMIT
        self.servos = Ax12()
        self.angles = StewartPlatformMath()
        self.currentPosition = PlatformPosition()
        self.lastPosition = PlatformPosition()
        self.updateFunction = self.updateLinear

        ## add angle limits to servo motors
        for i in range(6):
            if (i%2==0):
                self.servos.setAngleLimit((i+1),
                                          StewartPlatform.SERVO_MIN_ANGLE_VALUE,
                                          StewartPlatform.SERVO_MAX_ANGLE_VALUE)
            else:
                self.servos.setAngleLimit((i+1),
                                          1024-StewartPlatform.SERVO_MAX_ANGLE_VALUE,
                                          1024-StewartPlatform.SERVO_MIN_ANGLE_VALUE)
            sleep(0.1)

        ## initially set platform to (0,0,0), (0,0,0)
        self.setTargetAnglesSuccessfully()

        ## move motors to initial position
        for (i,targetAngle) in enumerate(self.targetAngle):
            self.currentAngle[i] = targetAngle
            servoValue = StewartPlatform.getServoAngleValue(i, self.currentAngle[i])
            self.servos.moveSpeedRW((i+1), servoValue, 450)
        self.servos.action()
        sleep(1)
Exemple #2
0
    def __init__(self):

        self.ts = TouchSensorArduino()

        self.arm = Ax12()
        self.setHome()
        self.runMapping()
Exemple #3
0
def goHome():
    s = Ax12()
    home = [
        502, 607, 512, 531, 514, 511, 820, 530, 552, 518, 512, 532, 537, 563,
        559, 513, 529, 561, 558, 502, 568, 552, 546, 504
    ]
    for i in range(len(home)):
        s.move(i + 1, home[i])
        time.sleep(1)
Exemple #4
0
def goHome():
    s = Ax12()
    home = [
        539, 0, 646, 147, 472, 552, 866, 182, 386, 610, 627, 232, 555, 491,
        348, 347, 497, 534, 468, 267, 464, 562, 573, 253
    ]
    for i in range(len(home)):
        s.move(i + 1, home[i])
        time.sleep(1)
Exemple #5
0
    def __init__(self):
        self.targetAngle = [0] * 6
        self.currentAngle = [0] * 6
        self.currentSpeed = [0] * 6
        self.maxSpeed = [0] * 6
        self.currentScanDirection = [1] * 3
        self.currentSpeedLimit = StewartPlatform.SERVO_SPEED_LIMIT
        self.servos = Ax12()
        self.angles = StewartPlatformMath()
        self.currentPosition = PlatformPosition()
        self.lastPosition = PlatformPosition()
        self.updateFunction = self.updateLinear

        self.setTargetAnglesSuccessfully()

        for (i, targetAngle) in enumerate(self.targetAngle):
            self.currentAngle[i] = targetAngle
            servoValue = StewartPlatform.getServoAngleValue(
                i, self.currentAngle[i])
            self.servos.moveSpeedRW((i + 1), servoValue, 450)
        self.servos.action()
        sleep(1)
Exemple #6
0
from ax12 import Ax12
from time import sleep

self = Ax12()
servonummer = 3

x = 0
while (x < 254):
    self.factoryReset(x, True)
    x = x + 1
    print(x)
    sleep(0.05)

self.setID(1, servonummer)

#self.move(servonummer,1000)
Exemple #7
0
from ax12 import Ax12
from time import sleep

servo = Ax12()
speed = 500
startStand = 450
endStand = 550
startID = 1
endID = 18

stand = startStand
id = startID
while (1):
    while (id <= endID):
        servo.move(id, stand)
        print('moved ' + str(id))
        sleep(0.04)
        id = id + 1
    id = startID
    if (stand == endStand):
        stand = startStand
    else:
        stand = endStand
Exemple #8
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-

from sys import argv, path
from time import sleep

path.append("../ax12")
from ax12 import Ax12

if __name__ == "__main__":
    mServos = Ax12()

    if len(argv) > 1:
        motorId = argv[1]
        for i in range(254):
            sleep(100)
            try:
                mServos.setID(i, motorId)
            except:
                print("error resetting id from "+str(i)+" to "+str(motorId))
            else:
                print("set id to "+str(motorId))
                exit(1)
    else:
        print("ERROR")
        print("usage: python setMotorId motorNumber")
Exemple #9
0
## -*- coding: utf-8 -*-
## Rodar os seguintes códigos
##   sudo systemctl stop [email protected]
##   sudo systemctl disable [email protected]

from ax12 import Ax12
#from Bioloid import BIOLOID
#import sys
import time

#robot = BIOLOID()
m = Ax12()

m.move(2,512)
time.sleep(2)
m.readPosition(2)
time.sleep(2)
m.readPosition(4)
time.sleep(2)
m.readPosition(6)

#robot.clear();
#time.sleep(2);
#robot.initialPos();
##
##while True:
##
##    i = 1;
##    
##    while i<14.7:
##                 
Exemple #10
0
# coding: utf-8
#Thassilo Bücker, Alexander Orzol
#Campus Velbert/Heiligenhaus, Hochschule Bochum, 2016/2017

#Das Programm stellt Funktionen zum Tasten zur Verfügung   

cWalkingSpeed = 150
cSyncSpeed = False

##### Imports #########################
from IKfunction import *
from ax12 import Ax12
import time
from fernbed import *

servos = Ax12()
#Init()

def Inittasten():
	#Initialposition zum Tasten / mittleren Beine vorne, vordere Beine oben 
	start= [412,612,412,612,767,255,575,449,400,624,767,255,350,674,400,624,767,255]
	for i in xrange(0,18):
		if not(i==0 or i==1):
			try:
				servos.move(i+1,start[i])
			except:
				print ("Servo move failed")
				i -= 1

def Vorderbeinefuehlen():
	# Mit den Vorderbeinen wird geprüft ob sich ein Hindernis vor ihm befindet	
Exemple #11
0
from ax12 import Ax12
import sys
import time

motors = Ax12()


class BIOLOID:
    def initialPos(self):
        motors.move(1, 336)
        motors.move(2, 687)
        motors.move(3, 298)
        motors.move(4, 724)
        motors.move(5, 412)
        motors.move(6, 611)
        motors.move(7, 355)
        motors.move(8, 664)
        motors.move(9, 491)
        motors.move(10, 530)
        motors.move(11, 394)
        motors.move(12, 625)
        motors.move(13, 278)
        motors.move(14, 743)
        motors.move(15, 616)
        motors.move(16, 405)
        motors.move(17, 490)
        motors.move(18, 530)

    def clear(self):
        motors.move(1, 512)
        motors.move(2, 512)
Exemple #12
0
def goHome():
    s = Ax12()
    for i in range(24):
        print(s.readPosition(i + 1))