Time variable for robot trajectory

5 visualizaciones (últimos 30 días)
Claude Mathias
Claude Mathias el 12 de Jul. de 2023
Respondida: Sam Chak el 14 de Jul. de 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 comentarios
Sam Chak
Sam Chak el 13 de Jul. de 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
Claude Mathias
Claude Mathias el 14 de Jul. de 2023
Hello Sam,
Thank you for the response!
There is no problem.. I am trying to control time vector. I am building a human walking trajectory. Lets say i have a data joint angle as 3 rad/sec ,velocity as 2rad/sec, acceleration as 1 rad/s2 for t=1 sec and joing angle as 4 rad/sec ,velocity as 3rad/sec, acceleration as 2 rad/s2 for t=2 sec etc.. I am struggling to build the same in simulink. I have no idea whether we can control this clock block as per our requirement or not.

Iniciar sesión para comentar.

Respuesta aceptada

Sam Chak
Sam Chak el 14 de Jul. de 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]
A = 6×6
1 1 1 1 1 1 0 1 2 3 4 5 0 0 2 6 12 20 1 2 4 8 16 32 0 1 4 12 32 80 0 0 2 12 48 160
B = [3; 2; 1; 4; 3; 2]; % desired initial and final values
x = A\B
x = 6×1
46.0000 -171.0000 258.0000 -185.5000 64.0000 -8.5000
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)

Más respuestas (1)

Parth Saraf
Parth Saraf el 13 de Jul. de 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!

Categorías

Más información sobre Robotics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by