Tilting before takeoff

When I throttle up slowly before taking off, I notice that at certain throttle levels the drone is perfectly happy tilting over until it will flip over, without correcting itself. But once in the air it stays level. So, I essentially have to quickly increase the throttle over this problematic range in order for the copter to get in the air and not flip over.

Why does it behave this way? wouldnt it be trivial for the drone to keep itself level while on the ground?

edit: this is stabilize mode. in auto takeoff, it does not tilt.

That’s not the way closed loop control works. There is no change in sensor feedback from commanded action while it’s on the ground.

accelerometers dont work on the ground?

Sure they do. The z-axis measures 1g unchanging until it leaves the ground. X&Y zero, gyros zero. When it leaves the ground then they provide feedback to commanded action. This is PID control loop 101.

is angle not controlled? i thought the accelerometer might be used for that

maybe you dont understand what im saying. if the drone is on the ground and is tilted, the accelerometer can measure that. whether thats how the drone can get a reliable lean angle, im not sure.

Yes, it get’s a pitch/roll angle from the acceleration vector. I’m just saying that stability can’t be achieved until the craft is in a free state (not fixed to the ground). You can see an example of this by removing the props and raising the throttle in Stabilize mode. The motors will typically continue to increase in speed at a fixed throttle because the sensor feedback is not changing to commanded action.
A squirt of throttle as you noted is a good way to get it off the ground.

that is surprising to me that the drone does not ‘know’ it is tipping over until it is on the air. seems like something that can be trivial to address in software… but I’ve never programmed a flight controller from scratch. maybe its time to.