Lab_03 - LaDiSpe - Politecnico di Torino

ROBOTICS – 01PEEQW
Laboratory
Basilio Bona
DAUIN – Politecnico di Torino
Time history of joint angles – 1
How to create a “kinematic-only(*)” time history () of the joint
angles
ASSIGNED CONSTANT VELOCITY
constant velocity = qvel; sample number = Nsample; initial
joint value = q0; time interval = Deltat
q(1)=q0
for k=2:Nsample
q(k)=q(k-1)+qvel*Deltat
end
(*) Acceleration is not taken into account, so forces acting on the system are
neglected
Basilio Bona
ROBOTICS 01PEEQW
2
Time history of joint angles – 2
INITIAL & FINAL VALUES GIVEN
initial joint value = q0; final joint value = qf; sample number =
Nsample; time interval = Deltat
Deltaq=(qf-q0)/Nsample
qvel=Deltaq/Deltat
q(1)=q0
for k=2:Nsample+1 % +1 to attain the final value qf
q(k)=q(k-1)+qvel*Deltat
end
Basilio Bona
ROBOTICS 01PEEQW
3
Time history of joint angles – 3
INITIAL & FINAL VALUES GIVEN
initial joint value = q0; final joint value = qf; sample number =
Nsample; time interval = Deltat
Deltaq=(qf-q0)/Nsample
sprof=linspace(0,1,Nsample+1)
qvel=Deltaq/Deltat
for k=1:Nsample+1 % +1 to attain the final value qf
q(k)=(1-sprof(k))*q0+sprof(k)*qf
end
Basilio Bona
ROBOTICS 01PEEQW
4
Time history of joint angles – 4
INITIAL & FINAL VALUES GIVEN
% this script shows how to use a profile variable (sprof) to create
% the time history of a set of angles and the relative cartesian coordinates
Nsample=99
x=linspace(0,1,Nsample+1)
sprof1=x.^2
sprof2=x.^3
sprof3=1*exp(-(x-.5).^2/(2*0.1^2))
q0(1)=0; qf(1)=45;
q0(2)=0; qf(2)=-45;
q0(3)=-45; qf(3)=0;
for k=1:Nsample+1 % +1 to attain the final value qf
q(:,k)=(1-sprof2(k))*q0+sprof2(k)*qf
end
Basilio Bona
ROBOTICS 01PEEQW
5
Time history of joint angles – 5
INITIAL & FINAL VALUES GIVEN
figure(2)
plot(q(1,:))
grid; hold on
plot(q(2,:)); plot(q(3,:))
% triple pendulum pose
teta = q(1,:)+q(2,:)+q(3,:);
x = L(1)*cosd(q(1,:)) + L(2)*cosd(q(1,:)+q(2,:)) + L(3)*cosd(teta);
y = L(1)*sind(q(1,:)) + L(2)*sind(q(1,:)+q(2,:)) + L(3)*sind(teta);
figure(3); plot(x); grid; hold on; plot(y)
figure(4)
plot(x,y); grid
axis([-1 3 -1 3])
Basilio Bona
ROBOTICS 01PEEQW
6
Basilio Bona
ROBOTICS 01PEEQW
7
Basilio Bona
ROBOTICS 01PEEQW
8
Basilio Bona
ROBOTICS 01PEEQW
9
Basilio Bona
ROBOTICS 01PEEQW
10