diff --git a/software/rpi/hexapod.py b/software/rpi/hexapod.py index aca37ec..d7ddd0d 100644 --- a/software/rpi/hexapod.py +++ b/software/rpi/hexapod.py @@ -90,18 +90,18 @@ class Hexapod: correction=[-6, 4, 0]) self.standby_coordinate = self.calculate_standby_coordinate(60, 75) - self.forward_path = gen_forward_path() - self.backward_path = gen_backward_path() - self.fastforward_path = gen_fastforward_path() - self.fastbackward_path = gen_fastbackward_path() + self.forward_path = gen_forward_path(self.standby_coordinate) + self.backward_path = gen_backward_path(self.standby_coordinate) + self.fastforward_path = gen_fastforward_path(self.standby_coordinate) + self.fastbackward_path = gen_fastbackward_path(self.standby_coordinate) - self.leftturn_path = gen_leftturn_path() - self.rightturn_path = gen_rightturn_path() + self.leftturn_path = gen_leftturn_path(self.standby_coordinate) + self.rightturn_path = gen_rightturn_path(self.standby_coordinate) - self.shiftleft_path = gen_shiftleft_path() - self.shiftright_path = gen_shiftright_path() + self.shiftleft_path = gen_shiftleft_path(self.standby_coordinate) + self.shiftright_path = gen_shiftright_path(self.standby_coordinate) - self.climb_path = gen_climb_path() + self.climb_path = gen_climb_path(self.standby_coordinate) self.rotatex_path = gen_rotatex_path(self.standby_coordinate) self.rotatey_path = gen_rotatey_path(self.standby_coordinate) @@ -111,8 +111,8 @@ class Hexapod: self.standby() time.sleep(1) - # for mm in range(0, 20): - # self.move(self.forward_path, 0.005) + for mm in range(0, 20): + self.move(self.forward_path, 0.005) # for mm in range(0, 20): # self.move(self.backward_path, 0.005) diff --git a/software/rpi/path_generator.py b/software/rpi/path_generator.py index ba63746..16ed313 100644 --- a/software/rpi/path_generator.py +++ b/software/rpi/path_generator.py @@ -5,7 +5,7 @@ import numpy as np from collections import deque -def gen_forward_path(): +def gen_forward_path(standby_coordinate): # assert (g_steps % 4) == 0 g_steps = 20 g_radius = 25 @@ -22,10 +22,10 @@ def gen_forward_path(): path[:, 3, :] = mir_path path[:, 5, :] = mir_path - return path + return path+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_backward_path(): +def gen_backward_path(standby_coordinate): # assert (g_steps % 4) == 0 g_steps = 20 g_radius = 25 @@ -42,10 +42,10 @@ def gen_backward_path(): path[:, 3, :] = mir_path path[:, 5, :] = mir_path - return path + return path+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_fastforward_path(): +def gen_fastforward_path(standby_coordinate): g_steps = 20 y_radius = 50 z_radius = 30 @@ -67,10 +67,10 @@ def gen_fastforward_path(): path[:, 3, :] = mir_lpath path[:, 5, :] = mir_lpath - return path + return path+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_fastbackward_path(): +def gen_fastbackward_path(standby_coordinate): g_steps = 20 y_radius = 50 z_radius = 30 @@ -92,10 +92,10 @@ def gen_fastbackward_path(): path[:, 3, :] = mir_lpath path[:, 5, :] = mir_lpath - return path + return path+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_leftturn_path(): +def gen_leftturn_path(standby_coordinate): g_steps = 20 g_radius = 25 assert (g_steps % 4) == 0 @@ -112,10 +112,10 @@ def gen_leftturn_path(): leftturn[:, 4, :] = np.array(path_rotate_z(path, 180)) leftturn[:, 5, :] = np.array(path_rotate_z(mir_path, 135)) - return leftturn + return leftturn+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_rightturn_path(): +def gen_rightturn_path(standby_coordinate): g_steps = 20 g_radius = 25 assert (g_steps % 4) == 0 @@ -132,10 +132,10 @@ def gen_rightturn_path(): rightturn[:, 4, :] = np.array(path_rotate_z(path, 180+180)) rightturn[:, 5, :] = np.array(path_rotate_z(mir_path, 135+180)) - return rightturn + return rightturn+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_shiftleft_path(): +def gen_shiftleft_path(standby_coordinate): g_steps = 20 g_radius = 25 assert (g_steps % 4) == 0 @@ -154,10 +154,10 @@ def gen_shiftleft_path(): shiftleft[:, 4, :] = path shiftleft[:, 5, :] = mir_path - return shiftleft + return shiftleft+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_shiftright_path(): +def gen_shiftright_path(standby_coordinate): g_steps = 20 g_radius = 25 assert (g_steps % 4) == 0 @@ -176,10 +176,10 @@ def gen_shiftright_path(): shiftright[:, 4, :] = path shiftright[:, 5, :] = mir_path - return shiftright + return shiftright+np.tile(standby_coordinate, (g_steps, 1, 1)) -def gen_climb_path(): +def gen_climb_path(standby_coordinate): g_steps = 20 y_radius = 20 z_radius = 80 @@ -210,7 +210,7 @@ def gen_climb_path(): climbpath[:, 4, :] = lpath climbpath[:, 5, :] = mir_lpath - return climbpath + return climbpath+np.tile(standby_coordinate, (g_steps, 1, 1)) def gen_rotatex_path(standby_coordinate):