From 099069d8eb15b5d54f3fb399d7fb4400c3e4ad60 Mon Sep 17 00:00:00 2001 From: "jazz (gitea)" Date: Tue, 28 Jul 2026 02:15:58 -0500 Subject: [PATCH] move crouching example to dat/EX_crouch.m --- dat/EX_crouch.m | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ dat/Limbs2.m | 20 ++++++------ 2 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 dat/EX_crouch.m diff --git a/dat/EX_crouch.m b/dat/EX_crouch.m new file mode 100644 index 0000000..8e0c27a --- /dev/null +++ b/dat/EX_crouch.m @@ -0,0 +1,84 @@ +%% 3D actuation of all joints %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +COUNT = 4; +GAIN = 1; + +GAIN_HIP = GAIN; +GAIN_KNEE = GAIN; +GAIN_ANKLE = GAIN; + +% setup timeline, query points +t = 0 : 1 : COUNT - 1; +q = 0 : 0.001 : COUNT - 1; + +% vars starting with tr_ are "tracks", or arrays of unprocessed positions +% over a period of time. The rotational position of a joint is measured +% in radians. Each array corresponds to a degree of freedom. The length +% of each array is to be equal to the value of COUNT. + +%% TRACKS: Left Leg Joints X, Y, Z%% +tr_LHipY = [0, -1.1, -1.1, -1.1]; % positive: move foot back +tr_LHipX = [0, 0, 0, 0]; % pos: move foot inward +tr_LHipZ = [0, 0, 0, 0]; % pos: move knee left (c-clockw) + +tr_LKneeY = [0, 1.4, 1.4, 1.4]; % pos: bend knee normally + +tr_LAnkleY = [0, -0.6, -0.6, -0.6]; % pos: point toes down (pitch) +tr_LAnkleX = [0, 0, 0, 0]; % pos: right side of foot down + +%% TRACKS: Right Leg Joints X, Y, Z%% +tr_RHipY = [0, -1.1, -1.1, -1.1]; % positive: move leg back +tr_RHipX = [0, 0, 0, 0]; % pos: mv foot in +tr_RHipZ = [0, 0, 0, 0]; % pos: mv c-clockw + +tr_RKneeY = [0, 1.4, 1.4, 1.4]; % pos: bend knee + +tr_RAnkleY = [0, -0.6, -0.6, -0.6]; % pos: toes down +tr_RAnkleX = [0, 0, 0, 0]; % pos: right side down + +%% The rest of this script does not need to be modified by hand.%% + +% interp's, left leg +it_LHipY = interp1(t, tr_LHipY, q, 'spline')'; +it_LHipZ = interp1(t, tr_LHipZ, q, 'spline')'; +it_LHipX = interp1(t, tr_LHipX, q, 'spline')'; + +it_LKneeY = interp1(t, tr_LKneeY, q, 'spline')'; + +it_LAnkleY = interp1(t, tr_LAnkleY, q, 'spline')'; +it_LAnkleX = interp1(t, tr_LAnkleX, q, 'spline')'; + +% interp's, right leg +it_RHipY = interp1(t, tr_RHipY, q, 'spline')'; +it_RHipZ = interp1(t, tr_RHipZ, q, 'spline')'; +it_RHipX = interp1(t, tr_RHipX, q, 'spline')'; + +it_RKneeY = interp1(t, tr_RKneeY, q, 'spline')'; + +it_RAnkleY = interp1(t, tr_RAnkleY, q, 'spline')'; +it_RAnkleX = interp1(t, tr_RAnkleX, q, 'spline')'; + +%% RETURN VALUES %% + +% Left Leg +ret_LHipY = [q', it_LHipY]; +ret_LHipZ = [q', it_LHipZ]; +ret_LHipX = [q', it_LHipX]; + +ret_LKnee = [q', it_LKneeY]; + +ret_LAnkleY = [q', it_LAnkleY]; +ret_LAnkleX = [q', it_LAnkleX]; + +%%%%%%%%%%%%%%%%%%%% + +% Right Leg +ret_RHipY = [q', it_RHipY]; +ret_RHipZ = [q', it_RHipZ]; +ret_RHipX = [q', it_RHipX]; + +ret_RKnee = [q', it_RKneeY]; + +ret_RAnkleY = [q', it_RAnkleY]; +ret_RAnkleX = [q', it_RAnkleX]; diff --git a/dat/Limbs2.m b/dat/Limbs2.m index 8e0c27a..88caac4 100644 --- a/dat/Limbs2.m +++ b/dat/Limbs2.m @@ -18,23 +18,23 @@ q = 0 : 0.001 : COUNT - 1; % of each array is to be equal to the value of COUNT. %% TRACKS: Left Leg Joints X, Y, Z%% -tr_LHipY = [0, -1.1, -1.1, -1.1]; % positive: move foot back -tr_LHipX = [0, 0, 0, 0]; % pos: move foot inward -tr_LHipZ = [0, 0, 0, 0]; % pos: move knee left (c-clockw) +tr_LHipY = [0, 0, 0, 0]; % positive: move foot back +tr_LHipX = [0, 0, 0, 0]; % pos: move foot inward +tr_LHipZ = [0, 0, 0, 0]; % pos: move knee left (c-clockw) -tr_LKneeY = [0, 1.4, 1.4, 1.4]; % pos: bend knee normally +tr_LKneeY = [0, 0, 0, 0]; % pos: bend knee normally -tr_LAnkleY = [0, -0.6, -0.6, -0.6]; % pos: point toes down (pitch) +tr_LAnkleY = [0, 0, 0, 0]; % pos: point toes down (pitch) tr_LAnkleX = [0, 0, 0, 0]; % pos: right side of foot down %% TRACKS: Right Leg Joints X, Y, Z%% -tr_RHipY = [0, -1.1, -1.1, -1.1]; % positive: move leg back -tr_RHipX = [0, 0, 0, 0]; % pos: mv foot in -tr_RHipZ = [0, 0, 0, 0]; % pos: mv c-clockw +tr_RHipY = [0, 0, 0, 0]; % positive: move leg back +tr_RHipX = [0, 0, 0, 0]; % pos: mv foot in +tr_RHipZ = [0, 0, 0, 0]; % pos: mv c-clockw -tr_RKneeY = [0, 1.4, 1.4, 1.4]; % pos: bend knee +tr_RKneeY = [0, 0, 0, 0]; % pos: bend knee -tr_RAnkleY = [0, -0.6, -0.6, -0.6]; % pos: toes down +tr_RAnkleY = [0, 0, 0, 0]; % pos: toes down tr_RAnkleX = [0, 0, 0, 0]; % pos: right side down %% The rest of this script does not need to be modified by hand.%%