I have the Sparkfun 9DOF Razor board. It is working fine with Python GUI provided at http://www.sparkfun.com/commerce/product_info.php?products_id=9623 which is coded by Jose Julio.

I'm pretty good at rotation matrices and their order of rotation, but not familiar with DCM to Euler angle conversions. The brief description in the Arduino code base is as follows

//

**Axis definition**: // X axis pointing forward (to the FTDI connector)

// Y axis pointing to the right

// and Z axis pointing down.

// Positive pitch : nose up

// Positive roll : right wing down

// Positive yaw : clockwise

**DCM to Euler conversion**

pitch = -asin(DCM_Matrix[2][0]);

roll = atan2(DCM_Matrix[2][1],DCM_Matrix[2][2]);

yaw = atan2(DCM_Matrix[1][0],DCM_Matrix[0][0]);

( I'm unable to trace the mathematics involved in Vpython GUI in implementing rotations of 3D object)

I tried converting the above Euler angles to Rotation matrix as below .

Rotation matrix(R) = AxAyAz

c = cos , s = sin , r = roll, p =pitch , y = yaw

Multiplying the previous rotation matrix with the present , perfect rotation can be achieved.

I got perfect rotations with

**Wii motion plus**gyro data, using the above order of rotation.watch the video https://www.youtube.com/watch?v=MgDUjoKEQ8k

Have a look at Wii motion plus rotation code.txt

I would like to make the Razor 9DOF board work in Visual C++ environment using the rotation matrix .

I have the following doubts .

1. what order i should follow to make it work .

2. Do i have to follow different DCM to Euler angles conversion other than the above method.

where is my mathematics going wrong.

DCMDraft2.pdf in page 10 ,he said relation between the DCM and euler angles is

this can be obtained with AzAyAx order ,I tried this also, but no use .

I tried experimenting few other order of rotations other than AxAyAz. no use.

Hope i will hear especially from

**Doug Weibel**,**Jose Julio ,****Jordi Munoz**and**William Premerlani**.Thanks for reading ....

## Replies