Time variable for robot trajectory
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Claude Mathias
am 12 Jul. 2023
Beantwortet: Sam Chak
am 14 Jul. 2023
Hi,
I am trying to build robot trajectory to work on inverse dynamics.Trajectory is using polynomial expressions as below.
a0=2;
a1=0;
a2=9.75;
a3=3.25;
theta1=a0+(a1*t)+(a2*t*t)+(a3*t*t*t);Joint angle
v1=a1+(2*a2*t)+(3*a3*t*t); Joint velocity
a1=(2*a2)+(6*a3*t); Joint acceleration
I have used clok block of simulink to provide time input t. I dont think it is the right process. Do we have any other block in simulink to provide time input?

2 Kommentare
Sam Chak
am 13 Jul. 2023
I don't see any issue so far. What problem did you encounter in Simulink?
t = linspace(0, 2, 10001);
a0 = 2;
a1 = 0;
a2 = 9.75;
a3 = 3.25;
theta1 = a0 + a1*t + a2*t.^2 + a3*t.^3; % Joint angle
v1 = a1 + 2*a2*t + 3*a3*t.^2; % Joint velocity
a1 = 2*a2 + 6*a3*t; % Joint acceleration
Akzeptierte Antwort
Sam Chak
am 14 Jul. 2023
After checking your comment, I think you need to update the polynomials for each time interval. For one-time use, it maybe okay to use the Clock block. That Clock block outputs the current simulation time at each simulation step. The following example shows how to compute the Quintic Polynomial Trajectories for
, based your desired initial and final values.

t0 = 1; % start time
t1 = 2; % end time
A = [1 t0 t0^2 t0^3 t0^4 t0^5;
0 1 2*t0 3*t0^2 4*t0^3 5*t0^4;
0 0 2 6*t0 12*t0^2 20*t0^3;
1 t1 t1^2 t1^3 t1^4 t1^5;
0 1 2*t1 3*t1^2 4*t1^3 5*t1^4;
0 0 2 6*t1 12*t1^2 20*t1^3]
B = [3; 2; 1; 4; 3; 2]; % desired initial and final values
x = A\B
t = linspace(t0, t1, 10001);
y = x(1) + x(2)*t + x(3)*t.^2 + x(4)*t.^3 + x(5)*t.^4 + x(6)*t.^5;
dy = gradient(y)./gradient(t);
ddy = gradient(dy)./gradient(t);
tiledlayout(3, 1, 'TileSpacing', 'compact')
nexttile
plot(t, y, 'linewidth', 1.5, 'color', '#cc3232'), grid on
ylabel({'$\theta$ / rad'}, 'interpreter', 'latex', 'fontsize', 12)
title('Quintic Polynomial Trajectories', 'fontsize', 12)
nexttile
plot(t, dy, 'linewidth', 1.5, 'color', '#e6b415'), grid on
ylabel({'$\dot{\theta}$ / (rad/s)'}, 'interpreter', 'latex', 'fontsize', 12)
nexttile
plot(t, ddy, 'linewidth', 1.5, 'color', '#2dc937'), grid on
ylabel({'$\ddot{\theta}$ / (rad/s$^2$)'}, 'interpreter', 'latex', 'fontsize', 12)
xlabel({'$t$ / s'}, 'interpreter', 'latex', 'fontsize', 12)
0 Kommentare
Weitere Antworten (1)
Parth Saraf
am 13 Jul. 2023
Hi,
If you want to avoid using Clock block, you may use the Ramp block or the "From Workspace" block.
You can create a time vector in the workspace which may be useful.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Multibody Dynamics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!