What is x-client mode?

Discussions and questions about the Crazyflie Nano Quadcopter
Post Reply
wtsang02
Beginner
Posts: 9
Joined: Fri Sep 27, 2013 7:03 pm

What is x-client mode?

Post by wtsang02 »

Hi, theres alot of tail about x-client I have found but I cannot find a page where explains what is x-client mode.

I see in code:

Code: Select all

   if (xmode) {
            this.pitch = 0.707f * (roll + pitch);
            this.roll = 0.707f * (roll - pitch);
        }
But whats so spiecal about 0.707? Thanks.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: What is x-client mode?

Post by arnaud »

Hi,

X client mode means that we rotate the [pitch,roll] setpoint in the client so that when the joystick is pushed front, the copter is requestet to go 45degres on the side (front in X mode).

The formula to do the rotation is given by wikipedia: http://en.wikipedia.org/wiki/Rotation_% ... ix_algebra which for 45degrees gives:
x' = x cos(pi/4) - y sin(pi/4)
y' = x sin(pi/4) + y sin(pi/4)

cos(pi/4) = sin(pi/4) = 1/sqrt(2)

So
x' = (1/sqrt(2)) * (x-y)
y' = (1/sqrt(2)) * (x+y)

0.707 is an aproximation of 1/sqrt(2).
wtsang02
Beginner
Posts: 9
Joined: Fri Sep 27, 2013 7:03 pm

Re: What is x-client mode?

Post by wtsang02 »

Thanks a lot for the reply. Now I understand.
Post Reply