Guided mode flying to incorrect altitude

I am having an issue with Guided mode takeoff altitude control on ArduCopter. When I command a Guided takeoff to a low altitude, such as 0.2 m, 0.5 m, or 1.0 m, the vehicle consistently climbs much higher than the specified altitude, often reaching roughly the same physical height regardless of the commanded value.

The rangefinder data appears accurate. In Mission Planner/MAVLink Inspector, the rangefinder reports the expected physical distance from the ground. For example, when the vehicle is physically around 1.7 m above the ground, the rangefinder reports approximately 1.7 m. However, the altitude value shown by Mission Planner does not appear to match the rangefinder height. In some cases, Mission Planner altitude may show a very small value, such as around 0.06 m, while the rangefinder correctly reports around 1.7 m.

I have been testing indoors without GPS. I am using optical flow and a rangefinder for position/height estimation. I have tried using the rangefinder as the EKF vertical position source by setting EK3_SRC1_POSZ = RangeFinder. I have also tested using barometer for EK3_SRC1_POSZ, but with baro selected, the estimated altitude begins drifting upward immediately after arming, even before prop wash could affect the sensor. This causes the vehicle to climb aggressively and makes Guided takeoff unsafe indoors.

The main issue I am trying to understand is why a Guided takeoff altitude command does not correspond to the actual rangefinder height, even when the rangefinder data itself is accurate. It seems like Guided takeoff is following an altitude estimate that does not line up with the rangefinder measurement.

1 Like
  1. Rangefinder should only be used as POSZ source if the surface is clear, flat and horizontal.
  2. IIRC depending on your parameters some overshot on takeoff is expected
  3. Post a log file so someone can take a look at your configuration
  4. Setting and resetting baro offset was modified in 4.7 so I would recommend checking out the latest beta.
  5. Keep in mind that Ardupilot uses a bit different assumptions when on the ground so testing fusion when disarmed may not be as accurate.

As for the bump in altitude on takeoff, it can be tuned by increasing PSC_JERK_D. Try increasing it to 10 from the default 5 and see. You can increase it more if required.

Edit: and consider upgrading to 4.7

here are 2 data logs without changing my current setup. One uses the rangefinder as ekf posz. This is a much more stable flight where i set it to fly to 0.5 m and land, but it went to around 2m. The other log is when I set the ek3 posz to barometer. It sort of just shot up way above the 0.5 m specified height. I think this is due to the random changes in altitude right when I arm the copter that shows in the MP HUD. Let me know if you want me to provide more info.

I am thinking I should use the Baro for posz but I cant get consistent data, its very frustrating. randomly the altitude changes either to positive or negative values. Also after setting the ekf origin and arming, the altitute just starts increasing even before takeoff and before the props turn on. I was thinking it could be due to temperature, but I put it in my freezer and got the same results. This is why I am getting a vertical pos variance in ekf. It just wont hold alt because of these issues.

Are you using 4.6? I suggest to upgrade to 4.7

I have tried both 4.6 and 4.7. Here is what I just observed: I connected a new bare same fc to the mission planner and before setting the ekf, I have been seeing a rise in alt, I think it is becuase the board is getting hotter. I turned off the power to the board and started seeing a decrease or drop in alt. when I put a fan on it for cooling, it would stay at around zero with power on, and when I turned power off , it started to decrease slowly negative (i am thinking this is due to it getting cooler). I tried and temp calibration and am still getting the same results

Which FC? Maybe someone can help with this info

Flywoo Goku F405 HD

Just wanted to say that I’m running into the same issue where I want to takeoff to 1.2 meters, and the drone rockets to 30+ meters.

In Guided Mode or doesn’t this belong in this thread?

In Guided mode. But it also happens in Auto mode when I set takeoff to 1.2 meters relative to home.

logs.bin

  1. You have way too many arming checks disabled,
  2. Data from the ESCs is missing during the flight
  3. You have RPM sensor configured which is incorrect and a symptom of following known bad guides :frowning:
  4. Logs are spotty and missing a lot of things.

I don’t think this copter is correctly configured for any operations.

Thank you for this. I am using a custom firmware to be able to use optical flow, so I may have left out some values for logging because I don’t have much room on the flight controller. Would you have any suggestions regarding this or any methods of troubleshoot?

So what optical flow sensor are you using?

MicoAir MTF-01

Okay so why do you need a custom firmware for that module?

My flight controller has low storage, so the original base firmware to install is without optical flow configuration settings. I needed to add optical flow settings into it through a custom firmware.

1 Like