The quadcopter has the pixhawk 4 and does not have GPS and other extra sensors.
For that case, the altiude mode uses the barometer and accelerometer inside of the Pixhawk 4?
Are the barometer and accelerometer enough to hold the altitude without fluctuations?
Is my understanding below correct?
The throttle stick controls rate of ascend/descend [m/s].
With the settings below, the vertical velocity is correct for the throttle stick position?
Maximum vertical ascent velocity. Default: 3 m/s.
Maximum vertical descent velocity. Default: 1 m/s.
Throttle Position & Vertical Velocity:
Throttle stick is at 25%. ⇒ Vertical descent velocity of 0.5 m/s is set.
Throttle stick is at 50%. ⇒ Vertical descent velocity of 0 m/s is set. (holding the altitude)
Throttle stick is at 75%. ⇒ Vertical asscent velocity of 1.5 m/s is set.
Where could I find the codes for the altitude mode logic?
Generally you can hold vertical position fairly well - barometer is almost always used for calculating altitude. However note that since barometers calculate altitude from pressure, anything that affects the pressure can affect the estimate (e.g. bad weather). The estimator attempts to fuse the accelerometer data to compensate for this. An example of a problem case: https://docs.px4.io/master/en/advanced_config/static_pressure_buildup.html
Nearly. There is a deadzone at 50% (see docs). This is a zone in which moving the sticks up or down doesn’t change the altitude. In the zone, yes, the vertical velocity is zero. What this zone means though is that the “half way” positions might not be at 75 and 25% as you have indicated.
Also the velocity isn’t halved at the “half way points” - it is reversed. So at 0 it will be 3/ms down, and at 100% it will be 3m/s up.