ros:tf中的欧拉角定义

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/qit1314/article/details/83280992

欧拉角的定义有许多不同的形式,为了方便使用,本文列出了ros中欧拉角的定义。为了增加可信度,本文直接采用源码中的注释对ros tf中的欧拉角的定义进行说明。

在Quaternion.h中,存在以下三种设置方法。

1 setRPY();
这个函数采用固定轴的旋转方式,先绕定轴x旋转(横滚),然后再绕定轴y(俯仰),最后绕定轴z(偏航)。
从数学形式上说,这是绕定轴XYZ矩阵依次左乘,即:R = R(z) R(y)R(x)的顺序。由于是绕着定轴转动,所以很直观,便于人机交互。
/**@brief Set the quaternion using fixed axis RPY

  • @param roll Angle around X
  • @param pitch Angle around Y
  • @param yaw Angle around Z*/
    void setRPY(const tfScalar& roll, const tfScalar& pitch, const tfScalar& yaw);

2 setEuler
这种方式是绕着动轴转动,先绕Y轴,在绕变换后的X轴,再绕变换后的Z轴旋转。
从数学形式上说,这是绕定轴YXZ矩阵依次右乘,即:R = R(y)R(x)R(z) 的顺序。
/**@brief Set the quaternion using Euler angles

  • @param yaw Angle around Y
  • @param pitch Angle around X
  • @param roll Angle around Z */
    void setEuler(const tfScalar& yaw, const tfScalar& pitch, const tfScalar& roll);

3 setEulerZYX
与2相同,此种旋转变换也是绕动轴旋转,只不过次序为ZYX,矩阵也是右乘,即R = R(z) R(y)R(x)。我们发现,这里的R与1中的R的最终结果相同,所以1和3的定义最终是等价的。
/**@brief Set the quaternion using euler angles

  • @param yaw Angle around Z
  • @param pitch Angle around Y
  • @param roll Angle around X */
    void setEulerZYX(const tfScalar& yaw, const tfScalar& pitch, const tfScalar& roll) attribute((deprecated));

总结:
ros中的欧拉角可以分为绕定轴和绕动轴的变换方式,函数没有给出Euler时,是按定轴转动,矩阵依次左乘。若函数的名字中有Euler,则表示为绕动轴转动的方式,矩阵依次右乘。

tf中的静态变换:

static_transform_publisher x y z yaw pitch roll frame_id child_frame_id period_in_ms

Publish a static coordinate transform to tf using an x/y/z offset in meters and yaw/pitch/roll in radians. (yaw is rotation about Z, pitch is rotation about Y, and roll is rotation about X). The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.
static_transform_publisher x y z qx qy qz qw frame_id child_frame_id period_in_ms
这里没有说是绕固定轴旋转,则默认是按照动轴的方式旋转,即,
先绕Z轴旋转,
再绕新的y轴旋转,
再绕新的x轴旋转。

Publish a static coordinate transform to tf using an x/y/z offset in meters and quaternion. The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.

猜你喜欢

转载自blog.csdn.net/qit1314/article/details/83280992
今日推荐