My quad is drifting while landing in auto mode

I am facing some issues while landing in auto mode, my drone is drifting away and landed around a few meters away. Earlier when I was flying with Here3 GNSS alone, it was flying perfect and landing accurately (few cm errors) but now I fixed 2 GNSS and put GPS_AUTO_SWITCH=0 (Primary GNSS as Here3) because there is a signal loss issue in the second GNSS.

What could be the issue? I have checked the EKF Lane 1, everything is under 0.25 which seems good.

GPS1 Accuracy graph shows this:

I compared it with the earlier Here3 GNSS alone graph, there is not much difference but yes some difference is there.

what could be the issue? Can there be some kind of interference between the 2 GNSS? If yes! then how to check and what would be your recommendation to minimize it?

Really looking forward to some help and suggestion.

Here is the link for the flight log:

GPS position could easily be a few meters out, or drift somewhat while in use. Although that doesnt happen so much these days.

Looks like a lot of default values and no tuning.
Connect to MissionPlanner and go to Initial Parameters, put in your batter cells and prop size, also select to accept the recommended parameters, then accept everything it offers to update.

Set this
and do a hover for a minute or so and just some gentle pitch and roll movements

For GPS issues, try a different value for GPS_GNSS_MODE and GPS_GNSS_MODE2 - the same value in them, but just not the default 0
Use the selection dialog box in MissionPlanner to pick just one or two constellations, you might find a value of 65 works best for you.

In logs look for GPA Delta (update rate) and it should be a straight line along 200msec

1 Like

Thanks for the help and recommendation Shawn, I really appreciate it. Yeah I know! I have not changed much of default values because I don’t know which parameters and what are the values I have to insert. Is there any guide or doc which can help me to find which default parameters we should change when we make a new drone?

And for tuning the drone, Yeah! I tried auto-tuning few times but it never completed, last time I remember it was showing some error “Failing to Level” and where I live is little windy area so I get just few chances when there is not much wind for auto-tuning. I am not a good pilot so I have never tried manual tuning. If you have some better and safe way for this then please suggest me how can I safely do tuning?

But btw, I have again flown the drone with only Here3 GNSS (removed the second GNSS) and found out it was landing perfect like earlier with few cm errors and when I connected back the second GNSS, it started landing again few meters away.

Today, I will try with this GPS_GNSS_MODE = 65 parameter and see what will happen.

Again Thanks for help!

1 Like

This will rarely work from default parameters. At a minimum you need to use the Initial Parameters Setup in Mission Planner. Hard to miss as it’s under the Mandatory Hardware section. These are pre-maiden flight parameters…

1 Like

Thanks, @xfacta (Shawn) & @dkemxr (Dave), and sorry for the late response. While setting the initial set-up I noticed that it is asking to change some of the default settings. Should I be writing all the parameters to the FC? and If so then How safe is it to fly the drone in loiter mode after writing these recommended parameters to FC? Because I am still a learner so I prefer Loiter mode to fly.

and after writing these parameters it says:
After Test Flight
Set “ATC_THR_MIX_MAN” to 0.5

What does it mean by test flight? Do I need to fly in stabilize mode or I can fly in any mode? and what am I supposed to do on the test flight? some gentle pitch, roll, and yaw movement, or something else?
and How long shall I fly on a test flight?

Really looking forward to your help and suggestion. I will be eagerly waiting for your response. Again a big thanks to you both!

In this case it means fly (hover) in AltHold or Loiter until the hover thrust value has been learned. You will know this has happened when it is hovering with the throttle at mid stick. Or you can hover in any mode and then review the log and look at the average CTUN>Tho value.

1 Like

Thanks again for the quick reply,
Do I need to do this test flight with the payload? or I can later add the payload after the final auto-tune is done? what do you suggest?

Hey @dkemxr (Dave), I have set the initial parameters and done the test flight. (Sorry for the delay in test flight, It has been raining for last few days here so I was waiting for the clear sky day). In test flight, I put the drone on hover at few meters for about 5-7 minutes but after sometime it says “prearm: Compass Variance” so I landed the drone. Could you please help me out here to find out what could go wrong?

Here are the logs:

Really looking forward for some help and suggestion.

OK, the hover throttle value was learned but as Shawn said set INS_LOG_BAT_MASK to 1 and repeat the hover test. Only a minute or so is required. You need this and the Hover thrust value to set the Notch Filter.

Thanks again @dkemxr (Dave). Today morning I got the best day for all the testing as there was no wind and I also performed the autotuning but it did not come out successfully, Pitch & roll was a success but when it started doing the yaw then it started showing “AutoTune: Failing to Level”. is it because I have not updated the ATC_THR_MIX_MAN to 0.5 or something else is the reason? and one more thing, are the pitch and roll rates come out good? and shall I update the roll & pitch rates as it is?


Log of AutoTune:

Thanks for all the help. Looking forward to some more suggestions.

Looks like Autotune didnt complete because of battery voltage causing RTL.
It’s OK to do Yaw Autotune last, it’s least critical.
You could get through pitch and roll on one battery charge though
Put in these values from the Autotune that did make through pitch and roll sections

When you do Autotune and it finishes, just stay in Autotune mode and “reposition” to land and disarm. Wait for PIDs to save (a couple of seconds) then you can arm in a normal mode and fly for testing. ONLY switch out of Autotune mode after landed and disarmed. I find this is the easiest way.

Your collection of data for Harmonic Notch filtering seems odd, but set these anyway:
INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest

Now lets see a log from before the Yaw Autotune, then after :slight_smile:
You could eventually do a Autotune of all axis just to make sure since autotune can adjust a couple of filter values that we havent listed above.

Also recheck and change GPS_GNSS_MODE again, the update rate is a bit erractic.
Try a value of 1 or 5 and see if it is any better in logs, look for GPA Delta.
Also take into account the GPS HDOP (less than 1.0)

For example I have plenty of Beidou sats usable but the HDOP is always higher than not using Beidou, and it can take longer to get a good 3D fix and arm.

Hey, @xfacta (Shawn) thank you so much for the detailed explanation and quick response. Battery voltage did not cause RTL, When it started the Yaw tuning some warning started to appear “Autotune: Failing to Level” I waited for some time but that warning was keep coming so I switched the mode to RTL for calling the drone to Land.

I will change these parameters and post the flight log of a test flight. Thanks for all the help.

One more thing, could you please help me to understand the log analysis? like how did you come up with what parameters to change specifically? I have been trying to learn log analysis and watched the Ardupilot log analysis seminar on youtube plus the docs available on the net but I still lag to find out the issue. I would really appreciate it if there is anything you can share with me which can help me to understand it.

You must have just got to that RTL mode in time, because right around the same time the power safety indicator goes low, it would have done RTL if you didnt.
EDIT: I take that back - you were right too - it didnt RTL for battery, and it wasn’t about to.
I was looking at the wrong indicator → Safety (armed/disarmed) instead of Flags in the Power section of the log.

I’ve really learned (some) log analysis the hard way - going exploring when I’ve had a flight issue, reading the docs over and over, and the developer docs too.
There’s no one document of “how to” for ardupilot log analysis, since it depends a lot on how involved you need to get.

There were these messages in the log:
AutoTune: Roll Rate: P:0.123, I:0.123, D:0.0053
AutoTune: Roll Angle P:13.062, Max Accel:68998

AutoTune: Pitch Rate: P:0.184, I:0.184, D:0.0074
AutoTune: Pitch Angle P:11.283, Max Accel:70760

Hey, @xfacta (Shawn), A big thanks for all the help. I have updated the parameters as per your suggestion but it is behaving a little weirdly.

Logs after updating the Autotune parameters:

Logs after updating the Autotune para and Notch filter para:

After updating all the parameters (Autotune & Notch) as per your suggestion, I felt that drone is shaking and drifting away in loiter mode.

When I did the second flight again, the drone was shaking very badly, so I landed it quickly (here is the log: )

What could go wrong? It is behaving very weird and I am a little afraid to do anything. So eagerly waiting for your response & suggestion.

The 2nd log there actually looks good, attitude and desired attitude are quite close.
The harmonic notch filter is set up correctly.
Just set this so we can see the results in next flights

I see no differences between the last log and the previous log to cause the apparent lack of control.
I think there’s 2 things to do to fix this.

  1. Set the Fence, probably take off in AltHold anyway especially during testing
  2. Adjust some position control parameters

I highly recommend setting
then you can not arm until Home can be set. This can take a while but it means you at least have a known-good home point and relatively stable GNSS positioning. And you have time to think about your preflight check list and planned flight :slight_smile:

Since you are arming and taking off in Loiter, it could be affected by the GNSS position wandering.
You can test this by arming and taking off in AltHold , hover a while to see if everything looks OK, then switch to Loiter and see if there’s movements and what looks like oscillations.
If so, set these, half of their default values
Well, probably set these values anyway, there’s no real detriment.

Other stuff
RC control can be quite sensitive, if yours is try setting

In logs it looks like you are taking off from a slope, and in flight pitch and roll are a couple of degrees apart.
Maybe recalibrate “level” by using a spirit level across the tops of your motors and packing under the landing gear to get the “prop disc” as level as possible, then in
MissionPlanner, Mandatory…, Accel…, Calibrate Level
QGC, it’s called Level Horizon

BATT_FS_CRT_ACT probably should be 1 instead of 2. There’s usually no chance of doing an RTL at critical voltage level.

Your current measurement is actually following the voltage measurement, so that’s wrong - but it wont affect performance or stability. It will be nice to get it correct. Did you have the power brick that came with the Cube Orange?
Normally these are the settings when using the PowerA connector

Yeah! I have the power brick and I have already changed these parameters but the problem is, I have not connected the battery directly to the power brick as my battery is a little big (16000 mAH 6s), and peak current can also go up to 40A+ so I have connected the battery to the PDB as input and connected power brick to PDB as output. I think that’s the reason it is not measuring the current properly. What do you suggest about this?

I will do one more test after updating the parameters you suggested. Thanks again!

I am using a middle stick transmitter and It has been working fine, Is there any way to find the sensitivity? I mean If you want me to test by giving some gentle roll and pitch commands and later if we can check in the logs to see how sensitive the radio is then let me know I will do it.

and one more thing, if it flies well after changing the parameters then shall I proceed with the Yaw tunning and how should I do it? because if I do autotune then I guess it will again start first roll and pitch tunning and then yaw.

No great need to measure the current, although it is handy.
Probably just set BATT_CURR_PIN to -1 and BATT_MONITOR to 3 (voltage only)

Check through all the things I wrote, I think just about everything you need is in there, at least until we see the next .in log