You are on page 1of 10

Control of swing leg trajectory following

perturbations of different durations

Simisola Oludare
Bioengineering 452: Biocontrol
Dr. Jim Patton
5/7/2015
ABSTRACT

The strategy used for limb recovery after a perturbation during swing phase depends on
the duration of the perturbation. For people with lower limb prosthetics, it will be difficult or
impossible to react accordingly due to their inability to detect the durations of perturbations.
Therefore, the development of a prosthetic lower limb which can detect the duration of
perturbations and react accordingly is necessary. In this project, the tools of dynamic simulation
will be used to determine the best proportional derivative controller for swing limb perturbations
of different durations. The lower limb was modeled as a double pendulum system fixed at the
hip. Inverse and forward dynamics were used to simulate limb motion. The perturbations were
implemented by adding kinetics to the end of the shank segment. For short duration
perturbations compared to the long duration, the control law required more stiffness and more
dampening to return to the trajectory. The reason for this is that the longer duration trips deal
with more overshoot corrections.

INTRODUCTION

There are many recovery responses to perturbations which cause a trip. These
responses include a lowering strategy, a lifting strategy and a delayed strategy. The duration of
the perturbation has been shown to affect which recovery response is used (Shiratora 2014). A
short duration perturbation results in the lifting strategy while a long duration perturbation results
in a lowering strategy. From this study, it can be concluded that human beings sense duration of
perturbation forces then choose the appropriate recovery strategy. However, for individuals with
lower limb prosthetics it will be difficult for them to respond appropriately to trips of different
durations due to their inability to sense the perturbation forces at their feet. A possible solution
to this problem is to create prosthetic limbs which are able to perform the most appropriate
recovery strategy by detecting forces at the feet. However, before such a device can be created,
it is necessary to know the best lower limb trajectory controller given different perturbation
durations. With the development of dynamic simulation tools, different controllers can be tested
before fabricating a device. Using the tools of dynamic simulation, the purpose of this project is
to determine the best controller for lower limb perturbations of different durations.

METHODS

Modeling the lower limb

The lower limb was modeled as a planar two joint pendulum system with a fixed joint at
the hip (Figure 1A). The thigh and shank segment masses, center of mass, and moment of
inertia were calculated relative to their lengths (Winter 2004).

Shank Thigh
Length (m) 0.36 0.54
Mass (kg) 5.89 17.45
COM (m) 0.16 0.23
Inertia (kg•m2) 0.30 0.15

Table 1. Shank and thigh segments anthropometrics.


Simulating limb movement during the gait cycle

The movement of the limb was simulated using methods of inverse and forward
dynamics and kinematics. The simulation schema can be found below (Figure 1B). Sagittal
plane foot motion was experimentally acquired for a healthy 23 year old adult (165 cm, 71 kg)
walking at a cadence of approximately 1 step per sec. The motion was acquired using 8 infrared
cameras (Motion Analysis, 120 Hz). The knee and hip joint angles and torques were calculated
using inverse dynamics methods assuming no ground reaction forces (Appendix A). The
forward dynamics and kinematics were then calculated using the equations of motion for a two
joint pendulum system. The coriolis and centripetal effects were taken into account.

A. B.
Figure 1. (A) The limb was modelled as a double pendulum system fixed at the hip joint. Rotation was fixed to the sagittal plane.
(Adapted from Ruina). (B) The lower limb motion simulation schematics.

Swing phase perturbation and feedback control

The limb was perturbed by applying a horizontal force to the end of the shank segment
during the swing phase. The short perturbation lasted approximately 150 milliseconds (18
samples) and the long perturbation lasted approximately 350 milliseconds (42 samples). Each
perturbation was delivered as a square wave with a magnitude of 20 Newtons, 100 Newtons
and -100 Newton meters (Appendix B).

Following the perturbation, the limb trajectory was controlled using a PD controller. The
optimal PD controllers for the short and long perturbations were determined by trial and error.
The best PD controller was one which limited trajectory error while moving the limb.

A. B.
Figure 2. (A) The short and long perturbations were delievered as horizontal forces at the end of the shank segment. (B) The system
block diagram featuring the feedforward, feedback controllers and plant. The plant is the double pendulum.
RESULTS

Simulating the swing limb

The swing phase of the gait cycle was simulated using feed forward control and a PD
controller for the hip and knee joints (Kp = -1, -80 and Kd = 0.1*Kp).

Figure 3. The limb from stance phase to swing phase. The limb is made to follow this trajectory using a feedforward and PD
feedback controller.

Short duration perturbation

The PD control law which best maintained the swing limb trajectory was Kp = -1 and Kd
= -0.1*Kp at the hip and Kp = -200 and Kd = 5*Kp.

A. B.
Figure 4. (A) Trip like perturbation is used to change the trajectory of the swing limb. (B) A PD controller with primary changes at the
knee are used to return the limb to it’s trajectory following the perturbation.
Long duration perturbation

The PD control law which best maintained the swing limb trajectory were Kp = -1 and Kd
= -0.1*Kp at the hip and Kp = -120 and Kd = 10*Kp.

A. B.
Figure 5. (A) Trip like perturbation is used to change the trajectory of the swing limb. (B) A PD controller with primary changes at the
knee are used to return the limb to it’s trajectory following the perturbation.

DISCUSSION

For short duration perturbations compared to the long duration, the control law required
more stiffness and more dampening to return to the trajectory. The reason for this is that the
shorter duration trip doesn’t have much overshoot to correct whereas the longer duration trip
has more overshoot to correct for.

Through this project, I was able to determine a relationship between the PD control law
and the duration of the trip perturbation. This work may be useful in the future design of lower
limb prosthetics due to the high fall risk of amputees (Rosenblatt 2014). However, there are a
few limitations with this project which can be addressed in future projects. First, the stance
phase of the swing limb and the effects of the ground reaction force were not included. Second,
the trip dynamics were limited to only the swing limb and not the whole body. This may change
the relationship between the relationship of the controller and the duration of the trip.
REFERENCES

Shirota C, Simon AM, Kuiken TA. Trip recovery strategies following perturbations of variable
duration. J of Biomech 47(2014):2679-84

Ruina, A. Dynamic Walking Simulation Guide. Chapter 1: Double Pendulum.


http://ruina.tam.cornell.edu/research/topics/locomotion_and_robotics/ranger/ranger_paper/Repo
rts/Ranger_Robot/control/simulator/doublependulum.html

Winter, D. A. Kinematics, in Biomechanics and Motor Control of Human Movement, Fourth


Edition, John Wiley & Sons, Inc., Hoboken, NJ, USA. doi: 10.1002/9780470549148.

Rosenblatt, NJ, Bauer, A, Rotter, D, Grabiner, MD. Active dorsiflexing prostheses may reduce
trip-related fall risk in people with transtibial amputation. J Rehabil Res Dev 51(2014): 1229-42
APPENDIX A

A.1 Main

The main.m script contains the limb anthropometrics, the trajectory to be followed and the ode
solver. The data set used has been attached with the code.

%% Initialize global and set variables:


clear
global P % paramters structure
P.L=[0.54; 0.34]; % link lengths
P.M=[17.45; 5.68]; % link masses
P.I=[0.30; 0.15]; % link inertias
P.R=[P.L(1)*0.433,P.L(2)*0.433]; %
distance to CM
P.z1=P.M(2)*9.8*P.L(1)*P.R(2); % precalc for use later
P.z2=P.I(2)+P.M(2)*9.8*P.R(2)^2; % precalc for use later
P.z3=P.I(1)+P.I(2)+(P.M(1)*P.L(1)^2*9.8 ... % precalc for use later
+P.M(2)*P.L(2)^2)/4+P.M(2)*P.L(1)^2; % ...
P.z4 = P.M(2)*P.L(1)*P.L(2)*9.8; % precalc for use later
P.tMax=1.2; % simulation time (sec)
data = load(strcat('KN_594_2Control_2'));
P.xd2 = [ data.RHJCx(1:120)- (data.RAJCx(1:120)) ,(data.RAJCz(1:120)) -
data.RHJCz(1:120)];

P.qd = inverseKinematics(P.xd2,P.L);
s0=[P.qd(1,1),P.qd(1,2),0,0]';
t_steps = length(P.qd)-1;
qdRows = size(P.qd,1);
P.td = (P.tMax*(0:qdRows-1)/(qdRows-1))';
[t1,t2] = forwardKinematics(P.qd,P.L);%% prepare graphics
figure(1); clf; axis equal; hold on; % figure window setup
q=(0:pi/100:pi)'; % plot workspace bound
plot( t2(:,1),t2(:,2),'k>', 'markersize',3)
plot( t1(70:end,1),t1(70:end,2),'r>', 'markersize',3)
[tip, elbow]=forwardKinematics(P.qd,P.L); % initial positions
P.plotHandle=plot([0 elbow(1,1) tip(1,1)], ... % plot initial; the
[0 elbow(1,2) tip(1,2)], ... % ..handle is a
poitner
'g', 'linewidth',5); % ..to the plot.
drawnow % plot up to date

%% Simulate the forward dynamics.


fprintf('\nSimulation....'); pause(.01); % message
[t,s]=ode23('dyn', P.tMax, s0); % SIMULATION: see dyn.m
fprintf('Done.\n'); pause(.01); % message

%% plot what just happened


[tip,elbow]=forwardKinematics(s,P.L); % calulate forward kin
plot(tip(:,1),tip(:,2),'k.','MarkerSize',10); % Plot
plot(elbow(:,1),elbow(:,2),'r.','MarkerSize',10);
A.2 Simulation

The dyn.m function simulates the movement of the limb using inverse dynamics and forward
dynamics methods. The inverse and forward dynamics function are attached.

function sDot=dyn(t, s) %#ok<INUSL>


% sdot = dyn(t, s)
% state equations for the RK simulator. Calculates for current time t.
% NOTE THAT t SHOULD BE A scalar (NOT AN ARRAY)
% state s = [q1, q2, q1dot, q2dot]'
global P % paramters structure
%% torque (Controller goes here)
xd=P.xd2(length(P.td),:); % desired final position
qd=inverseKinematics(xd, P.L); % inverse kinematics

e = s(1:2)-qd'; % CALCULATE ERROR

P.FFtorque=inverseDynamics(P.qd,P.td,[],P.M,P.I,P.L,P.R,9.8);
FFtorque=interp1(P.td,P.FFtorque,t)'; % interpolate the FF torque at this

Kd = [-1,-80];
Kp = [-0.1*Kd(1),-0.1*Kd(2)];

torque= FFtorque + Kp*e + Kd*s(3:4);


%% Forward dynamics (Equations of motion):
c2 = cos(s(2)); % calc for Below
I =[P.z3+P.z4*c2 P.z2+P.z1*c2 % mass/inertia matrix I
P.z2+P.z1*c2 P.z2 ]; % ..
inter= P.z1 * sin(s(2)); % intermediate calc for Below
g = [ -inter * (s(4)^2 + 2 * s(3)*s(4)); % Coriolis + Centripetal
inter * (s(3)^2)]; % Coriolis + Centripetal
sDot= [ s(3:4); inv(I)*(torque-g)]; % this is the important eqn

%% update animation based on current position:


[tip,elbow]=forwardKinematics(s',P.L); % angles to end position
set(P.plotHandle,'xdata',[0 elbow(:,1) tip(:,1)], ...
'ydata',[0 elbow(:,2) tip(:,2)]) %
drawnow % refresh figure
title(num2str(t))

end
APPENDIX B

B.1 Simulating swing phase

To simulate the swing phase, change the following lines below in simulation. In simulation,
change the calculated torque by adding a PD controller.

P.FFtorque=inverseDynamics(P.qd,P.td,[],P.M,P.I,P.L,P.R,9.8);
FFtorque=interp1(P.td,P.FFtorque,t)';% interpolate the FF torque at this
time
Kd = [-1,-80];
Kp = [-0.1*Kd(1),-0.1*Kd(2)];
torque= FFtorque + Kp*e + Kd*s(3:4);

B.2 Simulating the perturbation

To simulate the short perturbation, add kinetics to the end of the shank segment. This will affect
the dynamics of the system, i.e. the torques created by each joint will be different.

Short perturbation

y1 = zeros(1,70);
y2 = 20*ones(1,20);
y4 = 100*ones(1,20);
y3 = zeros(1,30);
x_end = [y1,y2,y3]; %perturbation in the x-axis
y_end = [y1,y4,y3]; %perturbation in the y-axis
t_end = [y1,-y4,y3]; %torsional perturbation
f_end = [x_end',y_end',t_end'];
P.FFtorque=inverseDynamics(P.qd,P.td,f_end,P.M,P.I,P.L,P.R,9.8);

Long perturbation

y1 = zeros(1,70);
y2 = 20*ones(1,40);
y4 = 100*ones(1,40);
y3 = zeros(1,10);
x_end = [y1,y2,y3]; %perturbation in the x-axis
y_end = [y1,y4,y3]; %perturbation in the y-axis
t_end = [y1,-y4,y3]; %torsional perturbation
f_end = [x_end',y_end',t_end'];
P.FFtorque=inverseDynamics(P.qd,P.td,f_end,P.M,P.I,P.L,P.R,9.8);
B.3 Recovery following the perturbation

Short perturbation

sub_t = length(P.qd)-1;
t_frame = floor(((t/P.tMax)*sub_t)+1);

if t_frame < 90
Kd = [-1,-80];
Kp = [-0.1*Kd(1),-0.1*Kd(2)];
else
Kd = [-1,-200];
Kp = [-0.1*Kd(1),5*Kd(2)];
end

Long perturbation

sub_t = length(P.qd)-1;
t_frame = floor(((t/P.tMax)*sub_t)+1);

if t_frame < 110


Kd = [-1,-80];
Kp = [-0.1*Kd(1),-0.1*Kd(2)];
else
Kd = [-1,-120];
Kp = [-0.1*Kd(1),10*Kd(2)];
end

You might also like