当前位置:网站首页>ROS中quaternion四元数和欧拉角转换
ROS中quaternion四元数和欧拉角转换
2022-06-28 19:32: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的旋转角度计算四元数,用于平面小车。返回四元数
边栏推荐
- Markdown绘图mermaid实用教程
- Average score of 100 people
- There are thousands of roads. Why did this innovative storage company choose this one?
- Autumn recruitment experience sharing | how to prepare for bank interview
- 数字藏品,万字长文,你想知道的大部分问题都讲清楚了从业者必看
- 道路千万条,为什么这家创新存储公司会选这条?
- 如何获取飞机穿过雷达两端的坐标
- 大火的虚拟人在哪些产业开始发力?
- 图神经网络入门 (GNN, GCN)
- 视频压缩处理之ffmpeg用法
猜你喜欢

从设计交付到开发,轻松畅快高效率!

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

MDM数据分析功能说明

How does the computer check whether the driver is normal

Markdown绘图mermaid实用教程

视差js特效js轮播图插件

集合之ArrayList

小白创业做电商,选对商城系统很重要!

H5 sunflower operation

Ffmpeg usage in video compression processing
随机推荐
Demo of integrated development of intelligent computing system 3 plugin
How to resolve kernel errors? Solution to kernel error of win11 system
电脑如何检查驱动程序是否正常
Can py SQL get the table structure?
Intelligent computing system 1 environment construction
The white paper on the panorama of the digital economy and the digitalization of consumer finance were released
i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用
Markdown mermaid种草(1)_ mermaid简介
Concours de segmentation des images gastro - intestinales de kaggle Baseline
F (x) construct the equation, calculate the partial derivative by gradient descent, determine the partial derivative adjustment by loss function, and deal with nonlinear problems by activation functio
直播app系统源码,动态遇到视频时开始自动播放
5g NR MBS architecture introduction
首部元宇宙概念小说《元宇宙2086》获得2022年上袭元宇宙奖
Markdown Mermaid Grass (1) Introduction à Mermaid
Paper 3 vscode & texlive & sumatrapdf create a perfect tool for writing papers
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
令人惊艳的NanoPC-T4(RK3399)作为工作站的初始配置和相关应用
The amazing nanopc-t4 (rk3399) is used as the initial configuration and related applications of the workstation
论文阅读:Duplex Contextual Relation Network for Polyp Segmentation
Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature