2D circular trajectory generation - waypointTrajectory interpolation changing depending on the plane (XY or XZ)
Afficher commentaires plus anciens
I am having some trouble creating a semicircular 2D trajectory with the waypointTrajectory function.
The function seems to be interpolating differently depending on the plane where the points are located.
I have tried the following two cases:

On case 1 I get the desired output, but on case 2 the function interpolates differently, producing a 3D path (which in this case is not what I want).

I have tried including velocities and orientation values but nothing seems to fix the problem. Please see below the code for both cases:
CASE 1:
Waypoints = [0,0,0;...
1,1,0;...
0,2,0];
% Orientation = [0,0,0;...
% 0,0,90;...
% 0,0,180];
% quatOrientation = quaternion(Orientation,'eulerd','ZYX','frame');
% Velocities = [1,0,0;...
% 0,1,0;...
% -1,0,0];
TimeOfArrival = [0;1;2];
trajectory = waypointTrajectory(Waypoints,TimeOfArrival,'SampleRate',10);
truePosition = zeros(trajectory.SampleRate*trajectory.TimeOfArrival(end)-1,3);
c = 1;
while ~isDone(trajectory)
truePosition(c,:) = trajectory();
c = c + 1;
end
plot3(Waypoints(:,1),Waypoints(:,2),Waypoints(:,3),'LineStyle','none','Marker','o','MarkerEdgeColor','r');
hold on;
plot3(truePosition(:,1),truePosition(:,2),truePosition(:,3),'Color','k');
daspect([1 1 1]);
grid on;
xlabel('x');
ylabel('y');
zlabel('z');
CASE 2:
Waypoints = [0,0,0;...
1,0,1;...
0,0,2];
% Orientation = [0,0,0;...
% 0,-90,0;...
% 0,-180,0];
% quatOrientation = quaternion(Orientation,'eulerd','ZYX','frame');
% Velocities = [1,0,0;...
% 0,0,1;...
% -1,0,0];
TimeOfArrival = [0;1;2];
trajectory = waypointTrajectory(Waypoints,TimeOfArrival,'SampleRate',10);
truePosition = zeros(trajectory.SampleRate*trajectory.TimeOfArrival(end)-1,3);
c = 1;
while ~isDone(trajectory)
truePosition(c,:) = trajectory();
c = c + 1;
end
plot3(Waypoints(:,1),Waypoints(:,2),Waypoints(:,3),'LineStyle','none','Marker','o','MarkerEdgeColor','r');
hold on;
plot3(truePosition(:,1),truePosition(:,2),truePosition(:,3),'Color','k');
daspect([1 1 1]);
grid on;
xlabel('x');
ylabel('y');
zlabel('z');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import and Preparation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!