Enter a velocity and a specific acceleration to a motion

조회 수: 3 (최근 30일)
Moritz Hoetink
Moritz Hoetink 2023년 5월 10일
댓글: Nathan Hardenberg 2023년 7월 3일
I want to give a revolute joint a certain velocity. However, the velocity is to be achieved via a specific acceleration. How can I enter the required velocity, but at the same time the acceleration with which the joint should reach the velocity?
Optimally, I could specify the duration for which the joint should maintain the specified speed (via a variable). In addition, the joint should also decelerate the movement afterwards - receive a negative acceleration until a speed of 0 is reached. As an example, I have simulated a cube that is driven by a joint with a specific velocity.
I hope you can help me!
  댓글 수: 1
Nathan Hardenberg
Nathan Hardenberg 2023년 7월 3일
There is an easier way of providing the position input of the joint: Use the "Simulink-PS Converter" - Block (Stands for Simulink to Physical Converter) and in it's settings do the following:
Then you can connect any simulink signal without providing derivatives.

댓글을 달려면 로그인하십시오.

답변 (1개)

Nathan Hardenberg
Nathan Hardenberg 2023년 7월 3일
There are multiple ways of doing it. I'm just using constant acceleration examples since those are the easiest. But I just want to note that there are more ways of accelerating e.g. jerk-limited.
1 Trapezoidal Velocity Profile Trajectory - Block
To use this Block the the Robotics System Toolbox is needed. I find it quite unintuitive to use (e.g. I do not understand the Waypoints quite fully), but it does the job with a bit of fiddeling around. It gives the position, velocity and acceleration at a given time
2 Manual acceleration with integration and Step - Block
For this you only need to know how the acceleration time gets calculated: As Initial value you choose the acceleration. But be aware that the integraion process is not very reliable if your simulation step time is high. So if you use this check the results and keep you maximum simulation step size low. Also this just accelerates and does not decelerate.
3 Own MATLAB function
You can write your own function using a MATLAB-Function-Block. This should also have the time as one input. Then you can either
a) calculate the acceleration time (see above) and output the acceleration similar to the Step-Block above. Then you can integrate again to get the velocity/position. [also as above: Integration problem on long step times]
b) or calculate the position by hand and output it directly. Here you implement the functionality of the above mentioned "Trapezoidal Velocity Profile Trajectory - Block" yourself. But probably with less features. I'll post some function code as a comment on this Answer
With both you can also easily decelerate by providing a negative acceleration/decelerating position.
4 ???
There are probably other ways of doing it aswell, But I don't know them yet
  댓글 수: 1
Nathan Hardenberg
Nathan Hardenberg 2023년 7월 3일
As promised the code for the movment of the axis. Note that this moves the joint to a given position (s_soll), but you can specify acceleration and velocity. So if you want to go at a fixed velocity for a long time, just choose a big number for the s_soll input
function [currPos, currVel, t_needed, isDone] = ...
trapz_traj_pos1D(time0ToEnd, s_soll, v_max, a_max)
t = time0ToEnd;
isDone = 0;
if t < 0
currPos = 0;
currVel = 0;
t_needed = 0;
return;
end
T_VMax = (a_max*s_soll - v_max^2)/(a_max*v_max);
if T_VMax > 0 % Default
T_AMax = v_max/a_max;
else % No Velocity limit reached
T_VMax = 0;
T_AMax = sqrt(s_soll/a_max);
v_maxNew = sqrt(a_max)*sqrt(s_soll);
v_max = v_maxNew;
end
t_ges = 2*T_AMax + T_VMax;
t_needed = t_ges;
if t <= T_AMax % acceleration
currPos = 1/2*a_max*t^2;
currVel = a_max*t;
elseif t <= T_AMax + T_VMax % constant velocity
posVMaxBegin = 1/2*a_max*T_AMax^2;
currPos = v_max*(t-T_AMax) + posVMaxBegin;
currVel = v_max;
elseif t <= 2*T_AMax + T_VMax % deceleration
posVMaxBegin = 1/2*a_max*T_AMax^2;
posBegin = v_max*T_VMax + posVMaxBegin;
currPos = posBegin - 1/2*a_max*(t-(2*T_AMax+T_VMax))^2 + posVMaxBegin;
currVel = v_max - (t - (T_AMax + T_VMax))*a_max;
else % standstill
currPos = s_soll;
currVel = 0;
isDone = 1;
end
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simscape Multibody에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by