ROS tf-数据类型
博客参考:https://www.ncnynl.com/archives/201702/1305.html
ROS与C++入门教程-tf-数据类型
说明:
- 介绍roscpp的Data Types(数据类型)及使用
数据类型
- 数据类型定义在tf/transform_datatypes.h
基本数据类型
- 基本数据类型有:(Quaternion, Vector, Point, Pose, Transform)
- ROS Fuerte后,TF已经定义了自己的数据类型。关于如何迁移pre-Fuerte代码到更新的ROS版本,查阅geometry/bullet_migration
- 基本类型:
Type |
tf |
Quaternion |
tf::Quaternion |
Vector |
tf::Vector3 |
Point |
tf::Point |
Pose |
tf::Pose |
Transform |
tf::Transform |
tf::Stamped 模板
- tf::Stamped 对上述数据类型做模板化(除了tf::Transform),并附带元素frame_id_和stamp_ 。
- 定义代码:
template <typename T>
class Stamped : public T{
public:
ros::Time stamp_;
std::string frame_id_; Stamped() :frame_id_ ("NO_ID_STAMPED_DEFAULT_CONSTRUCTION"){}; //Default constructor used only for preallocation Stamped(const T& input, const ros::Time& timestamp, const std::string & frame_id); void setData(const T& input);
};
tf::StampedTransform
- tf::StampedTransform 是tf::Transforms的特例,它要求frame_id 、stamp 、child_frame_id.
- 定义代码:
/** \brief The Stamped Transform datatype used by tf */
class StampedTransform : public tf::Transform
{
public:
ros::Time stamp_; ///< The timestamp associated with this transform
std::string frame_id_; ///< The frame_id of the coordinate frame in which this transform is defined
std::string child_frame_id_; ///< The frame_id of the coordinate frame this transform defines
StampedTransform(const tf::Transform& input, const ros::Time& timestamp, const std::string & frame_id, const std::string & child_frame_id):
tf::Transform (input), stamp_ ( timestamp ), frame_id_ (frame_id), child_frame_id_(child_frame_id){ }; /** \brief Default constructor only to be used for preallocation */
StampedTransform() { }; /** \brief Set the inherited Traonsform data */
void setData(const tf::Transform& input){*static_cast<tf::Transform*>(this) = input;}; };
辅助函数
- 函数:tf::Quaternion createIdentityQuaternion()
- 作用:返回四元数句柄
- 函数:tf::Quaternion createQuaternionFromRPY(double roll,double pitch,double yaw)
- 作用:返回从固定轴的Roll, Pitch and Yaw(滚动,俯仰和偏转)构造的tf::Quaternion四元数
- 函数:geometry_msgs::Quaternion createQuaternionMsgFromRollPitchYaw(double roll,double pitch,double yaw)
- 作用:返回从固定轴的Roll, Pitch and Yaw(滚动,俯仰和偏转)构造的geometry_msgs::Quaternion四元数
数据类型转换
ROS tf-数据类型的更多相关文章
- ROS tf基础使用知识
博客参考:https://www.ncnynl.com/archives/201702/1306.html ROS与C++入门教程-tf-坐标变换 说明: 介绍在c++实现TF的坐标变换 概念: Co ...
- ROS TF——learning tf
在机器人的控制中,坐标系统是非常重要的,在ROS使用tf软件库进行坐标转换. 相关链接:http://www.ros.org/wiki/tf/Tutorials#Learning_tf 一.tf简介 ...
- ROS tf
一.节点中使用(cpp,python) 1. ros wiki 提供的tutorials 2. https://blog.csdn.net/start_from_scratch/article/det ...
- ROS tf 两个常用的函数
/** \brief Get the transform between two frames by frame ID. * \param target_frame The frame to wh ...
- ROS tf 编程指南
ROS (Robot Operating System, 机器人操作系统)是最知名的机器人操作系统,广泛应用于无人驾驶和机器人,tf(transforms,坐标系转换)是ROS下的一个常用的工具库.r ...
- ROS tf监听编写
博客转载自:https://www.ncnynl.com/archives/201702/1311.html ROS与C++入门教程-tf-编写tf listener(监听) 说明: 介绍如何使用tf ...
- ROS tf广播编写
博客参考:https://www.ncnynl.com/archives/201702/1310.html ROS与C++入门教程-tf-编写tf broadcaster(广播) 说明: 介绍如何广播 ...
- 制作自己的ros机器人(navigaion)前提--22
摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/ 一.要求: 1.大家已经对ROS的基本概念(进程间通讯topic service 数据类型 m ...
- 理解ROS的节点(NODE)
经过前面的学习,我们已经知道了如何构建一个ROS的包,这篇博客将介绍ROS中的节点的概念. 在继续之前,请按ctrl+alt+t打开一个终端,在里面输入: sudo apt-get install r ...
- ROS下利用realsense采集RGBD图像合成点云
摘要:在ROS kinetic下,利用realsense D435深度相机采集校准的RGBD图片,合成点云,在rviz中查看点云,最后保存成pcd文件. 一. 各种bug 代码编译成功后,打开rviz ...
随机推荐
- PHP——json_encode转码保留中文
前言 特殊的情况,特殊对待吧.转码为GBK再json_encode会报错,因为json_encode是只支持utf8的. 代码 文档 | https://www.php.net/manual/en/f ...
- Decode Ways II
Description A message containing letters from A-Z is being encoded to numbers using the following ma ...
- 【shell】2、判断表达式、if语句
文件类型判断 test -e filename:该文件名是否存在 test -f filename:该文件名是否存在且为文件(file) test -d filename:该文件名是否存在且为目录(d ...
- SPA项目开发动态树、数据表格、分页功能
SPA项目开发 1.修改左侧动态树 LeftNav.vue <template> <el-menu router :" class="el-menu-vertic ...
- Canvas 总结,到第4章 canvas图形变换
canvas 必须认识到的大坑 <!-- 重点: 在js/canvas标签中定义的宽和高是画布实际的宽和高. 在样式表中定义的宽和高是画布缩放后的宽和高. 即:把js/canvas实际大小缩放到 ...
- sql server 行转列和列转行的使用
1: 行转列 子查询,获取一定数据集结果 SELECT objid,action,count(1) AS [count] FROM T_MyAttention WHERE objid IN(SELEC ...
- ServletContext对象应用——三天免登录
1.用到的知识点: (1)Cookie (2)Session (3)ServletContext 其中Cookie和Session是会话技术的组成部分,一次会话从打开浏览器的某个站点开始,到浏览器关闭 ...
- docker使(二)—发布node应用镜像和容器
应用在本地是已经ok的了,现在将node应用放进docker容器里面 获取node镜像 docker pull node 编写Dokerfile # 根据node镜像开始创建新的镜像(可以加上:tag ...
- Oracle自动备份(多个库),压缩打包,删除原文件
1.创建一个database_Backup.bat文件,用记事本打开 内容参考如下:(楼主这里自动备份了四个数据库) set "now=%date:~0,4%%date:~5,2%%date ...
- 解决Spring Boot 拦截器注入service为空的问题
问题:在自定义拦截器中,使用了@Autowaire注解注入了封装JPA方法的Service,结果发现无法注入,注入的service为空 0.原因分析 拦截器加载的时间点在springcontext之前 ...