Gazebo: Q&A Forum - RSS feedhttp://answers.gazebosim.org/questions/Open source question and answer forum for GazeboenCopyright Askbot, 2010-2011.Sun, 24 Mar 2019 08:48:23 -0500Compute roll, pitch and yaw from 3D vectorhttp://answers.gazebosim.org/question/22154/compute-roll-pitch-and-yaw-from-3d-vector/ Hi !
I'm trying to build SDF tree models from a description file.
The branches are modeled by cylinders.
For each cylinder, I have : x, y, z : coords of the cylinder, vx, vy, vz : vector supporting the cylinder.
Since the `<pose>` takes roll, pitch and yaw angles to build a cylinder, I have to compute them from the direction vector (vx, vy, vz).
Here's how I do it, using `numpy`:
`roll = np.arctan2(vz, vy)`
`pitch = np.arctan2(vx, vz)`
`yaw = np.arctan2(vy, vx)`
I'm not getting the results I want, some of the branches are clearly misplaced. I noticed that Gazebo places a cylinder along the z axis if you provide yaw, pitch, roll = 0, so I tried to rotate by 90° on the x axis like so :
`roll = np.arctan2(vz, vy) + 1.5708`
without success.
If you have any advice on how to get these Euler angles right, feel free to share !
Have a nice day.
LoicSun, 24 Mar 2019 08:48:23 -0500http://answers.gazebosim.org/question/22154/