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, 01 Dec 2016 01:23:40 -0600A problem about the conversion from Euler angle to quaternionhttps://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/Hi, all. we are trying to construct a 3D scanning system to implement 3D mapping algorithm. Its hardware system is showed in following figure : ![image description](/upfiles/14804590479821701.png).
A Hokuyo laser(UTM-30LX) is mounted on a plate which is rotated by a Dynamixel([MX-28R](http://support.robotis.com/beta/en/product/dynamixel/mx_series/mx-28.htm)). The Dynamixel works in back_and_ forth way. Its rotation angles' range is between -1.57 and 1.57, i.e. [-90° 90°] .
The tf tree is showed in following figure : ![image description](/upfiles/14804597194694478.png).
The frame_id "Laser" is the local scanning coordinate of Hokuyo laser. The frame_id "HN07_N101" is the local rotating(in back_and_forth way) coordinate of MX-28R. The frame_id "BaseLink" is the base_link coordinate of the system. The joint between "Laser" and "HN07_N101" is fixed. But there is a revolute joint between "HN07_N101" and "BaseLink".
The frame “HN07_N101” is rotated around its own "z" axis which is the blue axis in above figure. In the coordinate of "BaseLink", the origin of "HN07_N101" is (0.22375, 0, 0.1367), the initial orientation is (0.5, 0.5, 0.5, 0.5), as the left part of above figure shows.
As the Dynamixel rotating the Hokuyo laser, it is necessary to compute the coordinate transform between parent frame "BaseLink" and child frame "HN07_N101". The dynamixel motor sends [JointState](https://github.com/arebgun/dynamixel_motor/blob/master/dynamixel_msgs/msg/JointState.msg) message which contain the current rotating angle around "Z" axis in radians.
However, when I run my project, the transform between pararent "BaseLink" and "HN07_N101" is ***
**not smooth.**
***. Although there is no jump in the value of Dynamixel's msg, both the frame "HN07_N101"(including its child frame "Laser") and the 3D models of Hokuyo and Dynamixel alway flicking. The so called "flicking" is, while the frame "HN07_N101" is rotating, the green "y" axis and the red "x" axis suddenly switch positions with each other and recover.
I think the flicking 3D models displayed in rviz means that there is problem in the transfrom between "BaseLink" and "HN07_N101". But I don't know where the problem is.
Is the problem at the conversion from Euler angle (the current_pos in Dynamixel's msg) to the quaternion ( the variable "q" in above code) ?
Looking forwards any valuable advices. Thank you very much!Tue, 29 Nov 2016 17:30:09 -0600https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/Comment by scopus for <p>Hi, all. we are trying to construct a 3D scanning system to implement 3D mapping algorithm. Its hardware system is showed in following figure : <img alt="image description" src="/upfiles/14804590479821701.png">.</p>
<p>A Hokuyo laser(UTM-30LX) is mounted on a plate which is rotated by a Dynamixel(<a href="http://support.robotis.com/beta/en/product/dynamixel/mx_series/mx-28.htm">MX-28R</a>). The Dynamixel works in back_and_ forth way. Its rotation angles' range is between -1.57 and 1.57, i.e. [-90° 90°] .</p>
<p>The tf tree is showed in following figure : <img alt="image description" src="/upfiles/14804597194694478.png">.</p>
<p>The frame_id "Laser" is the local scanning coordinate of Hokuyo laser. The frame_id "HN07_N101" is the local rotating(in back_and_forth way) coordinate of MX-28R. The frame_id "BaseLink" is the base_link coordinate of the system. The joint between "Laser" and "HN07_N101" is fixed. But there is a revolute joint between "HN07_N101" and "BaseLink". </p>
<p>The frame “HN07_N101” is rotated around its own "z" axis which is the blue axis in above figure. In the coordinate of "BaseLink", the origin of "HN07_N101" is (0.22375, 0, 0.1367), the initial orientation is (0.5, 0.5, 0.5, 0.5), as the left part of above figure shows.</p>
<p>As the Dynamixel rotating the Hokuyo laser, it is necessary to compute the coordinate transform between parent frame "BaseLink" and child frame "HN07_N101". The dynamixel motor sends <a href="https://github.com/arebgun/dynamixel_motor/blob/master/dynamixel_msgs/msg/JointState.msg">JointState</a> message which contain the current rotating angle around "Z" axis in radians. </p>
<p>However, when I run my project, the transform between pararent "BaseLink" and "HN07_N101" is <em>*</em></p>
<p><strong>not smooth.</strong></p>
<p><em>*</em>. Although there is no jump in the value of Dynamixel's msg, both the frame "HN07_N101"(including its child frame "Laser") and the 3D models of Hokuyo and Dynamixel alway flicking. The so called "flicking" is, while the frame "HN07_N101" is rotating, the green "y" axis and the red "x" axis suddenly switch positions with each other and recover.</p>
<p>I think the flicking 3D models displayed in rviz means that there is problem in the transfrom between "BaseLink" and "HN07_N101". But I don't know where the problem is. </p>
<p>Is the problem at the conversion from Euler angle (the current_pos in Dynamixel's msg) to the quaternion ( the variable "q" in above code) ?</p>
<p>Looking forwards any valuable advices. Thank you very much!</p>
https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249140#post-id-249140Thank you very much for you attention! What I did is from [this tutorial](http://wiki.ros.org/urdf/Tutorials/Using%20urdf%20with%20robot_state_publisher) which publishs a *transform* and a *JointState*.Wed, 30 Nov 2016 17:14:55 -0600https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249140#post-id-249140Comment by gvdhoorn for <p>Hi, all. we are trying to construct a 3D scanning system to implement 3D mapping algorithm. Its hardware system is showed in following figure : <img alt="image description" src="/upfiles/14804590479821701.png">.</p>
<p>A Hokuyo laser(UTM-30LX) is mounted on a plate which is rotated by a Dynamixel(<a href="http://support.robotis.com/beta/en/product/dynamixel/mx_series/mx-28.htm">MX-28R</a>). The Dynamixel works in back_and_ forth way. Its rotation angles' range is between -1.57 and 1.57, i.e. [-90° 90°] .</p>
<p>The tf tree is showed in following figure : <img alt="image description" src="/upfiles/14804597194694478.png">.</p>
<p>The frame_id "Laser" is the local scanning coordinate of Hokuyo laser. The frame_id "HN07_N101" is the local rotating(in back_and_forth way) coordinate of MX-28R. The frame_id "BaseLink" is the base_link coordinate of the system. The joint between "Laser" and "HN07_N101" is fixed. But there is a revolute joint between "HN07_N101" and "BaseLink". </p>
<p>The frame “HN07_N101” is rotated around its own "z" axis which is the blue axis in above figure. In the coordinate of "BaseLink", the origin of "HN07_N101" is (0.22375, 0, 0.1367), the initial orientation is (0.5, 0.5, 0.5, 0.5), as the left part of above figure shows.</p>
<p>As the Dynamixel rotating the Hokuyo laser, it is necessary to compute the coordinate transform between parent frame "BaseLink" and child frame "HN07_N101". The dynamixel motor sends <a href="https://github.com/arebgun/dynamixel_motor/blob/master/dynamixel_msgs/msg/JointState.msg">JointState</a> message which contain the current rotating angle around "Z" axis in radians. </p>
<p>However, when I run my project, the transform between pararent "BaseLink" and "HN07_N101" is <em>*</em></p>
<p><strong>not smooth.</strong></p>
<p><em>*</em>. Although there is no jump in the value of Dynamixel's msg, both the frame "HN07_N101"(including its child frame "Laser") and the 3D models of Hokuyo and Dynamixel alway flicking. The so called "flicking" is, while the frame "HN07_N101" is rotating, the green "y" axis and the red "x" axis suddenly switch positions with each other and recover.</p>
<p>I think the flicking 3D models displayed in rviz means that there is problem in the transfrom between "BaseLink" and "HN07_N101". But I don't know where the problem is. </p>
<p>Is the problem at the conversion from Euler angle (the current_pos in Dynamixel's msg) to the quaternion ( the variable "q" in above code) ?</p>
<p>Looking forwards any valuable advices. Thank you very much!</p>
https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249154#post-id-249154I know the tutorial, but it's really not necessary in your case to broadcast the transforms yourself.Thu, 01 Dec 2016 01:23:40 -0600https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249154#post-id-249154Comment by gvdhoorn for <p>Hi, all. we are trying to construct a 3D scanning system to implement 3D mapping algorithm. Its hardware system is showed in following figure : <img alt="image description" src="/upfiles/14804590479821701.png">.</p>
<p>A Hokuyo laser(UTM-30LX) is mounted on a plate which is rotated by a Dynamixel(<a href="http://support.robotis.com/beta/en/product/dynamixel/mx_series/mx-28.htm">MX-28R</a>). The Dynamixel works in back_and_ forth way. Its rotation angles' range is between -1.57 and 1.57, i.e. [-90° 90°] .</p>
<p>The tf tree is showed in following figure : <img alt="image description" src="/upfiles/14804597194694478.png">.</p>
<p>The frame_id "Laser" is the local scanning coordinate of Hokuyo laser. The frame_id "HN07_N101" is the local rotating(in back_and_forth way) coordinate of MX-28R. The frame_id "BaseLink" is the base_link coordinate of the system. The joint between "Laser" and "HN07_N101" is fixed. But there is a revolute joint between "HN07_N101" and "BaseLink". </p>
<p>The frame “HN07_N101” is rotated around its own "z" axis which is the blue axis in above figure. In the coordinate of "BaseLink", the origin of "HN07_N101" is (0.22375, 0, 0.1367), the initial orientation is (0.5, 0.5, 0.5, 0.5), as the left part of above figure shows.</p>
<p>As the Dynamixel rotating the Hokuyo laser, it is necessary to compute the coordinate transform between parent frame "BaseLink" and child frame "HN07_N101". The dynamixel motor sends <a href="https://github.com/arebgun/dynamixel_motor/blob/master/dynamixel_msgs/msg/JointState.msg">JointState</a> message which contain the current rotating angle around "Z" axis in radians. </p>
<p>However, when I run my project, the transform between pararent "BaseLink" and "HN07_N101" is <em>*</em></p>
<p><strong>not smooth.</strong></p>
<p><em>*</em>. Although there is no jump in the value of Dynamixel's msg, both the frame "HN07_N101"(including its child frame "Laser") and the 3D models of Hokuyo and Dynamixel alway flicking. The so called "flicking" is, while the frame "HN07_N101" is rotating, the green "y" axis and the red "x" axis suddenly switch positions with each other and recover.</p>
<p>I think the flicking 3D models displayed in rviz means that there is problem in the transfrom between "BaseLink" and "HN07_N101". But I don't know where the problem is. </p>
<p>Is the problem at the conversion from Euler angle (the current_pos in Dynamixel's msg) to the quaternion ( the variable "q" in above code) ?</p>
<p>Looking forwards any valuable advices. Thank you very much!</p>
https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249096#post-id-249096I haven't read everything, but can you clarify why you publish the `BaseLink->HN07_N101` transform yourself, instead of using [robot_state_publisher](http://wiki.ros.org/robot_state_publisher)? Just publish the `JointState`s for the appropriate joints, and `robot_state_publisher` will do the rest.Wed, 30 Nov 2016 05:25:56 -0600https://answers.ros.org/question/249058/a-problem-about-the-conversion-from-euler-angle-to-quaternion/?comment=249096#post-id-249096