update calibration

master
Zhengyu Peng 3 years ago
parent 5fa1b2f048
commit 75a8af655a

@ -41,36 +41,20 @@ class Hexapod:
self.leg_4 = Leg('cl', self.leg_4 = Leg('cl',
[self.pca_right.servo[7], self.pca_right.servo[6], [self.pca_right.servo[7], self.pca_right.servo[6],
self.pca_right.servo[8]], self.pca_right.servo[8]],
correction=[-6, 0, 0]) correction=[-6, 2, 0])
# rear left # rear left
self.leg_5 = Leg('rl', self.leg_5 = Leg('rl',
[self.pca_right.servo[0], self.pca_right.servo[13], [self.pca_right.servo[0], self.pca_right.servo[13],
self.pca_right.servo[14]], self.pca_right.servo[14]],
correction=[-6, 4, 0]) correction=[-6, 4, 0])
self.leg_0.set_angle(0, 90) self.leg_0.reset()
self.leg_0.set_angle(1, 90) self.leg_1.reset()
self.leg_0.set_angle(2, 90) self.leg_2.reset()
self.leg_3.reset()
self.leg_4.reset()
self.leg_5.reset()
self.leg_1.set_angle(0, 90)
self.leg_1.set_angle(1, 90)
self.leg_1.set_angle(2, 90)
self.leg_2.set_angle(0, 90)
self.leg_2.set_angle(1, 90)
self.leg_2.set_angle(2, 90)
self.leg_3.set_angle(0, 90)
self.leg_3.set_angle(1, 90)
self.leg_3.set_angle(2, 90)
self.leg_4.set_angle(0, 90)
self.leg_4.set_angle(1, 90)
self.leg_4.set_angle(2, 90)
self.leg_5.set_angle(0, 90)
self.leg_5.set_angle(1, 90)
self.leg_5.set_angle(2, 90)
def main(): def main():

@ -16,3 +16,8 @@ class Leg:
angle+self.correction[junction], self.constraint[junction][1]) angle+self.correction[junction], self.constraint[junction][1])
set_angle = max(set_angle, self.constraint[junction][0]) set_angle = max(set_angle, self.constraint[junction][0])
self.junction_servos[junction].angle = set_angle self.junction_servos[junction].angle = set_angle
def reset(self):
self.set_angle(0, 90)
self.set_angle(1, 90)
self.set_angle(2, 90)
Loading…
Cancel
Save