Ask Your Question
0

Convert PoseWithCovariance to Transform

asked 2017-09-15 07:27:28 -0500

Is it possible to convert geometry_msgs/PoseWithCovariance to geometry_msgs/Transform and how?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-15 08:28:27 -0500

If covariance is not important:

geometry_msgs::PoseWithCovariance poseWithCovarianceMsg;
tf::Transform transform;
transform.setRotation(tf::Quaternion(poseWithCovarianceMsg.pose.orientation.x,
                                     poseWithCovarianceMsg.pose.orientation.y,
                                     poseWithCovarianceMsg.pose.orientation.z,
                                     poseWithCovarianceMsg.pose.orientation.w));
transform.setOrigin(tf::Vector3(poseWithCovarianceMsg.pose.position.x,
                                poseWithCovarianceMsg.pose.position.y,
                                poseWithCovarianceMsg.pose.position.z));

geometry_msgs::Transform transformMsg;
tf::transformTFToMsg(transform, transformMsg);
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-09-15 07:27:28 -0500

Seen: 264 times

Last updated: Sep 15 '17