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