博客参考: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-数据类型的更多相关文章

  1. ROS tf基础使用知识

    博客参考:https://www.ncnynl.com/archives/201702/1306.html ROS与C++入门教程-tf-坐标变换 说明: 介绍在c++实现TF的坐标变换 概念: Co ...

  2. ROS TF——learning tf

    在机器人的控制中,坐标系统是非常重要的,在ROS使用tf软件库进行坐标转换. 相关链接:http://www.ros.org/wiki/tf/Tutorials#Learning_tf 一.tf简介 ...

  3. ROS tf

    一.节点中使用(cpp,python) 1. ros wiki 提供的tutorials 2. https://blog.csdn.net/start_from_scratch/article/det ...

  4. ROS tf 两个常用的函数

    /** \brief Get the transform between two frames by frame ID.   * \param target_frame The frame to wh ...

  5. ROS tf 编程指南

    ROS (Robot Operating System, 机器人操作系统)是最知名的机器人操作系统,广泛应用于无人驾驶和机器人,tf(transforms,坐标系转换)是ROS下的一个常用的工具库.r ...

  6. ROS tf监听编写

    博客转载自:https://www.ncnynl.com/archives/201702/1311.html ROS与C++入门教程-tf-编写tf listener(监听) 说明: 介绍如何使用tf ...

  7. ROS tf广播编写

    博客参考:https://www.ncnynl.com/archives/201702/1310.html ROS与C++入门教程-tf-编写tf broadcaster(广播) 说明: 介绍如何广播 ...

  8. 制作自己的ros机器人(navigaion)前提--22

    摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/  一.要求: 1.大家已经对ROS的基本概念(进程间通讯topic service 数据类型 m ...

  9. 理解ROS的节点(NODE)

    经过前面的学习,我们已经知道了如何构建一个ROS的包,这篇博客将介绍ROS中的节点的概念. 在继续之前,请按ctrl+alt+t打开一个终端,在里面输入: sudo apt-get install r ...

  10. ROS下利用realsense采集RGBD图像合成点云

    摘要:在ROS kinetic下,利用realsense D435深度相机采集校准的RGBD图片,合成点云,在rviz中查看点云,最后保存成pcd文件. 一. 各种bug 代码编译成功后,打开rviz ...

随机推荐

  1. 小程序框架之逻辑层App Service

    小程序开发框架的逻辑层使用 JavaScript 引擎为小程序提供开发者 JavaScript 代码的运行环境以及微信小程序的特有功能. 逻辑层将数据进行处理后发送给视图层,同时接受视图层的事件反馈. ...

  2. C# 8.0 的新特性( NET Framework 4.8 与 Visual Studio 2019 )

    C#8.0 于 2019年4月 随 .NET Framework 4.8 与 Visual Studio 2019 一同发布 使用VS2019体检C#8.0新功能: 编辑.csproj文件,添加如下代 ...

  3. FRCN文本检测(转)

    [源码分析]Text-Detection-with-FRCN 原创 2017年11月21日 17:58:39 标签: 659 编辑 删除 Text-Detection-with-FRCN项目是基于py ...

  4. 卡林巴琴谱&简谱

    ---------------------------------------------------------------------------------------------------- ...

  5. C# Ninject使用

    Ninject是一个IOC容器,用来解决程序中组件的耦合问题,它的目的在于做到最少配置.简单来讲就是 为我们选择一个想要的类来处理事务. 百度百科的解释:一个快如闪电.超轻量级的基于.Net平台的依赖 ...

  6. PHP 鸟哥:我也曾经是“不适合”编程的人

    网名:雪候鸟,大家尊称鸟哥,惠新宸 @Laruence, 是国内最有影响力的 PHP 技术专家,PHP 开发组核心成员,PECL 开发者,Zend 公司外聘顾问.他曾供职于雅虎,百度,现在新浪微博任平 ...

  7. VIM工具的常用命令快捷键

    一.光标的移动0: 移动到行首.$: 移动到行尾.w: walk移动到下一个单词b: back 移动到上一个单词h或退格: 左移一个字符:后退l或空格: 右移一个字符:前进j: 下移一行:k: 上移一 ...

  8. leetcode解题报告(28):Remove Linked List Elements

    描述 Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 ...

  9. Bzoj 4147: [AMPPZ2014]Euclidean Nim(博弈)

    4147: [AMPPZ2014]Euclidean Nim Time Limit: 1 Sec Memory Limit: 256 MB Description Euclid和Pythagoras在 ...

  10. EM算法 学习笔记

    转载请注明出处: http://www.cnblogs.com/gufeiyang 首先考虑这么一个问题.操场东边有100个男生,他们的身高符合高斯分布.操场西边有100个女生,她们的身高也符合高斯分 ...