shoulder_4 = RightShoulder(right_pwm, 0) elbow_4 = RightElbow(right_pwm, 1) wrist_4 = RightWrist(right_pwm, 2) arm_4 = Arm(shoulder_4, elbow_4, wrist_4) shoulder_5 = RightShoulder(right_pwm, 4) elbow_5 = RightElbow(right_pwm, 5) wrist_5 = RightWrist(right_pwm, 6) arm_5 = Arm(shoulder_5, elbow_5, wrist_5) shoulder_6 = RightShoulder(right_pwm, 8) elbow_6 = RightElbow(right_pwm, 9) wrist_6 = RightWrist(right_pwm, 10) arm_6 = Arm(shoulder_6, elbow_6, wrist_6) hexapod = Hexapod(arm_1, arm_2, arm_3, arm_4, arm_5, arm_6) def left_shoulder_min(): shoulder_1.move_min() shoulder_2.move_min() shoulder_3.move_min() def left_shoulder_max(): shoulder_1.move_max() shoulder_2.move_max() shoulder_3.move_max() def left_elbow_min(): elbow_1.move_min() elbow_2.move_min() elbow_3.move_min()
from robot import Hexapod from time import sleep hexy = Hexapod() print("lie flat, curl up, then get up") hexy.boot_up() hexy.rest() print "rotate left" hexy.rotate(offset = 40) hexy.rest() print "rotate right" hexy.rotate(offset = -40) hexy.rest() print "walk forward" hexy.walk(offset = 25, swing = 25) hexy.rest() print "walk backward" hexy.walk(offset = 25, swing = -25) hexy.rest() print "lie down, lie flat, and die" hexy.shut_down()
import time from Adafruit_PWM_Servo_Driver import PWM from robot import Shoulder, Elbow, Wrist, Arm, Hexapod sleep_time = 5 left_pwm = PWM(0x40, debug=True) left_pwm.setPWMFreq(60) shoulder_1 = Shoulder(left_pwm, 0) elbow_1 = Elbow(left_pwm, 1) wrist_1 = Wrist(left_pwm, 2) arm_1 = Arm(shoulder_1, elbow_1, wrist_1) hexapod = Hexapod(arm_1, None, None, None, None, None) while True: hexapod.forward() time.sleep(sleep_time)
from robot import Hexapod from time import sleep hexy = Hexapod() hexy.boot_up() hexy.rest() hexy.shake_head() hexy.rest() hexy.point(s = 0.75) hexy.rest() hexy.type_stuff() hexy.rest() hexy.twist_hip_slowly() hexy.rest() hexy.wave() hexy.rest() hexy.tilt_left_and_right() hexy.rest() hexy.tilt_front_and_back() hexy.rest() hexy.dance_tilt_ccw()
from robot import Hexapod from time import sleep def calibrate_joint(joint, s, mn, mx, z): while True: for angle in [mn, z, mx, z]: joint.move(angle) sleep(s) hexy = Hexapod() #calibrate_joint( hexy.right_back.knee, s = 2, mn = -45, mx = 45, z =0) hexy.off()