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

Revision history [back]

I think this issue arises from a lack of context on Quaternions. I would recommend looking into resources to better your knowledge of them before attempting what you're trying to do (this is a good learning experience!). What you likely want to do is convert the quaternion to RPY with TF or another equivalent tool and base your logic for your application based on them to give yourself a physical understanding of what's going on.

After that, I would just make a quaternion of the map frame orientation and compare against the robot's to determine the relative difference to know if "to" or "away" from the origin.

https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation