master
Zhengyu Peng 3 years ago
parent f5269f214b
commit a8590f3e18

@ -95,32 +95,39 @@ class Hexapod:
self.leg_0 = Leg(0,
[self.pca_left.servo[15], self.pca_left.servo[2],
self.pca_left.servo[1]],
correction=[-6, 4, -4])
correction=[4, 4, 4])
# center right
self.leg_1 = Leg(1,
[self.pca_left.servo[7], self.pca_left.servo[8],
self.pca_left.servo[6]],
correction=[3, -5, -6])
correction=[0, 8, -6])
# rear right
self.leg_2 = Leg(2,
[self.pca_left.servo[0], self.pca_left.servo[14],
self.pca_left.servo[13]],
correction=[3, -6, -5])
correction=[8, 6, -1])
# rear left
self.leg_3 = Leg(3,
[self.pca_right.servo[15], self.pca_right.servo[1],
self.pca_right.servo[2]],
correction=[-3, -4, 6])
correction=[-5, 8, -6])
# center left
self.leg_4 = Leg(4,
[self.pca_right.servo[7], self.pca_right.servo[6],
self.pca_right.servo[8]],
correction=[-6, 2, 0])
correction=[-8, 2, -1])
# front left
self.leg_5 = Leg(5,
[self.pca_right.servo[0], self.pca_right.servo[13],
self.pca_right.servo[14]],
correction=[-6, 4, 0])
correction=[0, 0, -8])
# self.leg_0.reset(True)
# self.leg_1.reset(True)
# self.leg_2.reset(True)
# self.leg_3.reset(True)
# self.leg_4.reset(True)
# self.leg_5.reset(True)
self.standby_coordinate = self.calculate_standby_coordinate(60, 75)
self.forward_path = gen_forward_path(self.standby_coordinate)

@ -53,7 +53,12 @@ class Leg:
self.set_angle(1, angles[1])
self.set_angle(2, angles[2])
def reset(self):
def reset(self, calibrated=False):
if calibrated:
self.set_angle(0, 90)
self.set_angle(1, 90)
self.set_angle(2, 90)
else:
self.set_raw_angle(0, 90)
self.set_raw_angle(1, 90)
self.set_raw_angle(2, 90)

Loading…
Cancel
Save