Page 1 of 1

Definition of the 3 axes

Posted: Mon Mar 13, 2017 4:08 am
by twh
Hi all,

Could anyone help me to clarify the definition of the 3 axes used in the firmware.
I am trying to separate the computation of x-axis and y-axis from the z axis's.
For example, one function does position control specifically for x and y axis, the other function does position control specifically for z axis.
The idea of implementing this is when I only make used of camera feeds for x and y axis, but crazyflie's barometer and accelerometer for z-axis.

Now I encounter a problem when I try to do the above steps. I am not sure whether I re-write it in the correct way or not as I have not any background on doing it.
The problem is, for x configuration.
is velocity.x corresponds to roll as I see the position control takes x-axis velocity to compute pid for roll values (e.g. float rollRaw = runPid(state->velocity.x, &this.pidVX,setpoint->velocity.x, DT).
However, in the commander, it seems like the x-axis corresponds to pitch value (e.g. set point->velocity.x = commanderGetActivePitch()/30.0f)

May I know where does x-axis in the firmware point to? is it between M1 and M4 or M3 and M4? Where should the Crazyflie face in front of a webcam if I want to control the x-axis of the Crazyflie?

Thanks a lot :)

Re: Definition of the 3 axes

Posted: Mon Mar 13, 2017 6:59 am
by arnaud
Hi,

The X/Y/Z axis in the Crazyflie are represented in the world frame of reference, so there orientation depends of the yaw.

The crazyflie starts with YAW=0 and that corresponds to X facing the front of the copter (where the antenna is, so going forward will go towards X positive). If you enable the Kalman filter (which I advise you to do, it will help a lot!), the Kalman filter will use the copter dynamic and position informations to keep the yaw accurate.

If you want X/Y in the copter frame of reference instead you can rotate your setpoint with the current YAW.

/Arnaud