Hi,
I am trying to understand the control system of the Crazyflie 2.0 and finding some difficulties while coping with the frame of reference used in the firmware.
I understand that following positive angles apply: pitch up,roll right, yaw CCW.
The IMU uses the following frames of reference
The PCB has these ones marked on it
But in the firmware some signs are changed, probably to achive the angle sign criteria above.
It would be very good if somebody could confirm the final frame of reference used for the calculations in the controller part of the firmware, e.g. XYZ axis positive direction, as well as the changes in the signs that are necesary to be introduced in the IMU signal to achive this.
Thanks!
Crazyflie 2.0 frame of reference
Re: Crazyflie 2.0 frame of reference
Hi Nacho!
Can agree it is a bit confusing as the screen print shows MPU9250 reference and not frame reference. The frame reference is with positive X in front direction, thus rotated 90deg CW done, as done in this function.
Can agree it is a bit confusing as the screen print shows MPU9250 reference and not frame reference. The frame reference is with positive X in front direction, thus rotated 90deg CW done, as done in this function.
Re: Crazyflie 2.0 frame of reference
Hi tobias,
Thank you for the hint!
So, if I understand it correctly, the original axis used by the MPU9250 are rotated as follows:
Xo->Yf
Yo->-Xf
Zo->Zf
Everything seems to match now, except for the sign of the pitch around the new Y axis which is suposed to remain positive for pitch down, while the final sign criteria is oposite. Is the pitch sign changed anywhere else?
Thank you for the hint!
So, if I understand it correctly, the original axis used by the MPU9250 are rotated as follows:
Xo->Yf
Yo->-Xf
Zo->Zf
Everything seems to match now, except for the sign of the pitch around the new Y axis which is suposed to remain positive for pitch down, while the final sign criteria is oposite. Is the pitch sign changed anywhere else?
Re: Crazyflie 2.0 frame of reference
Hi Nacho,
I think you found a problematic spot and looking at it I believe we are using roll, pitch, yaw the wrong way. The axis is rotated as follows:
Xo = -Yf
Yo = Xf
Zo = Zf
However according to wikipedia it should be rotated
Xo = -Yf
Yo = -Xf
Zo = -Zf
That way positive pitch would make a quad move backwards, a bit "un-intuitive", and that is where it all started I think. Now this "wrong" definition is used in all clients (cfclient, android, osx) which makes it hard to correct .
I think you found a problematic spot and looking at it I believe we are using roll, pitch, yaw the wrong way. The axis is rotated as follows:
Xo = -Yf
Yo = Xf
Zo = Zf
However according to wikipedia it should be rotated
Xo = -Yf
Yo = -Xf
Zo = -Zf
That way positive pitch would make a quad move backwards, a bit "un-intuitive", and that is where it all started I think. Now this "wrong" definition is used in all clients (cfclient, android, osx) which makes it hard to correct .