Softivation

Drone flips on takeoff, Pixhawk motor test looks fine

The drone flips on takeoff even though the motor test looks fine. The letters in Mission Planner's motor test show the position on the frame, and the order changes with FRAME_TYPE.

Furkan IŞIKAY 5 min read

You fit the propellers, nudge the throttle up a touch, and the drone rolls to one side before it lifts off. You take the props off and go back to the motor test; all four motors spun in turn and nothing looked wrong on screen.

Both statements can be true at once. The motor test doesn't confirm what you think it does.

The letters in the motor test aren't motor numbers

Mission Planner's motor test screen shows A, B, C, D. These letters don't number the autopilot's output pins; they number positions on the frame. The test always proceeds clockwise. Which position it starts from depends on the frame type setting.

The ArduPilot wiki says this in one sentence: on a Plus frame, the first motor to spin is the one straight ahead, and on an X frame it's the motor just to the right of the nose. In both cases the order follows clockwise.

In the two frames below, look at where letter A sits and at the output number next to it.

The same letter spins a different output on the two frame types

On the X frame, letter A spins OUT 1; on the Plus frame, it spins OUT 3. The letters number the positions on the frame clockwise, and the output number under them changes with FRAME_TYPE.
Where to look: the dark output label next to letter A. The test starts at A and goes clockwise in both, but A spins OUT 1 on X and OUT 3 on Plus.

Same letter, different output

If you change only the FRAME_TYPE value without moving a cable a millimeter, every letter spins a different output. All four letters trade places:

Test letterFRAME_TYPE 1 (X)FRAME_TYPE 0 (Plus)
AMAIN OUT 1MAIN OUT 3
BMAIN OUT 4MAIN OUT 1
CMAIN OUT 2MAIN OUT 4
DMAIN OUT 3MAIN OUT 2

The same order is in the source code. The setup_quad_matrix function in AP_MotorsMatrix.cpp holds a list of rows for each frame type, and the last field of each row is that motor's test order.

Why moving a cable breaks the frame

When the test order comes out wrong, most people start pulling off the ESC cables and swapping them around until the order looks right. The screen gets fixed and the frame gets broken. That's because the mixing table is still computed for the old FRAME_TYPE, and now you've fitted your cables to it as well.

The autopilot distributes the climb command equally across four outputs, and writes the roll command as plus on two outputs and minus on two. Which output is plus and which is minus is determined by the FRAME_TYPE table.

If your frame is X but the table is set up for Plus, the command meant to hold you level turns into a command that tilts you sideways. While motors spin one at a time, the mixing table never comes into play. The table works for the first time when you give throttle, which is why the error doesn't show on the ground.

If the order is wrong, try this first

Props are off. In the motor test, press A and note where on the frame the spinning motor is. Then continue with B, C and D. If the four go around the frame one lap clockwise, the mapping is correct.

If they don't make a lap, don't make the cable your first move. For a quad frame, ArduPilot has BetaFlightX, DJIX and ClockwiseX options besides Plus and X. Each of these drives the same frame with a different output order. If your cable goes to a non-standard 4-in-1 ESC, there's probably already a type in the list that fits you.

Example: You replaced an ESC that burned out in the pit area and rushed to reconnect the motor cables. With the props off, when you press A, the rear-left motor spins instead of the one at the right of the nose, so the mapping is broken. Also note which corner B, C and D spin, and look through the list for a frame type that matches the resulting order. Don't fit the propellers until all four letters go around clockwise.

Starting values for the classic X layout:

Parameter file
FRAME_CLASS,1
FRAME_TYPE,1
SERVO1_FUNCTION,33
SERVO2_FUNCTION,34
SERVO3_FUNCTION,35
SERVO4_FUNCTION,36

When FRAME_CLASS and FRAME_TYPE change, the autopilot doesn't build the new table without a reboot. After writing them, cut the board's power, restore it, and redo the test from the beginning.

What else to check on the board

The table says which output answers to which letter; it doesn't say which direction the propeller spins. Check the spin direction and propeller pitch on your own bench.

During the motor test, the autopilot temporarily disables throttle cut, ground station and EKF safety behaviors, and restores them when the test ends. So don't abandon the test halfway and go straight to flight; end the test properly first.

Error Messages and Their Meanings

Motor Test: Check frame class and type

The mixing table couldn't be built for the FRAME_CLASS and FRAME_TYPE pair you selected. The autopilot doesn't know which output to tie to which axis, so it doesn't start the test at all. The same message appears when you try to ARM too.

Motor Test: vehicle not landed

The autopilot thinks the vehicle is in the air. Usually the ground contact flag hasn't cleared. Wait a while and try again.

Motor Test: RC not calibrated

The test mode that sends throttle as a percentage doesn't work until the transmitter calibration is complete.

Motor Test: Safety switch

The safety button hasn't been pressed. While the red button blinks, the outputs stay blocked.

Motor Test: cancelled

There's no active motor for the requested order number. Most often FRAME_CLASS is set to a class with more motors than the vehicle actually has.

To read more

Motor order, frame type and first-flight checks are covered step by step in the troubleshooting section of the Drone Basics: From Sensors to Flight course. The decision chain, source-code evidence, log signature tables and board-specific differences are there.

Was this article helpful?

Free resourcePixhawk and ArduPilot error message glossaryThe 5 messages in this article and similar ones are in the glossary: what they mean, why they appear, what to check first.