I am testing with optical flow (as well as with external velocity / position data fed through ODOMETRY messages). In SITL simulation, you can reproduce this problem when you add the virtual optical flow as described here: Adding Simulated Peripherals to sim_vehicle — Dev documentation and virtual rangefinder (on the same page; to allow altitudes above 50m, you can adjust SIM_SONAR_SCALE and RNGFND1_SCALING e.g. to 30 and RNGFND1_MAX_CM to 15000), EKF-Sources are configured for optical flow like:
- EK3_SRC1_POSXY = 0 (None)
- EK3_SRC1_VELXY = 5 (Optical Flow)
- EK3_SRC1_POSZ = 1 (Baro)
- EK3_SRC1_VELZ = 0 (None)
- EK3_SRC1_YAW = 1 (Compass)
Now, when I set SIM_WIND_SPD = 5 (m/s) and SIM_WIND_TURB = 3 (m/s) and climb up to about 50m (or higher), the copter cannot hold it’s position in Loiter mode anymore and also drifts away from a desired path in AUTO mode.
As far as I could see, the maximum lean angle on pitch and roll seem to be limited to 10 degrees here. I checked a lot of params which may influence that behaviour but could not find the responsible one. ANGLE_MAX is set to 3000 (30°), PSC_ANGLE_MAX and LOIT_ANGLE_MAX are set to 0 (which should allow 2/3 of ANGLE_MAX, so 20° should be possible). WPNav speed is set to 1000 (10 m/s) and Loiter speed is set to 1250 cm. All these settings should allow to hold a position at the given simulated wind speed and turbulences.
In AltHold flight mode, the drone can be flown fast enough to counteract this wind and when EKF3 Sources are configured for GPS operation, it also can hold it’s position without limiting the lean angles to 10°.