Ask Your Question
1

from PoseStamped message to tf StampedTransform

asked 2011-06-19 23:12:53 -0500

quimnuss gravatar image

updated 2014-01-28 17:09:53 -0500

ngrennan gravatar image

What's the neatest way to change a PoseStamped message into a StampedTransform to be published through a transform_broadcaster?

edit retag flag offensive close delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2011-06-20 01:58:39 -0500

quimnuss gravatar image

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.

edit flag offensive delete publish link more

Comments

1
I think in line 3, for "tf::Quaternion", the first argument should be "orientation.x" instead of "position.x", right? alfa_80 ( 2011-11-02 04:40:02 -0500 )edit
5

answered 2011-06-19 23:29:40 -0500

updated 2011-06-19 23:35:22 -0500

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 flag offensive delete publish link more

Comments

I find these easy to use.

aknirala ( 2013-04-12 19:54:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
2 followers

Stats

Asked: 2011-06-19 23:12:53 -0500

Seen: 2,703 times

Last updated: Jun 20 '11