0
$\begingroup$

Rosanswers logo

I have two geometry_msgs::Pose structure p1 and p2. Each of them contains a geometry_msgs::Point and geometry_msgs::Quaternion. I would like to calculate the different between the two poses. I know the difference in position is just the subtraction. But I am not sure how to calculate the difference in orientation. I know for tf::quaternion, I can use inverse, but the function "inverse" does not seem available for geometry_msgs::quaternion.


Originally posted by AutoCar on ROS Answers with karma: 102 on 2018-12-10

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

See the tutorial on calculating a relative rotation between quaternions. After you have the difference as a quaternion, you can convert it to roll/pitch/yaw. For Python, use quaternion_to_euler() for that. Finally, it's no problem to convert between tf and geometry_msg quaternions. The tutorial also has some examples of that.

Please add to the tutorial if it's not explicit enough. For example, I see that it shows how to convert tf->geometry_msgs but not the other way around.


Originally posted by AndyZe with karma: 2331 on 2018-12-10

This answer was ACCEPTED on the original site

Post score: 4

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.