当前位置:网站首页>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的旋轉角度計算四元數,用於平面小車。返回四元數
边栏推荐
- Upward and downward transformation
- The amazing nanopc-t4 (rk3399) is used as the initial configuration and related applications of the workstation
- MDM数据分析功能说明
- Can py SQL get the table structure?
- ArrayList of collection
- How does redis implement inventory deduction? How to prevent oversold?
- 从设计交付到开发,轻松畅快高效率!
- 为什么C语言用使用其他文件的结构体变量时,声明结构体别名还不行,必须使用本名?(使用别名时不能加struct)
- echart:横向柱状图的类目文字位置调整
- 团体程序设计天梯赛练习题-持续更新中
猜你喜欢

Figure introduction to neural networks (GNN, GCN)

【324. 摆动排序 II】

图神经网络入门 (GNN, GCN)

Echart: category text position adjustment of horizontal histogram

论文3 VScode&texlive&SumatraPDF打造完美书写论文工具

Demo of intelligent computing system 2 bangc operator development (heterogeneous programming flow of CPU and mlu270)

Industry analysis - quick intercom, building intercom

C # application interface development foundation - form control

《数据安全法》出台一周年,看哪四大变化来袭?

易观分析《2022年中国银行业隐私计算平台供应商实力矩阵分析》研究活动 正式启动
随机推荐
2280.Cupboards
JVM memory structure
Ffmpeg usage in video compression processing
Web3 that unleashes the value of the Internet
2788.Cifera
数字经济专家高泽龙:映客更名映宇宙,元宇宙会成为映客下一个增长引擎吗?
Markdown mermaid種草(1)_ mermaid簡介
Kaggle腸胃道圖像分割比賽baseline
图神经网络入门 (GNN, GCN)
[324. swing sequence II]
return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};
智能计算系统1 环境搭建
JSP to get the value in the session
Full MySQL solution ubuntu/win10
阿里开源(EasyExcel)
100人成绩的平均
直播app系统源码,动态遇到视频时开始自动播放
C # application interface development foundation - form control
Constrained Delaunay triangulation in MATLAB
2280.Cupboards