博客参考: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. Linux cut 用法

    cut是一个选取命令,就是将一段数据经过分析,取出我们想要的.一般来说,选取信息通常是针对"行"来进行分析的,并不是整篇信息分析的. )其语法格式为:cut  [-bn] [fil ...

  2. SPA项目开发--表单验证、增删改

    1. 表单验证 Form组件提供了表单验证的功能,只需要通过 rules 属性传入约定的验证规则,   并将Form-Item的prop属性设置为需校验的字段名即可      <el-form- ...

  3. P3709 大爷的字符串题 脑子+莫队

    简化题意:区间众数出现次数??? 为什么?原因是,贪心的想,我们要划分成尽量少的严格递增序列,这样rp掉的最少. 设区间众数出现次数为 \(x\) ,那我们至少要分成 \(x\) 段严格上升序列. # ...

  4. WebAPI学习

    WebAPI概述 今天的web计算平台包含了广泛的功能,其中的大部分均可以通过API(应用程序编程接口)访问. web平台归为6个基本设施,都会用到webapi,包括存储服务.消息服务.计算服务.信息 ...

  5. linux 最大TCP连接数限制

    ----------------------------------------------问题--------------------------------------------- 前几日碰到问 ...

  6. Codeforces Round #607 (Div. 2)

    A - Suffix Three 题意:规定三种语言的结尾符,给出字符串,判断是什么语言. void test_case() { string s; cin >> s; reverse(s ...

  7. mysql小白入门

    mysql简介 1.什么是数据库 ? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库,它产生于距今六十多年前,随着信息技术和市场的发展,特别是二十世纪九十年代以后,数据管理不再仅 ...

  8. 三大框架 之 Hibernate生成策略与缓存策略(主键生成策略、持久化、持久化类划分、一级缓存、事物管理)

    目录 Hibernate生成策略与缓存策略 主键生成策略 主键分类 主键的生成策略 持久化 什么是持久化 什么是持久化类 持久化类编写规则 持久化类的划分 三种状态区分 持久态对象特征 一级缓存 什么 ...

  9. 将WSL2作为生产力工具

    适用于 Linux 的 Windows 子系统 (WSL) 是 Windows 10新增的功能,使用它可以直接在 Windows 上运行 Linux 命令.而WSL 2 是WSL的一个新版本,它支持适 ...

  10. Laravel中的Storage::disk

    Laravel中的Storage::disk 一.总结 一句话总结: Storage的disk的路径和file的路径都是一回事,都是config/filesystems.php配置文件中disks 比 ...