From 75a8af655aa9d82d1ad909580c38252a6347b0fc Mon Sep 17 00:00:00 2001 From: Zhengyu Peng Date: Tue, 7 Dec 2021 21:45:49 -0500 Subject: [PATCH] update calibration --- software/rpi/hexapod.py | 30 +++++++----------------------- software/rpi/leg.py | 5 +++++ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/software/rpi/hexapod.py b/software/rpi/hexapod.py index 1505b49..331bfbd 100644 --- a/software/rpi/hexapod.py +++ b/software/rpi/hexapod.py @@ -41,36 +41,20 @@ class Hexapod: self.leg_4 = Leg('cl', [self.pca_right.servo[7], self.pca_right.servo[6], self.pca_right.servo[8]], - correction=[-6, 0, 0]) + correction=[-6, 2, 0]) # rear left self.leg_5 = Leg('rl', [self.pca_right.servo[0], self.pca_right.servo[13], self.pca_right.servo[14]], correction=[-6, 4, 0]) - self.leg_0.set_angle(0, 90) - self.leg_0.set_angle(1, 90) - self.leg_0.set_angle(2, 90) + self.leg_0.reset() + self.leg_1.reset() + 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(): diff --git a/software/rpi/leg.py b/software/rpi/leg.py index 836f2a2..d2f8f87 100644 --- a/software/rpi/leg.py +++ b/software/rpi/leg.py @@ -16,3 +16,8 @@ class Leg: angle+self.correction[junction], self.constraint[junction][1]) set_angle = max(set_angle, self.constraint[junction][0]) 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) \ No newline at end of file