|
@@ -3,31 +3,31 @@ from hexapod_python.ik import leg_offsets |
|
|
|
|
|
|
|
|
standing_pose = { |
|
|
standing_pose = { |
|
|
'body': Pose( |
|
|
'body': Pose( |
|
|
position = Point(x = 0.0, y = 0.0, z = 105.0 ), |
|
|
|
|
|
|
|
|
position = Point(x = 0.0, y = 0.0, z = 80.0 ), |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
), |
|
|
), |
|
|
'legs': { |
|
|
'legs': { |
|
|
'e1': Point(x = leg_offsets['e1'].x + -100.0, y = leg_offsets['e1'].y, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -100.0, y = leg_offsets['e2'].y, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -100.0, y = leg_offsets['e3'].y, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 100.0, y = leg_offsets['e4'].y, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 100.0, y = leg_offsets['e5'].y, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 100.0, y = leg_offsets['e6'].y, z = 0.0) |
|
|
|
|
|
|
|
|
'e1': Point(x = leg_offsets['e1'].x + -50.0, y = leg_offsets['e1'].y + 86.0, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -100.0, y = leg_offsets['e2'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -50.0, y = leg_offsets['e3'].y - 86.0, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 50.0, y = leg_offsets['e4'].y - 86.0, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 100.0, y = leg_offsets['e5'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 50.0, y = leg_offsets['e6'].y + 86.0, z = 0.0) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
stand_up_pose = { |
|
|
stand_up_pose = { |
|
|
'body': Pose( |
|
|
'body': Pose( |
|
|
position = Point(x = 0.0, y = 0.0, z = 105.0 ), |
|
|
|
|
|
|
|
|
position = Point(x = 0.0, y = 0.0, z = 80.0 ), |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
), |
|
|
), |
|
|
'legs': { |
|
|
'legs': { |
|
|
'e1': Point(x = leg_offsets['e1'].x + -140.0, y = leg_offsets['e1'].y, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -140.0, y = leg_offsets['e2'].y, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -140.0, y = leg_offsets['e3'].y, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 140.0, y = leg_offsets['e4'].y, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 140.0, y = leg_offsets['e5'].y, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 140.0, y = leg_offsets['e6'].y, z = 0.0) |
|
|
|
|
|
|
|
|
'e1': Point(x = leg_offsets['e1'].x + -70.0, y = leg_offsets['e1'].y + 121.0, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -140.0, y = leg_offsets['e2'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -70.0, y = leg_offsets['e3'].y - 121.0, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 70.0, y = leg_offsets['e4'].y - 121.0, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 140.0, y = leg_offsets['e5'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 70.0, y = leg_offsets['e6'].y + 121.0, z = 0.0) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -39,12 +39,12 @@ shutdown_pose = { |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
orientation = Quaternion(x = 0.0, y = 0.0, z = 0.0, w = 1.0) |
|
|
), |
|
|
), |
|
|
'legs': { |
|
|
'legs': { |
|
|
'e1': Point(x = leg_offsets['e1'].x + -140.0, y = leg_offsets['e1'].y, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -140.0, y = leg_offsets['e2'].y, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -140.0, y = leg_offsets['e3'].y, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 140.0, y = leg_offsets['e4'].y, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 140.0, y = leg_offsets['e5'].y, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 140.0, y = leg_offsets['e6'].y, z = 0.0), |
|
|
|
|
|
|
|
|
'e1': Point(x = leg_offsets['e1'].x + -70.0, y = leg_offsets['e1'].y + 121.0, z = 0.0), |
|
|
|
|
|
'e2': Point(x = leg_offsets['e2'].x + -140.0, y = leg_offsets['e2'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e3': Point(x = leg_offsets['e3'].x + -70.0, y = leg_offsets['e3'].y - 121.0, z = 0.0), |
|
|
|
|
|
'e4': Point(x = leg_offsets['e4'].x + 70.0, y = leg_offsets['e4'].y - 121.0, z = 0.0), |
|
|
|
|
|
'e5': Point(x = leg_offsets['e5'].x + 140.0, y = leg_offsets['e5'].y + 0.0, z = 0.0), |
|
|
|
|
|
'e6': Point(x = leg_offsets['e6'].x + 70.0, y = leg_offsets['e6'].y + 121.0, z = 0.0) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -67,7 +67,7 @@ calibration_pose = { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def interpolate_pose(start, end, steps): |
|
|
|
|
|
|
|
|
def interpolate_pose(start, end, steps, fn = {}): |
|
|
|
|
|
|
|
|
body_step_x = (end['body'].position.x - start['body'].position.x) / (steps-1) |
|
|
body_step_x = (end['body'].position.x - start['body'].position.x) / (steps-1) |
|
|
body_step_y = (end['body'].position.y - start['body'].position.y) / (steps-1) |
|
|
body_step_y = (end['body'].position.y - start['body'].position.y) / (steps-1) |
|
@@ -102,6 +102,11 @@ def interpolate_pose(start, end, steps): |
|
|
y = start['legs'][leg].y + leg_step_y[leg] * i, |
|
|
y = start['legs'][leg].y + leg_step_y[leg] * i, |
|
|
z = start['legs'][leg].z + leg_step_z[leg] * i |
|
|
z = start['legs'][leg].z + leg_step_z[leg] * i |
|
|
) |
|
|
) |
|
|
|
|
|
if leg in fn: |
|
|
|
|
|
(fn_x, fn_y, fn_z) = fn[leg](i) |
|
|
|
|
|
pose['legs'][leg].x += fn_x |
|
|
|
|
|
pose['legs'][leg].y += fn_y |
|
|
|
|
|
pose['legs'][leg].z += fn_z |
|
|
|
|
|
|
|
|
poses.append(pose) |
|
|
poses.append(pose) |
|
|
|
|
|
|
|
|