当前位置:网站首页>ROS中quaternion四元數和歐拉角轉換
ROS中quaternion四元數和歐拉角轉換
2022-06-28 19:46:00 【XiaoMu-1230】
在移動小車導航中,ros系統通常使用四元數錶示裏程計orientation信息,但是很多時候需要歐拉角錶示更加直觀方便,因此在這裏記錄一下轉換方法。
include "tf/transform_datatypes.h"//轉換函數頭文件
#include <nav_msgs/Odometry.h>//裏程計信息格式
/****************四元數轉RPY歐拉角,以odomsub的回調函數為例*****************/
void odomCallback(const nav_msgs::Odometry &odom) {
tf::Quaternion quat;
tf::quaternionMsgToTF(odom.pose.pose.orientation, quat);
double roll, pitch, yaw;//定義存儲r\p\y的容器
tf::Matrix3x3(quat).getRPY(roll, pitch, yaw); //進行轉換
}
/****************RPY歐拉角轉四元數*****************/
tf::createQuaternionMsgFromRollPitchYaw(double r, double p, double y);//返回四元數
tf::createQuaternionMsgFromYaw(double y);//只通過y即繞z的旋轉角度計算四元數,用於平面小車。返回四元數
边栏推荐
- Priority problem when local variables and global variables in C language have the same name (when local variables and global variables exist at the same time, local variables are preferred to be refer
- 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C1047 对象或库文件“.lib”是使用与其他对象(如“x64\Release\main.obj”)不同的
- 内核错误怎么解决?Win11系统内核错误解决方法
- kettle(六):基于Kettle的数据库全量备份
- Industry analysis - quick intercom, building intercom
- Technical methodology of new AI engine under the data infrastructure upgrade window
- math_ Proving common equivalent infinitesimal & Case & substitution
- 30讲 线性代数 第四讲 线性方程组
- Matlab 2D or 3D triangulation
- Demo of integrated development of intelligent computing system 3 plugin
猜你喜欢

Variational graph auto-encoders (VGAE)

秋招经验分享 | 银行笔面试该怎么准备

Autumn recruitment experience sharing | how to prepare for bank interview

Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature

i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用

easypoi

令人惊艳的NanoPC-T4(RK3399)作为工作站的初始配置和相关应用

In which industries did the fire virtual human start to make efforts?
![return new int[]{i + 1, mid + 1};return {i + 1, mid + 1};](/img/6a/45a4494276deba72ef9833818229f5.png)
return new int[]{i + 1, mid + 1};return {i + 1, mid + 1};
![return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};](/img/6a/45a4494276deba72ef9833818229f5.png)
return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};
随机推荐
Live app system source code, automatically playing when encountering video dynamically
echart:横向柱状图的类目文字位置调整
How to learn JS through w3school / how to use the JS reference manual of w3school
Matlab 2D or 3D triangulation
腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
2280.Cupboards
事实/论断/断言/结论/断定/判定
多测师肖sirapp中riginal error: Could not extract PIDs from ps output. PIDS: [], Procs: [“bad pid
100人成绩的平均
内核错误怎么解决?Win11系统内核错误解决方法
[324. swing sequence II]
High performance and high availability computing architecture scheme commented by Weibo
From design delivery to development, it is easy and efficient!
Ali open source (easyexcel)
C语言局部变量与全局变量重名时的优先级问题(当局部变量和全局变量同时存在的时候,优先引用局部变量,而不去引用全局变量)
颜色渐变的FontAwesome图标
matlab 受约束的 Delaunay 三角剖分
H5 sunflower operation
MDM data analysis function description
i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用