Rangefinder Problem in AC 3.4.4

I’ve just updated to AC 3.4.4 Hexacopter. I have a Maxbotic analog rangefinder attached. When I enable the rangefinder using EK2_RNG_USE_HGT, my altitude and sonar data stop reporting correct values. They worked fine in AC 3.3. Anyone got any ideas? Thanks.

Using that parameter doesn’t exactly enable the rangefinder. It tells the EKF to use it when possible below a certain height (expressed as a percentage of the configured maximum altitude range). With a Maxbotic analog sonar I’m not sure you should be doing that. Can you talk about your use case?

I want to use the rangefinder for altitude control when it is in range below 7 meters. If I take off and try to use altitude hold at 2 meters, the copter drifts sometimes down to the ground and sometimes to 4 or 5 meters. Flight data shows that the altitude is not accurate at low levels, however the sonar data is accurate.

John, I am having similar issues with lightware sf10. I have tried a number of changes to various parameters but still unable to get the bird working properly - climbs and falls 4 or 5 meters. Also tried .EK2_ALT_SOURCE…documentation is a bit difficult to understand so not sure it was set correctly in conjunction with max height etc. Also tried EKF2 gps - various combinations. Otherwise, all my settings are currently on default with the only parameters changed being:
SERIAL4_PROTOCOL = 9 (Lidar)
SERIAL4_BAUD = 19 (19200 baud)
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_SCALING = 1
RNGFND_MIN_CM = 5
RNGFND_MAX_CM = 2500 (for SF10A), 5000 (for SF10B), 10000 (for SF10C) or 12000 (for SF11C). This is the distance in centimeters that the rangefinder can reliably read. The value depends on the model of the lidar.
RNGFND_GNDCLEAR = 10 or more accurately the distance in centimetres from the range finder to the ground when the vehicle is landed. This value depends on how you have mounted the rangefinder.

Today I was successful in verifying my (analog maxbotix) rangefinder is working properly. I tested by flying in altitude hold at 2 meters and moving horizontally over a 1 meter wall. The drone held altitude and corrected when it encountered the wall. I’m not exactly sure which change I made corrected the problem, but below is a listing of the steps I took to fix:

  1. Verified copter is balanced
  2. Re-tuned all axes using autotune
  3. Changed settings to:
    EK2_ALT_SOURCE 0
    EK2_RNG_USE_HGT -1
    RNGFND_PWRRNG 0
    TERRAIN_ENABLE 0
    TERRAIN_FOLLOW 0
    WPNAV_RFND_USE 1

Will be testing WPNAV_RFND_USE and EK2_RNG_USE_HGT next to see if I can properly adjust useful range.

Thanks, John. I will take a look at those parameters. I do think there is a need to configure more than the current documentation suggests. I am also trying a different quad that I use for testing various components to see if maybe vibration was also a factor - got higher vibration than I would like to see.

For using rangefinder to keep the same altitude while in AltHold or Loiter you don’t need to configure anything besides the parameters for the rangefinder (under RNGFND).

Appears to be working okay now. Haven’t had a chance to go out to test. Other issues keeping me from testing. Hopefully will be testing soon.

Which rangefinder are you guys using?
Is it the LIdarLite v2? v3?
Any links?

I was using Lightware sf10 - but… Finally got some good testing weather and also updated the test quad.with new (used) motors and esc’s. Had some issues due to bad components but once I rebuilt the quad and got it flying well. Plugged in the lidar and worked okay in various manual modes including loiter and alt hold. Not super locked in but seemed okay. Decided to try an auto mission so set it up at 3 meters. Went to fly for a bit first. Took off in Alt Hold into a hover. Tried Loiter but seemed a bit flaky so went back to Alt Hold and hit auto. Did not behave at all so went back to Alt Hold and it took off like a rocket straight up. No throttle control. Like an idiot I stole my stabilize switch position for the auto thinking I was only going out for a very short 100 ft mission at 3 feet. OOPS! Tried hitting RTL but did not respond even though RTL was confirmed on MP. Still going up. Switched to Loiter and got bird to start dropping - seemed like 0 throttle in Loiter. To avoid a crash I slowed down by switching back and forth from Loiter to Alt Hold - yo-yo time. Then I lost orientation and it was all over., Gone. I think it landed about 1/2 a mile away in a heavy wooded area (with a few feet of snow on the ground). No BIN file to look at just the TLog. Not sure what the heck happened though I suspect “operator error.”.Maybe vibrations? Maybe misconfigured or corrupted parameters? ONe of these days I will learn my lesson and NOT take shortcuts. I think I am there now. Which leaves me wondering which Lidar I will try this time around. Anyone try LeddarOne? Price is right - how about performance?

SF10
I believe the SF10 was an older piece of hardware, so maybe you should try out LidarLite V3.
If you do, then please post a video of this in operation.

PX4Flow
I previously used this device and it simply did not work. Waste of money.
I used this on V3.4 and I was told that I need to use an older version of ArduPilot, to get the PX4Flow to work.

Kill Switch
James, do you not have a kill switch on your RC?
I have a emergency motor kill switch, so the moment the copter is out of control I hit it - the motor cut out.
What I tend to do, when testing out a new system on my quad: I first fly at low level (roughly 2m above ground). As my confidence rises, I take the copter higher.
If the copter misbehaves during the 2m altitude test I can issue my copter with a “stop moving” voice command (yes my copter is voice controlled). If the copter still misbehaves, I can kill the motors, without any major damage to the copter.

RTL, Go Home
Regarding RTL, I always have found this flaky, which is why I designed my own Go Home system, which does not make use of ArduPilot’s RTL flight mode.
Whenever I use RTL, I found the copter would arrive at a rough location, then begin to circle until it crashes.
You can see my implementation in the video below, using voice control:

Very nice application! The kill switch is a great idea…we have been talking about doing that for over a year but never seems to get implemented. Guess it is time. BTW, the voice control of the copter is really a great idea. Thanks for the feedback.