Main Content

rottraj

在方向旋转矩阵之间生成轨迹

Description

例子

[[r,,,,欧米茄,,,,α] = rottraj(r0,,,,RF,,,,tInterval,,,,Tsamplesgenerates a trajectory that interpolates between two orientations,r0andRF,,,,with points based on the time interval and given time samples.

[[r,,,,欧米茄,,,,α] = rottraj(r0,,,,RF,,,,tInterval,,,,Tsamples,,,,名称,价值)使用名称,价值pair arguments.

例子

全部收缩

定义两个四个小节路点以插值之间。

q0 = quaternion([0 pi/4 -pi/8],“欧拉”,,,,'zyx',,,,'观点');qf = quaternion([3*pi/2 0 -3*pi/4],“欧拉”,,,,'zyx',,,,'观点');

指定时间的矢量来采样四轨道轨迹。

TVEC = 0:0.01:5;

生成轨迹。绘制结果。

[qinterp1,w1,a1] = rottraj(q0,qf,[0 5],tvec);绘图(tvec,compact(qinterp1))标题(“季节插值(均匀的时间缩放)”)xlabel('t')ylabel('Quaternion Values') 传奇('W',,,,'X',,,,'Y',,,,'Z'

Figure contains an axes object. The axes object with title Quaternion Interpolation (Uniform Time Scaling) contains 4 objects of type line. These objects represent W, X, Y, Z.

Define two rotation matrix waypoints to interpolate between.

r0 = [1 0 0; 0 1 0; 0 0 1]; rF = [0 0 1; 1 0 0; 0 0 0];

指定时间的矢量来采样四轨道轨迹。

TVEC = 0:0.1:1;

生成轨迹。使用plotTransforms。将旋转矩阵转换为四元组并指定零翻译。该图显示了坐标框架的所有中间旋转。

[rinterp1,w1,a1] = rottraj(r0,rf,[0 1],tvec);旋转= rotm2quat(Rinterp1);zerovect =零(长度(旋转),1);翻译= [Zerovect,Zerovect,Zerovect];plottransforms(翻译,旋转)xlabel('X')ylabel('Y')Zlabel('Z'

Figure contains an axes object. The axes object contains 44 objects of type patch, line.

输入参数

全部收缩

初始方向,指定为3 x-3旋转矩阵或季节目的。The function generates a trajectory that starts at the initial orientation,r0,,,,and goes to the final orientation,RF

Example:quaternion([0 pi/4 -pi/8],'euler','zyx','point');

数据类型:单身的|双倍的

最终方向,指定为3 x-3旋转矩阵或季节目的。The function generates a trajectory that starts at the initial orientation,r0,,,,and goes to the final orientation,RF

Example:quaternion([3*pi/2 0 -3*pi/4],'euler','zyx','point')

数据类型:单身的|双倍的

Start and end times for the trajectory, specified as a two-element vector.

Example:[[0 10]

数据类型:单身的|双倍的

轨迹的时间样本,指定为m- 元素矢量。

Example:0:0.01:10

数据类型:单身的|双倍的

名称值参数

Specify optional pairs of arguments asname1 = value1,...,namen = valuen, 在哪里姓名是参数名称和Valueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

Example:“时间标准”,[0 1 2;0 1 0;0 0 0]

时间缩放向量和前两个衍生物,指定为逗号分隔对“时间标准”and a 3-by-m向量,哪里m是长度Tsamples。默认情况下,时间缩放是在时间点之间的线性时间缩放tInterval

非线性时间缩放、o指定值f the time points in the first row. The second and third rows are the velocity and acceleration of the time points, respectively. For example, to follow the path with a linear velocity to the halfway point, and then jump to the end, the time-scaling would be:

s(1,:) = [0 0.25 0.5 1 1 1] % Position s(2,:) = [1 1 1 0 0 0] % Velocity s(3,:) = [0 0 0 0 0 0] % Acceleration

数据类型:单身的|双倍的

输出参数

全部收缩

Orientation trajectory, returned as a 3-by-3-by-m旋转矩阵阵列或季节目的array, wherem是积分数Tsamples。The output type depends on the inputs fromr0andRF

Orientation angular velocity, returned as a 3-by-m矩阵,,,,wherem是积分数Tsamples

Orientation angular acceleration, returned as a 3-by-m矩阵,,,,wherem是积分数Tsamples

Limitations

  • 指定您的时r0andRF输入参数作为3 x-3旋转矩阵,它们被转换为季节对象插值轨迹。如果您的旋转矩阵不遵循右手的坐标系或没有直接转换为四元素,则此转换可能会导致输出轨迹的不同初始和最终旋转。

references

[1] Dam,Eri​​k B.,Martin Koch和Martin Lillholm。Quaternions, Interpolation and Animation。Technical Report DIKU-TR-98/5 (July 1998). http://web.mit.edu/2.998/www/QuaternionReport1.pdf

[2]格拉夫,巴西勒。四元和动态。arXiv:0811.2889 [math.DS] (2008). https://arxiv.org/pdf/0811.2889.pdf

[3] Lynch,Kevin M.和Frank C. Park。现代机器人技术:力学,计划和控制。Cambridge University Press, 2017.

扩展功能

C/C ++代码生成
Generate C and C++ code using MATLAB® Coder™.

版本历史记录

在R2019a中引入