Why are the final values for velocity and acceleration from bsplinepolytraj() always equal to zero?
20 ビュー (過去 30 日間)
古いコメントを表示
When creating splines using bsplinepolytraj() the last values for the x and y component of velocity and acceleration are always zero. Here's an example from the documentation:
% Interpolate with B-Spline
% Create waypoints to interpolate with a B-Spline.
wpts1 = [0 1 2.1 8 4 3];
wpts2 = [0 1 1.3 .8 .3 .3];
wpts = [wpts1; wpts2];
L = length(wpts) - 1;
% Form matrices used to compute interior points of control polygon
r = zeros(L+1, size(wpts,1));
A = eye(L+1);
for i= 1:(L-1)
A(i+1,(i):(i+2)) = [1 4 1];
r(i+1,:) = 6*wpts(:,i+1)';
end
% Override end points and choose r0 and rL.
A(2,1:3) = [3/2 7/2 1];
A(L,(L-1):(L+1)) = [1 7/2 3/2];
r(1,:) = (wpts(:,1) + (wpts(:,2) - wpts(:,1))/2)';
r(end,:) = (wpts(:,end-1) + (wpts(:,end) - wpts(:,end-1))/2)';
dInterior = (A\r)';
% Construct a complete control polygon and use bsplinepolytraj to compute a polynomial with the new control points
cpts = [wpts(:,1) dInterior wpts(:,end)];
t = 0:0.01:1;
[q, dq, ddq, ~] = bsplinepolytraj(cpts, [0 1], t);
The values for
disp(dq(:,end))
and
disp(ddq(:, end))
I feel like this is wrong. Why are these values zero and how can I get a non-zero answer?
0 件のコメント
回答 (1 件)
Abhaya
2024 年 8 月 12 日 10:54
編集済み: Abhaya
2024 年 8 月 12 日 12:12
Hi Everett,
I understand that you want to know why the last values for the x and y components of velocity and acceleration are always zero when creating splines using MATLAB ‘bsplinepolytraj()’ function. I came across the same query earlier and upon examining the ‘dq’ and ‘ddq’ vectors, I can see that the lengths of ‘dq’ and ‘ddq’ vectors match the length of time vector ‘t’.
By design MATLAB ‘bsplinepolytraj()’ function provides ‘0’ as last value of velocity and acceleration for both the axes. This is because the function generates a piecewise cubic B-spline trajectory that naturally ends with the velocity and acceleration reaching zero at the final point. This can also be observed on other MATLAB functions like ‘trapveltraj()’.
If you are looking to ensure that the last velocity is not zero, you might need to adjust the control points or the end conditions of your B-spline trajectory.
For further explanation on MATLAB ‘bsplinepolytraj()’ function, please follow the below documentation,
Hope this helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spline Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!