HI all,
I m on developing a GCS on the basis of rotation matrix elements. Is it possible to display the roll and pitch on the basis of rotation matrix at the output . I m using Bill's UAV DEVboard and getting rmat data at output .
After little analysis i have got few reference to calculate the euler's angle from the rmat data. So i have got these formulas for calculation.
g=atan2(rmat[7],rmat[8]); // roll
a=atan2(rmat[3],rmat[0]); // yaw
b=atan2( -rmat[6],sqrt(rmat[7]^2 + rmat[8]^2)); // pitch
this is what i got , but as i rotate my board roll and yaw results r quite satisfactory , but pitch doesnot make a logic. Is there any mistake in calculations.
I have also gone thru jordi IMU code in which he calculated these parameters like this
Serial.print("RLL:");
Serial.print(ToDeg(atan2(DCM_Matrix[2][1],DCM_Matrix[2][2])));
Serial.print(",PCH:");
Serial.print(ToDeg(asin(DCM_Matrix[2][0])));
Serial.print(",YAW:");
Serial.print(ToDeg(atan2(DCM_Matrix[1][0],DCM_Matrix[0][0])));
1.Are these angles can be used to show the roll and pitch of plane?
2. Is the format of RMAT is different in both codes?
Thanks