from PoseStamped message to tf StampedTransform
What's the neatest way to change a PoseStamped message into a StampedTransform to be published through a transform_broadcaster?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
What's the neatest way to change a PoseStamped message into a StampedTransform to be published through a transform_broadcaster?
Have a look at those:
name: tf::poseStampedTFToMsg
cmd: /^static inline void poseStampedTFToMsg(const Stamped<Pose>& bt, geometry_msgs::PoseStamped & msg)$/
namespace: tf
signature: (const Stamped<Pose>& bt, geometry_msgs::PoseStamped & msg)
filename: /opt/ros/diamondback/stacks/geometry/tf/include/tf/transform_datatypes.h
name: tf::poseStampedMsgToTF
cmd: /^static inline void poseStampedMsgToTF(const geometry_msgs::PoseStamped & msg, Stamped<Pose>& bt)$/
namespace: tf
signature: (const geometry_msgs::PoseStamped & msg, Stamped<Pose>& bt)
filename: /opt/ros/diamondback/stacks/geometry/tf/include/tf/transform_datatypes.h
This is code I used a while ago for the inverse transformation:
tf::Transform grasp_tf(gripperRotation, gripperOrigin);
tf::Stamped<tf::Pose> grasp_tf_pose(grasp_tf);
geometry_msgs::PoseStamped msg;
tf::poseStampedTFToMsg (grasp_tf_pose, msg);
Edit:
I just needed to to that exact thing, so I mixed tf::poseStampedMsgToTF and tf::TransformStampedMsgToTF
namespace //anonymous
{
using namespace tf;
inline void myPoseMsgToTF(const geometry_msgs::Pose& msg, Transform& bt)
{
bt = Transform(Quaternion(msg.orientation.x,
msg.orientation.y,
msg.orientation.z,
msg.orientation.w),
Vector3(msg.position.x, msg.position.y, msg.position.z));
}
///Sets the child frame fixed to "camera"
inline void myPoseStampedMsgToTF(const geometry_msgs::PoseStamped & msg, StampedTransform& bt)
{
myPoseMsgToTF(msg.pose, bt);
bt.stamp_ = msg.header.stamp;
bt.frame_id_ = msg.header.frame_id;
bt.child_frame_id_ = "camera";
ROS_WARN_ONCE("You are using a path which does not carry the information about the "
"name of the sensor frame. Using 'camera' as child_frame_id.\n"
"Make sure the positions in your path are those of the 'camera' frame.");
}
}//anon namespace
I don't know. In Indigo you should probably use tf2 anyway.
From your suggestion, I couldn't find a satisfactory way to change from tf::Stamped<tf::pose> to tf::PoseStamped, and it was getting too confusing with bullet, so I just went for the easy, less-elegant:
tf::Transform transform_auxiliar;
transform_auxiliar.setOrigin(tf::Vector3(pose_msg.pose.position.x, pose_msg.pose.position.y, pose_msg.pose.position.z));
transform_auxiliar.setRotation(tf::Quaternion( pose_msg.pose.position.x, pose_msg.pose.orientation.y, pose_msg.pose.orientation.z, pose_msg.pose.orientation.w));
tf_br.sendTransform(tf::StampedTransform(transform_auxiliar, ros::Time::now(), "openni_camera", "graspingPoint"));
Thanks, though.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2011-06-19 23:12:53 -0500
Seen: 16,043 times
Last updated: Mar 22 '17
transformPoint using tf::Transform?
Determining number of subscribers to a TransformBroadcaster
Get robot position und orientation (in degree) from TF
What is the difference between geometry and tf quaternions?
Problem with tf on multiple machines
Apply transformation matrix to existing frame
turtle tf tutorial fails to work
how to make end effector look at object?
What is the difference between static_transform_publisher and tf_echo command?