I am using a pwm rangefinder, and I can’t get it to go above rngfnd_max even with the throttle stick completely up. It never switches to barometer altitude control
Could it be that EKF2 is already using sonar for its altitude estimate and then the althold controller is doing terrain corrections and the two are in conflict?
Log is attached.
rngfnd alt hold issue.bin (702.6 KB)
I’m not able to help you at this point due to my limited rangefinder experience. I’m trying to setup a new one myself, Maxbotix I2C (MB1242). I don’t want to get off topic but would you mind sharing your parameter list. I may find myself tomorrow where you are today. Thanks.
They are attached here.
parameters.param (9.7 KB)
Sorry for the delay but never received notification by tracking this thread.
Have you tried setting EK2_RNG_USE_HGT (Range finder switch height percentage)?
“The range finder will be used as the primary height source when below a specified percentage of the sensor maximum as set by the RNGFND_MAX_CM parameter. Set to -1 to prevent range finder use.”
With the few tests I’ve conducted after setting it to 70 sometimes after powering up the
MP HUD horizon will drift sideways then upside down. A reboot seems to solve it and I flew 3 flights without issue but didn’t pay attention to how, or if, the rangefinder to barameter switch over happened. Today I might try that. My RNG Max is 700 so it should switch at 490.
Can I ask why you’ve set the EKF to use the sonar as it’s altitude source? I personally never fly that way and I’m not sure why you would want to really (I’m sure there’s a reason but I don’t know what it is). I know that currently if using optical flow, we limit the maximum altitude because otherwise it will lose it’s horizontal position estimate.