From bb9a1f13192b086d66995332848f752d8420202e Mon Sep 17 00:00:00 2001 From: Zhengyu Peng Date: Tue, 7 Dec 2021 13:23:41 -0500 Subject: [PATCH] flip front and back --- software/rpi/hexapod.py | 66 +++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/software/rpi/hexapod.py b/software/rpi/hexapod.py index 5273cac..a1a1dfa 100644 --- a/software/rpi/hexapod.py +++ b/software/rpi/hexapod.py @@ -17,46 +17,66 @@ class Hexapod: self.pca_right = ServoKit(channels=16, address=0x40, frequency=120) self.pca_left = ServoKit(channels=16, address=0x41, frequency=120) - # front right - self.leg_0 = Leg('fr', - [self.pca_right.servo[15], self.pca_right.servo[1], - self.pca_right.servo[2]], + # rear right + self.leg_0 = Leg('rr', + [self.pca_left.servo[15], self.pca_left.servo[2], + self.pca_left.servo[1]], correction=[0, 0, 0], constraint=[0, 180]) # center right self.leg_1 = Leg('cr', - [self.pca_right.servo[7], self.pca_right.servo[6], - self.pca_right.servo[8]], + [self.pca_left.servo[7], self.pca_left.servo[8], + self.pca_left.servo[6]], correction=[0, 0, 0], constraint=[0, 180]) - # rear right - self.leg_2 = Leg('rr', - [self.pca_right.servo[0], self.pca_right.servo[13], - self.pca_right.servo[14]], + # front right + self.leg_2 = Leg('fr', + [self.pca_left.servo[0], self.pca_left.servo[14], + self.pca_left.servo[13]], correction=[0, 0, 0], constraint=[0, 180]) - # rear left - self.leg_3 = Leg('rl', - [self.pca_left.servo[15], self.pca_left.servo[2], - self.pca_left.servo[1]], + # front left + self.leg_3 = Leg('fl', + [self.pca_right.servo[15], self.pca_right.servo[1], + self.pca_right.servo[2]], correction=[0, 0, 0], constraint=[0, 180]) # center left self.leg_4 = Leg('cl', - [self.pca_left.servo[7], self.pca_left.servo[8], - self.pca_left.servo[6]], + [self.pca_right.servo[7], self.pca_right.servo[6], + self.pca_right.servo[8]], correction=[0, 0, 0], constraint=[0, 180]) - # front left - self.leg_5 = Leg('fl', - [self.pca_left.servo[0], self.pca_left.servo[14], - self.pca_left.servo[13]], + # rear left + self.leg_5 = Leg('rl', + [self.pca_right.servo[0], self.pca_right.servo[13], + self.pca_right.servo[14]], correction=[0, 0, 0], constraint=[0, 180]) - self.leg_5.set_angle(0, 45) - self.leg_5.set_angle(1, 45) - self.leg_5.set_angle(2, 45) + self.leg_0.set_angle(0, 90) + self.leg_0.set_angle(1, 90) + self.leg_0.set_angle(2, 90) + + 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():