ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to calculate the difference between two geometry_msgs::Pose

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

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
4

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

AndyZe gravatar image

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

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

Question Tools

2 followers

Stats

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

Seen: 4,010 times

Last updated: Dec 10 '18