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
I thing that to have de right angle you need to know witch is the order of the euler angles you need regarding to the physics of you gimball.
if the gimball . is suspend you will have
- first a yaw rotation around Y
- then a tilt rotation around x
- then a roll but this angle is not need if your gimball do not compensate roll.
so , you just need to do the math multiplying the 3 rotation matrix.
and from there extract the angles .
Jordi and I use two different coordinate systems, that is the problem.
When I started, the coordinate system I used was based on the labeling that SparkFun put on the board, and the way the board would normally be mounted: X positive is toward the left wing. Y positive is toward the nose. Z positive is down.
After my board and firmware was done, Paul Bizard pointed out to me that the aviation standard is X positive is toward the nose, Y positive is toward the right wing, and Z positive is down. But it was too late, and too confusing for me to change. (When I do any coding, I look at the labels on the board.)
Jordi asked for my help in developing his IMU firmware, we decided to use the aviation standard, since he was still free to select his hardware design and axis labeling.
So, your equations are probably inconsistent with my implementation. Certainly you cannot use Jordi's equations with my rmat.
I think that you can use Jordi's equations if you swap the X and Y rows and columns of my rmat and put the results into Jordi's equations.
Regarding the format, the rmat values in my firmware are stored as scaled signed integers. The scaling is such that the real values of + or - 1 are mapped to the integer values of + or - 16384.
Let me know if you are able to rearrange your equations to match the coordinate system that I used. I think that you will be able to do it, if not, let me know, I will give it a try.
I apologize for not using the same coordinate system for both my IMU and when I helped Jordi.
Permalink Reply by viky on October 13, 2009 at 9:52pm
Oh thanks bill i will soon post the results. well i thinks angles of roll and pitch will be something like this:
rollleft (-ve angle) // -ve g
rollright(+ve angle) // +ve g
well let me check how it works for roll and pitch display.
on more question bill:
Since the telemetry data comes after every one second so i m expecting it will result the delay in roll and pitch display at ground station with respect to the real position of plane , is there any solution for it .
If we decrease the interrupt timing and make it some 1/2 sec then in case of lat long it may not be useful because GPS takes more time to refresh its new coordinates.
Or is there any option to provide like jordi's do send lat long once and then send roll pitch data five times
Something like this
Permalink Reply by viky on October 14, 2009 at 1:12am
Roll results :
with this formulae g=atan2(rmat[6],rmat[8]); // roll
i have got these results
The results seems to be ok for roll.
And for left rotation(if i see the board from back side ) it gives result in +ve angles and in right rotation it gives -ve angles..