当前位置:网站首页>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的旋转角度计算四元数,用于平面小车。返回四元数
边栏推荐
- Facts / assertions / assertions / conclusions / assertions / judgments
- 智能计算系统3 Plugin 集成开发的demo
- 如何获取飞机穿过雷达两端的坐标
- Bayesian inference problem, MCMC and variational inference
- Live app system source code, automatically playing when encountering video dynamically
- Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level
- Are there any regular and safe foreign exchange dealers in China?
- 秋招经验分享 | 银行笔面试该怎么准备
- math_证明常用等价无穷小&案例&代换
- How to learn JS through w3school / how to use the JS reference manual of w3school
猜你喜欢

行业分析| 快对讲,楼宇对讲

Win11如何给系统盘瘦身?Win11系统盘瘦身方法

math_证明常用等价无穷小&案例&代换

如何获取飞机穿过雷达两端的坐标

电脑如何检查驱动程序是否正常

Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level

Double contextual relationship network for polyp segmentation

Time series forecasting based on trend and seasonality

Markdown绘图mermaid实用教程

h5向日葵作业
随机推荐
Leetcode 周赛299
From design delivery to development, it is easy and efficient!
Huawei cloud onemeeting tells you that the whole scene meeting is held like this!
Matlab 2D or 3D triangulation
Kettle (VI): full database backup based on kettle
How does redis implement inventory deduction? How to prevent oversold?
多测师肖sirapp中riginal error: Could not extract PIDs from ps output. PIDS: [], Procs: [“bad pid
i人事HR系统上架企业微信ISV,增强企微在服务连锁零售等行业深度应用
Facts / assertions / assertions / conclusions / assertions / judgments
道路千万条,为什么这家创新存储公司会选这条?
C language - function knowledge points
蓝桥杯 历届试题 蚂蚁感冒
国内有正规安全的外汇交易商吗?
判断字符串是否为空
Rigid error: could not extract PIDs from PS output PIDS: [], Procs: [“bad pid
Constrained Delaunay triangulation in MATLAB
Demo of intelligent computing system 2 bangc operator development (heterogeneous programming flow of CPU and mlu270)
Time series forecasting based on trend and seasonality
Variational graph auto-encoders (VGAE)
论文阅读:Duplex Contextual Relation Network for Polyp Segmentation