%% Interpolate Trajectory Between Quaternions
% Define two quaternion waypoints to interpolate between.

q0 = quaternion([0 pi/4 -pi/8],'euler','ZYX','point');
qF = quaternion([3*pi/2 0 -3*pi/4],'euler','ZYX','point');

%
% Specify a vector of times to sample the quaternion trajectory.

tvec = 0:0.01:5;

%
% Generate the trajectory. Plot the results.

[qInterp1,w1,a1] = rottraj(q0,qF,[0 5],tvec);

plot(tvec,compact(qInterp1))
title('Quaternion Interpolation (Uniform Time Scaling)')
xlabel('t')
ylabel('Quaternion Values')
legend('W','X','Y','Z')

% Copyright 2018 The MathWorks, Inc.