tf2::convert is not designed to convert one message to a different message.
http://docs.ros.org/kinetic/api/tf2/h...
Technically, geometry_msgs::Transform and geometry_msgs::Pose are different data, though I frequently find that I want to convert between the two. You can overload "convert" or use a different function name in a helper file.
namespace tf2
{
inline
void convert(const geometry_msgs::Transform& trans, geometry_msgs::Pose& pose)
{
pose.orientation = trans.rotation;
pose.position.x = trans.translation.x;
pose.position.y = trans.translation.y;
pose.position.z = trans.translation.z;
}
inline
void convert(const geometry_msgs::Pose& pose, geometry_msgs::Transform& trans)
{
trans.rotation = pose.orientation;
trans.translation.x = pose.position.x;
trans.translation.y = pose.position.y;
trans.translation.z = pose.position.z;
}
inline
void convert(const geometry_msgs::TransformStamped& trans, geometry_msgs::PoseStamped& pose)
{
convert(trans.transform, pose.pose);
pose.header = trans.header;
}
inline
void convert(const geometry_msgs::PoseStamped& pose, geometry_msgs::TransformStamped& trans)
{
convert(pose.pose, trans.transform);
trans.header = pose.header;
}
}