|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
#!python
|
|
|
|
|
#!/usr/bin/python3
|
|
|
|
|
#
|
|
|
|
|
# 2021 - PRESENT Zhengyu Peng
|
|
|
|
|
# Website: https://zpeng.me
|
|
|
|
@ -116,39 +116,39 @@ class Hexapod(Thread):
|
|
|
|
|
self.mount_position[:, 1] = self.mount_y
|
|
|
|
|
|
|
|
|
|
# Objects
|
|
|
|
|
self.pca_right = ServoKit(channels=18, address="/dev/ttyACM0", frequency=0x0c)
|
|
|
|
|
self.pca_left = ServoKit(channels=18, address="/dev/ttyACM0", frequency=0x0d)
|
|
|
|
|
self.pca_right = ServoKit(channels=18, address="/dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4:1.0", frequency=0x0c)
|
|
|
|
|
self.pca_left = ServoKit(channels=18, address="/dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3:1.0", frequency=0x0d)
|
|
|
|
|
#self.pca_left = self.pca_right
|
|
|
|
|
self.legs = [
|
|
|
|
|
# front right
|
|
|
|
|
Leg(0,
|
|
|
|
|
[self.pca_left.servo[2], self.pca_left.servo[1],
|
|
|
|
|
self.pca_left.servo[0]],
|
|
|
|
|
[self.pca_left.servo[0], self.pca_left.servo[1],
|
|
|
|
|
self.pca_left.servo[2]],
|
|
|
|
|
correction=self.config.get('leg0Offset', [0, 0, 0]), scale=self.config.get('leg0Scale', [1, 1, 1])),
|
|
|
|
|
# center right
|
|
|
|
|
Leg(1,
|
|
|
|
|
[self.pca_left.servo[8], self.pca_left.servo[7],
|
|
|
|
|
self.pca_left.servo[6]],
|
|
|
|
|
[self.pca_left.servo[3], self.pca_left.servo[4],
|
|
|
|
|
self.pca_left.servo[5]],
|
|
|
|
|
correction=self.config.get('leg1Offset', [0, 0, 0]), scale=self.config.get('leg1Scale', [1, 1, 1])),
|
|
|
|
|
# rear right
|
|
|
|
|
Leg(2,
|
|
|
|
|
[self.pca_left.servo[14], self.pca_left.servo[13],
|
|
|
|
|
self.pca_left.servo[12]],
|
|
|
|
|
[self.pca_left.servo[6], self.pca_left.servo[7],
|
|
|
|
|
self.pca_left.servo[8]],
|
|
|
|
|
correction=self.config.get('leg2Offset', [0, 0, 0]), scale=self.config.get('leg2Scale', [1, 1, 1])),
|
|
|
|
|
# rear left
|
|
|
|
|
Leg(3,
|
|
|
|
|
[self.pca_right.servo[17], self.pca_right.servo[16],
|
|
|
|
|
self.pca_right.servo[15]],
|
|
|
|
|
[self.pca_right.servo[6], self.pca_right.servo[7],
|
|
|
|
|
self.pca_right.servo[8]],
|
|
|
|
|
correction=self.config.get('leg3Offset', [0, 0, 0]), scale=self.config.get('leg3Scale', [1, 1, 1])),
|
|
|
|
|
# center left
|
|
|
|
|
Leg(4,
|
|
|
|
|
[self.pca_right.servo[11], self.pca_right.servo[10],
|
|
|
|
|
self.pca_right.servo[9]],
|
|
|
|
|
[self.pca_right.servo[3], self.pca_right.servo[4],
|
|
|
|
|
self.pca_right.servo[5]],
|
|
|
|
|
correction=self.config.get('leg4Offset', [0, 0, 0]), scale=self.config.get('leg4Scale', [1, 1, 1])),
|
|
|
|
|
# front left
|
|
|
|
|
Leg(5,
|
|
|
|
|
[self.pca_right.servo[5], self.pca_right.servo[4],
|
|
|
|
|
self.pca_right.servo[3]],
|
|
|
|
|
[self.pca_right.servo[0], self.pca_right.servo[1],
|
|
|
|
|
self.pca_right.servo[2]],
|
|
|
|
|
correction=self.config.get('leg5Offset', [0, 0, 0]), scale=self.config.get('leg5Scale', [1, 1, 1]))]
|
|
|
|
|
|
|
|
|
|
# self.leg_0.reset(True)
|
|
|
|
|