博客参考:https://www.ncnynl.com/archives/201702/1305.html
ROS与C++入门教程-tf-数据类型
说明:
数据类型
基本数据类型
|
Type |
tf |
|
Quaternion |
tf::Quaternion |
|
Vector |
tf::Vector3 |
|
Point |
tf::Point |
|
Pose |
tf::Pose |
|
Transform |
tf::Transform |
tf::Stamped 模板
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
/** \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;};
};
辅助函数
数据类型转换
原文:https://www.cnblogs.com/flyinggod/p/10810123.html