ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You are confusing the data types (well, they are confusing indeed).

There is geometry_msgs::TransformStamped and tf::StampedTransform in ROS. The first is just a container (C++ ROS message representation) used for data serialization, while the second is a full-featured class that allows to manipulate transformation matrices etc.

The code you gave the link to is using tf::StampedTransform. Also it uses the old tf methods, where lookupTransfrom accepts only tf data types and has the following signature:

void lookupTransform(const std::string& target_frame, const std::string& source_frame,
                       const ros::Time& time, StampedTransform& transform) const;

while the one you are trying to use is from tf2:

virtual geometry_msgs::TransformStamped 
    lookupTransform(const std::string& target_frame, const std::string& source_frame,
                    const ros::Time& time, const ros::Duration timeout) const;

P.S. Most of the examples you find on ROS Answers are likely to be for previous version of tf.

You are confusing the data types (well, they are confusing indeed).

There is geometry_msgs::TransformStamped and tf::StampedTransform in ROS. The first is just a container (C++ ROS message representation) used for data serialization, while the second is a full-featured class that allows to manipulate transformation matrices etc.

The code you gave the link to is using tf::StampedTransform. Also it uses the old tf methods, where lookupTransfromlookupTransform accepts only tf data types and has the following signature:

void lookupTransform(const std::string& target_frame, const std::string& source_frame,
                       const ros::Time& time, StampedTransform& transform) const;

while the one you are trying to use is from tf2:

virtual geometry_msgs::TransformStamped 
    lookupTransform(const std::string& target_frame, const std::string& source_frame,
                    const ros::Time& time, const ros::Duration timeout) const;

P.S. Most of the examples you find on ROS Answers are likely to be for previous version of tf.

You are confusing the data types (well, they are confusing indeed).

There is geometry_msgs::TransformStamped and tf::StampedTransform in ROS. The first is just a container (C++ ROS message representation) used for data serialization, while the second is a full-featured class that allows to manipulate transformation matrices etc.

The code you gave the link to is using tf::StampedTransform. Also it uses the old tf methods, where lookupTransform accepts only tf data types and has the following signature:

void lookupTransform(const std::string& target_frame, const std::string& source_frame,
                       const ros::Time& time, StampedTransform& transform) const;

while the one you are trying to use is from tf2:

virtual geometry_msgs::TransformStamped 
    lookupTransform(const std::string& target_frame, const std::string& source_frame,
                    const ros::Time& time, const ros::Duration timeout) const;

P.S. Most of the examples you find on ROS Answers are likely to be for previous version of tf.


EDIT:

If the only thing you need is Euler angles, then it is enough. Though, if you are going to work with the whole transform, then it is better to convert the whole geometry_msgs::TransformStamped to tf::StampedTransform, or acquire the latter directly with tf::lookupTransform (in tf1).