Time variable for robot trajectory

5 次查看(过去 30 天)
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 个评论
Sam Chak
Sam Chak 2023-7-13
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 2023-7-14
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.

请先登录,再进行评论。

采纳的回答

Sam Chak
Sam Chak 2023-7-14
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)

更多回答(1 个)

Parth Saraf
Parth Saraf 2023-7-13
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!

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by