博客参考: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. ArcMap 制图出图

    在这里用的数据是:台湾2018年6月人口统计数据来做展示数据. ArcMap 里面主要用到的是:符号系统使用.布局视图等 一.属性中设置元素符号 ArcMap 初次加载数据,默认的是“单一符号”,就是 ...

  2. 用数组实现strstr函数

    用数组实现strstr函数char * mystrstr(char * dest, char *src){ int i = 0; int j = 0; //匹配个数 int count = 0; in ...

  3. Java—网络编程总结(整理版)

    1. 概述 计算机网络是通过传输介质.通信设施和网络通信协议,把分散在不同地点的计算机设备互连起来的,实现资源共享和数据传输的系统.网络编程就是编写程序使互联网的两个(或多个)设备(如计算机)之间进行 ...

  4. CS229开源项目

    斯坦福大学CS 229机器学习备忘单: https://github.com/kaobeixingfu/stanford-cs-229-machine-learning CS229机器学习算法的Pyt ...

  5. (尚014)Vue过渡与动画

    操作元素时有个过渡或动画的效果(渐变和移动的效果和放大缩小的效果) 过渡:trasition 动画:animation 1.vue动画的理解 1)操作css的trasition或animation(它 ...

  6. __property 关键字的使用

    https://blog.csdn.net/lixingshi/article/details/41277577 __property是属性关键字,用来定义类的某种属性. 给类定义属性,是BCB的扩展 ...

  7. luogu 2592 区间dp

    \(f_{i, j, a, b}\) 表示当前一共有 \(i\) 人排队, \(j\) 名男生,男生数目 - 女生数目为 \(a\), 女生数目 - 男生数目为 \(b\),\(a, b >= ...

  8. ZR#985

    ZR#985 解法: 可以先假设每个区间中所有颜色都出现,然后减掉多算的答案.对每种颜色记录它出现的位置,则相邻两个位置间的所有区间都要减去,时间复杂度 $ O(n) $ . 其实可以理解为加法原理的 ...

  9. rapidxml学习

    参考: 官网http://rapidxml.sourceforge.net/ https://blog.csdn.net/wqvbjhc/article/details/7662931 http:// ...

  10. delphi 运算符重载

    譬如上面的 record 可以这样声明: type   TMyRec = record     name: string;     age: Word;     class operator Grea ...