ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Thu, 25 May 2017 04:43:19 -0500Quaternion rotationhttps://answers.ros.org/question/262474/quaternion-rotation/Hi guys, i'm having some problems with the rotation through quaternions. I have two quaternions coming one from a nav_msgs::odometry and the other one from a geometry_msgs::pose. I want to rotate the robot until the quaternion of the nav_msgs is equal, or almost equal, to the geometry_msgs one. How is it possible to solve my problem? Thanks in advance.Wed, 24 May 2017 10:24:42 -0500https://answers.ros.org/question/262474/quaternion-rotation/Answer by Chaos for <p>Hi guys, i'm having some problems with the rotation through quaternions. I have two quaternions coming one from a nav_msgs::odometry and the other one from a geometry_msgs::pose. I want to rotate the robot until the quaternion of the nav_msgs is equal, or almost equal, to the geometry_msgs one. How is it possible to solve my problem? Thanks in advance.</p>
https://answers.ros.org/question/262474/quaternion-rotation/?answer=262477#post-id-262477You can obtain the radians value for the yaw through `tf::getYaw` and then compute the angular speed command for the robot.Wed, 24 May 2017 10:39:44 -0500https://answers.ros.org/question/262474/quaternion-rotation/?answer=262477#post-id-262477Comment by Chaos for <p>You can obtain the radians value for the yaw through <code>tf::getYaw</code> and then compute the angular speed command for the robot.</p>
https://answers.ros.org/question/262474/quaternion-rotation/?comment=262523#post-id-262523(0,0,1,1) is not a unitary quaternion. Its norm is 2. You can create quaternion with `tf::createQuaternionFromYaw` or `tf::createQuaternionFromRPY`. Check [this](http://docs.ros.org/lunar/api/tf/html/c++/)Thu, 25 May 2017 04:43:19 -0500https://answers.ros.org/question/262474/quaternion-rotation/?comment=262523#post-id-262523Comment by tonio for <p>You can obtain the radians value for the yaw through <code>tf::getYaw</code> and then compute the angular speed command for the robot.</p>
https://answers.ros.org/question/262474/quaternion-rotation/?comment=262482#post-id-262482I obtain this warning: MSG to TF: Quaternion Not Properly Normalized, what's that? By the way, surfing the web, I found some mathematical formulas that state: yaw = atan2(2(wz+xy),1-2(y^2+z^2)). I compared the result from this formula and the result from tf::getYaw and they are different, which use?Wed, 24 May 2017 11:04:13 -0500https://answers.ros.org/question/262474/quaternion-rotation/?comment=262482#post-id-262482Comment by Chaos for <p>You can obtain the radians value for the yaw through <code>tf::getYaw</code> and then compute the angular speed command for the robot.</p>
https://answers.ros.org/question/262474/quaternion-rotation/?comment=262518#post-id-262518If you got that error, it means that the quaternion was not properly computed. How do you obtain the two quaternions? The norm of the quaternions should always be 1.
In order to compute the yaw, first, you should know how the rotation was built (x-y-z or z-y-x, etc...)Thu, 25 May 2017 02:49:56 -0500https://answers.ros.org/question/262474/quaternion-rotation/?comment=262518#post-id-262518Comment by tonio for <p>You can obtain the radians value for the yaw through <code>tf::getYaw</code> and then compute the angular speed command for the robot.</p>
https://answers.ros.org/question/262474/quaternion-rotation/?comment=262521#post-id-262521If I set an orientation goal (a geometry_msgs::Pose) equal to (0,0,1,1), it should rotate of 180° but the warning shows up, so what's wrong with this?Thu, 25 May 2017 04:30:34 -0500https://answers.ros.org/question/262474/quaternion-rotation/?comment=262521#post-id-262521