Update hexapod.py

master
Zhengyu Peng 3 years ago
parent a41643aa4d
commit 2784d496e2

@ -110,8 +110,8 @@ class Hexapod(Thread):
self.mount_position[:, 1] = self.mount_y self.mount_position[:, 1] = self.mount_y
# Objects # Objects
self.pca_right = ServoKit(channels=16, address=0x40, frequency=50) self.pca_right = ServoKit(channels=16, address=0x40, frequency=120)
self.pca_left = ServoKit(channels=16, address=0x41, frequency=50) self.pca_left = ServoKit(channels=16, address=0x41, frequency=120)
# front right # front right
self.leg_0 = Leg(0, self.leg_0 = Leg(0,
@ -238,7 +238,7 @@ class Hexapod(Thread):
self.leg_2.move_junctions(angles[2, :]) self.leg_2.move_junctions(angles[2, :])
self.leg_3.move_junctions(angles[3, :]) self.leg_3.move_junctions(angles[3, :])
time.sleep(self.interval) # time.sleep(self.interval)
def motion(self, path): def motion(self, path):
for p_idx in range(0, np.shape(path)[0]): for p_idx in range(0, np.shape(path)[0]):
@ -258,7 +258,7 @@ class Hexapod(Thread):
cmd_string = self.cmd_queue.get(block=False) cmd_string = self.cmd_queue.get(block=False)
print('interrput') print('interrput')
except Empty: except Empty:
time.sleep(self.interval) # time.sleep(self.interval)
pass pass
else: else:
self.cmd_handler(cmd_string) self.cmd_handler(cmd_string)
@ -308,7 +308,7 @@ class Hexapod(Thread):
try: try:
cmd_string = self.cmd_queue.get(block=False) cmd_string = self.cmd_queue.get(block=False)
except Empty: except Empty:
time.sleep(self.interval) # time.sleep(self.interval)
pass pass
else: else:
self.cmd_handler(cmd_string) self.cmd_handler(cmd_string)

Loading…
Cancel
Save