tf API Overview: Data Types | Transformations and Frames | Broadcasting Transforms | Using Published Transforms | Exceptions

Data Types

These data types are defined in file tf/transform_datatypes.h.

Base data types (Quaternion, Vector, Point, Pose, Transform)

All of these data types are typedefs of a bullet data type, so those are listed for reference.

Type

tf

Bullet

Quaternion

tf::Quaternion

btQuaternion

Vector

tf::Vector3

btVector3

Point

tf::Point

btVector3

Pose

tf::Pose

btTransform

Transform

tf::Transform

btTransform

As of ROS Fuerte, TF has defined its own datatypes. For more information on how to migrate pre-Fuerte code to newer distributions of ROS, see geometry/bullet_migration.

Type

tf

Quaternion

tf::Quaternion

Vector

tf::Vector3

Point

tf::Point

Pose

tf::Pose

Transform

tf::Transform

tf::Stamped <T>

tf::Stamped<T> is templated on the above datatypes(except tf::Transform) with elements frame_id_ and stamp_

   1 template <typename T>
   2 class Stamped : public T{
   3  public:
   4   ros::Time stamp_;
   5   std::string frame_id_;
   6 
   7   Stamped() :frame_id_ ("NO_ID_STAMPED_DEFAULT_CONSTRUCTION"){}; //Default constructor used only for preallocation
   8 
   9   Stamped(const T& input, const ros::Time& timestamp, const std::string & frame_id);
  10   
  11   void setData(const T& input);
  12 };

tf::StampedTransform

tf::StampedTransform is a special case of tf::Transforms which require both frame_id and stamp as well as child_frame_id.

   1 /** \brief The Stamped Transform datatype used by tf */
   2 class StampedTransform : public tf::Transform
   3 {
   4 public:
   5   ros::Time stamp_; ///< The timestamp associated with this transform                                                                                                                                                                                                                                                        
   6   std::string frame_id_; ///< The frame_id of the coordinate frame  in which this transform is defined                                                                                                                                                                                                                       
   7   std::string child_frame_id_; ///< The frame_id of the coordinate frame this transform defines                                                                                                                                                                                                                              
   8   StampedTransform(const tf::Transform& input, const ros::Time& timestamp, const std::string & frame_id, const std::string & child_frame_id):
   9     tf::Transform (input), stamp_ ( timestamp ), frame_id_ (frame_id), child_frame_id_(child_frame_id){ };
  10 
  11   /** \brief Default constructor only to be used for preallocation */
  12   StampedTransform() { };
  13 
  14   /** \brief Set the inherited Traonsform data */
  15   void setData(const tf::Transform& input){*static_cast<tf::Transform*>(this) = input;};
  16 
  17 };

Helper Functions

tf::Quaternion createIdentityQuaternion()

  • Return an identity quaternion.

tf::Quaternion createQuaternionFromRPY(double roll,double pitch,double yaw)

  • Return a tf::Quaternion constructed from Fixed-Axis Roll, Pitch and Yaw

geometry_msgs::Quaternion createQuaternionMsgFromRollPitchYaw(double roll,double pitch,double yaw)

  • Return a geometry_msgs::Quaternion constructed from Fixed-Axis Roll, Pitch and Yaw.

Data type conversions

See the conversions code API.

Wiki: tf/Overview/Data Types (last edited 2014-02-08 16:45:54 by JonathanBohren)