Correlation between motor oder in the docs and in the code

Hi there,

I am trying to understand how the motor order here ( https://ardupilot.org/copter/_images/motororder-quad-x-2d.png, https://ardupilot.org/copter/_images/APM_2_5_MOTORS_QUAD_enc.jpg ) is related to the code:

bool AP_MotorsMatrix::setup_quad_matrix(motor_frame_type frame_type)
{
...
    case MOTOR_FRAME_TYPE_X: {
        _frame_type_string = "X";
        static const AP_MotorsMatrix::MotorDef motors[] {
            {   45, AP_MOTORS_MATRIX_YAW_FACTOR_CCW,  1 },
            { -135, AP_MOTORS_MATRIX_YAW_FACTOR_CCW,  3 },
            {  -45, AP_MOTORS_MATRIX_YAW_FACTOR_CW,   4 },
            {  135, AP_MOTORS_MATRIX_YAW_FACTOR_CW,   2 },
        };
        add_motors(motors, ARRAY_SIZE(motors));
        break;
    }
...
}

In the code the CCW motors are 1 and 3, and CW motors are 2 and 4. But in the picture from the doc:
CCW → 1, 2
CW → 3, 4

According to my tests ( look at the text below ):
CC2 → 4 (A), 2 (C)
CW → 1 (B), 3 (D)

I’ve configure the drone ( by using SERVO OUTPUT tab in Mission Planner )


as it is shown in the picture QUAD X ( https://ardupilot.org/copter/_images/APM_2_5_MOTORS_QUAD_enc.jpg ) so when I am pressing in Test Motor in Mission Planner:

  1. TEST A → the top right mottor is spinning
  2. TEST B → the rear right motor is spinning
  3. TEST C → the rear left
  4. TEST D → the top left

But drones are doing backlip instead of flying.

Are the propellers mounted correctly? Do they provide lift when rotating?
Is the FC orientation correctly set?

  1. It seems to me that props are mounted correctly:
  2. It seems that no, because the drone does tha backflip ( https://drive.google.com/file/d/1mqkNMBsRceGg0ZW7biLVMKZMPOZ53EcA/view?usp=sharing )
  3. FC is looking where the camera ( arrow on FC is looking at camera, on the picture above it is where battery cable ). Do you mean that in Mission Planner? What variable in Mission Plannder stands for that?

I have the SpeedyBee v3 ( https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcT5U_o9-8qBjyUEl4fn1DSKfVsb1KF6qO0JXVuIAqfz7QFBlK3eilAod_hTrB3CgiTQS_mzT19_q9YdZjyBPMNZIEOEmgk7rOM8v3YdkwrVpktxVojpxDFuEAMgn30APAJAkhk5romv&usqp=CAc ), does it mean that AHRS_ORIENTATION should be Roll90? From the doc:

For Roll values, positive means roll right (i.e. “Roll90” means board is rolled right 90 degrees so the white arrow still points forward but the board is standing on its right edge).

I think that the issue is that I have AHRS_ORIENTATION=4 ( for some reason ) what is not true and should be 0 in my case. I’ll double check that.