Tuesday, September 4, 2012

QuadCopter Stabilization & Control System "X & Plus Configuration"

QuadCopter Balancing & Controlling Separation

This topic discusses how to separate between balancing quadcopter and controlling it.

First let us discuss the balancing control techniques in different quadcopter modes. Quadcopter can fly in (+) configuration and (X) configuration. The only difference between these modes is where the front of the quad is.

The following diagram illustrates the difference.

Quadcopter Configuration "X & Plus"

Plus (+) Configuration Control

In this configuration the control as follows:
// Pitch Control
M1 = M1 + RX(Elevator);
M4 = M4 - RX(Elevator);
// Roll Control
M2 = M2 + RX(Aileron);
M3 = M3 - RX(Aileron);

This is very simple control and is found in all quadcopter code. Sure there are some checks here and there to avoid motor stopping or saturating.  But the flying logic is always as above. There is also a scaling factor that is used to determine the sensitivity of the sticks and a Divide factor that limits the value range.

X Configuration Control

In this configuration the control as follows:
// Pitch Control
M1 = M1 + RX(Elevator) /2;
M3 = M3 + RX(Elevator) /2;
M4 = M4 - RX(Elevator) /2;
M2 = M2 - RX(Elevator) /2;

// Roll Control 
M1 = M1 + RX(Aileron)/2;
M2 = M2 + RX(Aileron) /2;
M3 = M3 - RX(Aileron) /2;
M4 = M4 - RX(Aileron) /2;

As we can see this is the same logic, we only assumes that M1 & M3 together acts as a single virtual motor in the front, and M2 & M4 together acts as a virtual motor in the rear. Other than that it is the very same logic.
Same considerations and factors applied in the PLUS configuration go here as well.

Stabilization System

Now let us see the stabilization system. The idea is simple, if the quad is falling to the right then speed up the right motor and slow the left one with the same amount and vice versa. Also if the quad is falling down from the front arm then speed up the M1 motor and slow down  M4. The rule is written as follows.

M1 = M1 + PitchAmount  *  PitchGain
M4 = M4 -  PitchAmount  *  PitchGain
M2 = M2 + RollAmount   *   RollGain
M3 = M3  - RollAmount   *   RollGain

This is the basic rule that should be found in all quadcopter programs. The main difference between the different firmware approaches is how to calculate PitchAmount and RollAmount. This can simply be read from a Gyro sensor and multiply it by a constant factor to adjust the range, or we can use PID approach or even Kalman filter and combine Gyro with Acc sensors to get the exact degree.
The Gain factor is used to determine the sensitivity. Other checks such as trimming are common in quadcopter code.

Do we need Different Stabilization for X-Configuration?

Well in almost all quadcopter programs you will find that stabilization and control calculation follows the same concept. i.e. if we use X-Quadcopter then we add the PitchAmount to both motors M1 & M2. Also RollAmount is added to motors M1 & M3. This is valid approach but in fact it is not necessary at all, also there is a major drawback here.
It is not necessary because the stabilization control of Plus configuration can stabilize quadcopter if there is a simultaneous picth & roll forces, that means if the Control System is Plus of X the Stabilization System can stabilize both using the same PLUS configuration.
The main drawback is that Stabilization control requires the orient the control board so that its onboard gyro and acc are in the right directions, so you cannot switch between PLUS configuration to X-Configuration without reorient the board. So if we can keep the Stabilization System and only change the Control System we don’t need to reorient the board as Control System has nothing to do with the board sensors it only change the signal values sent to different motors.

HefnyCopter has implemented this idea successfully as in the below video.

Also please read my other topic about Gyro Noise Filtering.

See newest article Quadcopter Flight-Control  Framework


  1. A new topic about quadcopter stabilization and different roles of sensors on http://hefnycopter.net/index.php/developing-source-code/22-quadcopter-control-function-layers.html

  2. Which one is better, plus or x configuration?

  3. Well if motors and ESC are all identical then there should be no difference -based on my knowledge-.
    However this is not the case, so using all four motors to navigate in X config instead of using 2 for each direction in Plus config helps to average individual motors response so X should be smoother.
    In my own experience I found no major difference but X is a bit smoother.

  4. So it is better to make an X config especially if you'll mount a camera on your quadcopter because of its smoothness. Thank you sir for the info.

    1. I agree with ur opinion.
      u welcome :)

    2. This comment has been removed by the author.

    3. if u mount cam on top of quad then X is almost a must to avoid facing the front propeller.

  5. What is pitch/roll amount and pitch/roll gain? and how to identify them in our sensor? I used wii motion plus and nunchuk.

    1. This is only a white paper ... no specific quadcopter or system -although the snippets is taken from HefnyCopter for KKv2.1 code.

      rule...set I=0, increase P till it starts to osc. then reduce it again till stops osc.
      then try to inc I....

  6. asl mohammad am yassin from kenya and am interested in doing a quadrocopter project am pretty new to it and was looking for some advice am planning to use an arduino board any help will be appreciated reply to my email akliyobarre@gmail.com thanks brother

    1. check this video
      if u can get sensor GY-85 it will be a piece of cake

  7. Hello, I'm writing my own code for a PID controller. I want to do it like Aeroquad using rate mode and stable mode. I'm just confused about how do we use the gyro data in the rate mode? I mean they're so unreliable