ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to calculate the difference between two geometry_msgs::Pose

asked 2018-12-10 13:57:19 -0500

AutoCar gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-10 15:09:49 -0500

AndyZe gravatar image

updated 2018-12-10 15:13:04 -0500

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.

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



Asked: 2018-12-10 13:57:19 -0500

Seen: 3,158 times

Last updated: Dec 10 '18