While in Loiter Mode: loss of altitude when executing a Yaw

My Quad Copter v4.0.6 exhibits a loss of altitude while in Loiter and executing a Yaw motion. The Yaw rate is actually relatively slow. Any suggestions??
.bin file, short flight

tune the Z altitude controller.

As @amilcarlucas said maybe your altitude control is badly tuned. Are you sure AltHold is performing well ? if not here are some tuning instruction : https://ardupilot.org/copter/docs/tuning-process-instructions.html#test-althold and https://ardupilot.org/copter/docs/altholdmode.html

Loiter uses AltHold to control the altitude.

The issue is really just tuning, pitch and roll shown here:

I suggest you use this spreadsheet to set correct values of some parameters, then move on to Autotune.
That battery voltage was getting low very quickly, you might need to replace it, or at least Autotune one axis at a time. Also set up the current monitoring properly.

Shawn, thanks for the info. I have been holding off from autotune because my bat will not support a full tune. I did not realize you can do one axis tuning, so that is how I will proceed.

Also, where did this spread sheet come from? The value “MOT_THST_HOVER” is this the % throttle setting for hover??

Shawn, after making the changes per the table you provided I now experience lateral drift during Loiter and AltHold. The Quad use to rock solid during Loiter, and very little drift during AltHold. Any suggestions?

Now tune the dynamic notch filter, and after that autotune roll axis.

Hey amilcarlucas, thanks for you response.

Is the best info. for dynamic notch filter in the wiki?

Also, if I use the TX trims to remove the drift is that a good thing? Should I remove all trim before conducting the dynamic notch filter?

Never, ever use RC transmitter trims. Keep them in the center at all times.yes, use the wiki page.

thanks Amilcar Lucas :grin:

Amilcar, one more, why not use trims?

You can get MOT_THST_HOVER from logs, or it gets resaved to the MOT_THST_HOVER parameter during flight. So after a flight connect to MissionPlanner and check what that parameter has changed to. It should be somewhat less than 1.0 , like 0.2 for example.

The transmitter “sticks” are not used directly on control surfaces or throttle like in an RC plane (or heli even) but are more like “go over there, come back here, move higher, lower” . Think of the sticks as moving a ghost around the sky, and your flight controller is trying to follow it and meet up.
If you use a trim in the transmitter to TRY and correct for some other tuning or physical issue with the aircraft then it’s always receiving a “go over that way” command, following its ghost but never catching up, as well as fighting whatever else was wrong.

You might be better off simply doing a level horizon for a start.

  • Set up the aircraft on solid ground, connected to Mission Planner, and go to the Accel Calibration page.
  • Get the “prop disc” perfectly level by wedging or packing the landing gear and using a spirit level across opposing motors.
  • When you are satisfied the whole frame is level in all directions hit the “Calibrate Level” button.

We made a very light weight spirit level from a piece of aluminium angle and glued on a string line bubble level - it doesn’t weigh down the aircraft. The other way is to find perfectly level ground, not just “looks flat enough”, and assume your landing gear is all completely stable and equal length.

AltHold will allow drift with the wind, it’s just like Stabilize mode but with Altitude control from throttle mid-stick. Loiter shouldn’t drift at all unless Loiter mode was denied such as no GPS 3D fix.
Post a link to a .bin log file from that flight.

Hey Shawn, I think there is a bit of disconnect, a few comments, regarding:

Regarding the initial setup of the Quad. I used a bubble level (placed on the Pixhawk case), so I am sure the Pixhawk is very level (I did not level based on the plane created by the props). So, you are saying I should perform the leveling based on the plane created by the props (not the pixhawk case or the frame??).

I didn’t have the issue of drift until I made some recent changes i.e. per the table you provided and adding a small camera mount. The Quad was stable as a rock during Loiter and AltHold (no drift).

Although I have not performed an AutoTune, I have manually performed maneuvers progressing from gentle to extreme Pitch / Roll / Yaw maneuvers and I can see (what I thought were updates to the control loops).

Am I correct in my thinking that the control loops are updated even when manually flying i.e. Stab., Loiter, AltHold?

4 quick flights this morning see .bin files.

Yes, exactly.

In the latest log there, GPS number of sats is low and HDOP is high and mode appears to stay in Stabilize the whole time. It’s unlikely Loiter would have worked even if you selected it.

One way to counter this is to
a) wait in Loiter mode till you get a green light and able to arm - this depends on the pilots patience and discipline
b) set the Fence properties - you can not arm until GPS acquires a 3D fix and can set a Home position, regardless of flight mode

FENCE_ALT_MAX,50 <- set to suit local laws or safety
FENCE_RADIUS,200 <- set to suit local laws or safety

I’d also advise setting these:
and finish setting up MOT_BAT and other BAT_ parameters from values calculated in the spreadsheet.

If Loiter is going to work OK, you’ll be able to do Autotune. Best to set up Harmonic Notch Filter beforehand. Let us know if you want help with that.

thanks, I will report back.

Hey Shawn, I did the following: recal. Accl (based on the plane of the props, not the pixhawk case). Still drifting to the left.

Vibe Looks Good (Z vibe around 10.00 mean)

GPS HDOP: Stars out at 1.00 but degrades to .85 by the end of the flight

Motor Balance: Good

Motor Channel Averages: 1588, 1586, 1568 and 1569 (diff. all = 20)
Also, I did identify an additional issue. I failed to check the TX channel centers when I first began the flight testing. They were all off (i.e. 1547, 1563, 1510, 1492). I changed all of them to 1500 before I made this test flight.

At a loss as to why the Quad is now drifting to the left, when it use to be rock solid?

I up loaded a .bin file: https://drive.google.com/drive/u/0/folders/1oJu4VgNgmyL_zD6jq1j20pBN_rVmGqK6

Hey Shawn, one more item. I have not set my bat. because I have an FrSky Telem link that reports my bat. to my TX and my TX annunciates the bat. level as I am flying. So, I always know the state of my bat. (my TX even warns me as the bat. approaches 3.8v/cell.

You need to set the battery monitor for the PID scaling to work properly.

Hey Amilcar, would you please elaborate why battery mon. needs to be set i.e. how PIDS are effected by battery mon.?

In advance, thanks!


Please in the future follow the instructions without skipping any steps :wink: