Why are the final values for velocity and acceleration from bsplinepolytraj() always equal to zero?
조회 수: 7 (최근 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일
편집: Abhaya
2024년 8월 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에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!