Page 1 of 1

What is x-client mode?

Posted: Fri Sep 27, 2013 7:21 pm
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.

Re: What is x-client mode?

Posted: Sun Sep 29, 2013 9:46 am
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).

Re: What is x-client mode?

Posted: Mon Sep 30, 2013 7:45 pm
by wtsang02
Thanks a lot for the reply. Now I understand.