Beispiel #1
0
 def __init__(self):
     self.kit = adafruit_servokit.ServoKit(channels=16)
     self.camera_range = [115, 30] # maps to [0 45]
     self.joint1_range = [180, 0] # maps to [-90 90]
     self.joint2_range = [0, 170] # maps to [-90 90]
     self.joint3_range = [0, 180] # maps to [-90 90]
     self.gripper_range = [50, 0] # maps to [0, 1.5] in
Beispiel #2
0
 def __init__(self):
   self.kit = adafruit_servokit.ServoKit(channels=16)
Beispiel #3
0
 def __init__(self, num_ports):
     print("Initializing the servo...")
     self.kit = adafruit_servokit.ServoKit(channels=16)
     self.num_ports = num_ports
     self.resetAll()
     print("Initializing complete.")
Beispiel #4
0
def main():
    print("Ready")
    kit = adafruit_servokit.ServoKit(channels=16)
    servo_pin = 13
    servo_sweep(kit, servo_pin)
    servo_angle(kit, servo_pin)
import adafruit_servokit
index = 0
angleTranslation = [[90,1],[90,1],[130,1],[40,1],[90,1],[0,1]]
angles = [0, 70, -50, 90, -80, 0]
park = [0,0,20,-10,0,70]
limits = [[0,180],[0,180],[0,180],[0,180],[0,180],[0,70]]
limits2 = [[-90,90],[-90,90],[-130,150],[-40,120],[-90,90],[0,70]]
kit = adafruit_servokit.ServoKit(channels = 16)
def switchServo(direction):
    global index
    if index + direction > 5:
        index = 0
    elif index + direction <0:
        index = 5
    else:
        index += direction
    
def parkArm():
        parkAngles = park
        for i in range(6):
            target = translateAngle(i,parkAngles[i])
            try:
                kit.servo[i].angle = target
            except ValueError:
                print(f"out of range: {target} Servo: {i}")
def setAngles():
        parkAngles = angles
        for i in range(6):
            target = translateAngle(i,parkAngles[i])
            try:
                kit.servo[i].angle = target