Crazyflie 2.0 frame of reference

Post here to get support
Post Reply
Nacho
Beginner
Posts: 2
Joined: Sun Feb 12, 2017 4:14 pm

Crazyflie 2.0 frame of reference

Post by Nacho »

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
Sin título.png
The PCB has these ones marked on it
Sin título2.png
Sin título2.png (10.89 KiB) Viewed 2958 times
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!
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Crazyflie 2.0 frame of reference

Post by tobias »

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.
Nacho
Beginner
Posts: 2
Joined: Sun Feb 12, 2017 4:14 pm

Re: Crazyflie 2.0 frame of reference

Post by Nacho »

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?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Crazyflie 2.0 frame of reference

Post by tobias »

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 :oops:.
Post Reply