Does RTL work if there is magnetic interference in compass?

Hi Shawn,

Thanks a lot for the suggestions.
Yes, the instability happened during RTL while the copter was descending, I thought this happened due to wind.
I will try to run Autotune (just waiting for the windless environment), and will update this

Best regards

Hi Shawn,

I did the autotune. I run the Autotune two times and I think the copter now is doing fine.
I tested the Loiter mode and also the RTL went a bit more smooth.

You can find the log (only for the recent autotune) and short videos of loiter mode flight in the below link. Thank you so much for all the help. Please let me know If you think there is still room for improvements.

https://drive.google.com/drive/folders/1iqRWkd_nyu19EPggdIcEGbKQCm6Hjz64?usp=drive_link

Later, We will add some payloads (~4 kg) to the copter. Do I need to do the Autotune again, or is it fine If I just change the below parameter as the Wiki page suggests?

For aircraft designed to carry large directly mounted payloads, the maximum values of ATC_ACCEL_P_MAX, ATC_ACCEL_R_MAX and ATC_ACCEL_Y_MAX should be reduced based on the minimum and maximum takeoff weight (TOW):

** ATC_ACCEL_P_MAX x (min_TOW / max_TOW)*
** ATC_ACCEL_R_MAX x (min_TOW / max_TOW)*
** ATC_ACCEL_Y_MAX x (min_TOW / max_TOW)*

Best regards

That looks good now. You might want to run a Yaw autotune - I’m unsure of it’s status at the moment since there’s no yaw at all in that log.
You should do a flight with some

  • yaw on the spot
  • circles
  • figure 8

and we can refine the compass settings - which was part of the original question.

Later when you add the payload only the ACCEL values need adjustment as per that info you linked to.
Sometimes it can be appropriate to lower ATC_ANG_PIT_P and ATC_ANG_RLL_P a fraction, but you definitely wouldnt run autotune again with the payload on.

Hi Shawn,

Thanks for the feedback.
I will do a flight with yaw and circle and update here.

Best regards

Hi Shawn,

I did another test flight with yaws, circles, and 8 figure.
To me yaw looked fine, but please let me know if it needs to be tuned as well.
You can find the log file in the below link
https://drive.google.com/drive/folders/1iX-Xe0RkSlmevdchlERDDcFCxOUWCXNM?usp=drive_link

After that, I tested a simple auto mission which I think went well.

I also tried to test this drone’s flight time, which was supposed to be about 55 mins with no payload. But I forgot to adjust the battery parameters and the fail-safe triggered about 48% (BATT_LOW_MAH,12500). However, when I checked the battery capacity manually with one of these (see image below) it showed 30% capacity left. I am kind of confused about what to rely on now.

For compass calibration, when I run the MagFit with the different sections of the flight I get slightly different parameters as an output. Are there any specific rules to choose the flight? In the Log Analysis Seminar, they were specifically looking for circles to calibrate the compass but I have no idea why. I would appreciate it if you briefly explain how should I run the MagFit.

Best regards

I doubt that capacity checker is very accurate, unless it takes about ten minutes to check the battery, or is it attached during flight??
I believe it just plugs into balance leads and instantly gives you a readout - which will be highly inaccurate in terms of capacity and percentage remaining. It’s voltage reading may be accurate.
Search the Ardupilot forum and also RC Groups about calculating remaining percentage - basically you cant unless you’ve got a “smart” device attached to the battery to monitor it’s usage long term (multiple charge/discharge cycles) and report the capacity.
The problem is the discharge curve is not a straight line, so for most of the discharge we dont know whether the battery is at 90% or 30% just by looking at the voltage (which is all that device does).

To use the mAh failsafes you would need to monitor your battery capacity long term and adjust those settings as it changes - it is OK to use capacity failsafes provided you know the battery capacity for certain and you always start with the battery fully charged.

If you want to use capacity (and you should still use voltage too) then make sure your current measurement is very accurate. I’ve copied in the procedure down below.
Your voltage measurement should also be accurate → actually measure the battery voltage and adjust the sensor BATT_VOLT_MULT

Back to the compass where the whole story started :slight_smile:
You can set these

COMPASS_DIA_X 1.006
COMPASS_DIA_Y 1.074
COMPASS_DIA_Z 0.896
COMPASS_DIA2_X 1.014
COMPASS_DIA2_Y 1.067
COMPASS_DIA2_Z 0.800
COMPASS_MOT_X 0.277
COMPASS_MOT_Y 0.130
COMPASS_MOT_Z -0.072
COMPASS_MOT2_X 2.154
COMPASS_MOT2_Y -2.173
COMPASS_MOT2_Z -2.823
COMPASS_MOTCT 2
COMPASS_ODI_X -0.025
COMPASS_ODI_Y -0.022
COMPASS_ODI_Z 0.018
COMPASS_ODI2_X -0.014
COMPASS_ODI2_Y -0.012
COMPASS_ODI2_Z 0.034
COMPASS_OFS_X 250
COMPASS_OFS_Y 164
COMPASS_OFS_Z 225
COMPASS_OFS2_X -44
COMPASS_OFS2_Y 55
COMPASS_OFS2_Z 422
COMPASS_SCALE 1.00
COMPASS_SCALE2 1.00

and you should also be able to set
COMPASS_USE2,1
to use the second compass in case redundancy is ever needed.

Here’s how to adjust your Amps Per Volt

  • Plug in a fresh battery and do a hover flight for 5 minutes or until you’ve used a significant amount of battery capacity
  • Immediately unplug the battery and charge it, note how many mah’s it took to charge. Let’s say that was 1,500 mah
  • Download your log and look at maximum CurrTot. Let’s say it was 1,300 mah
  • Get your existing BATT_AMP_PERVOLT setting from Mission Planner
  • NEW_AMPS_PER_VOLT = OLD_AMPS_PER_VOLT x CHARGED_MAH / LOGGED_MAH
    With my example numbers, you’d get
    NEW_AMPS_PER_VOLT = 17 x 1,500 / 1,300 = 19.61
  • Set the new value in the BATT_AMP_PERVOLT parameter and save to your copter
  • Fly to check, repeat until you’re happy the new value gives consistent readings
2 Likes

Hi Shawn,

Thank you so much again for your feedback.

Hi Shawn,

I did some tests, actually I added a dummy payload and a rangefinder and did further flights. I kind of realized that the copter’s heading oscillates +/- 5 degrees while hovering in loiter mode (please see below figure), and the altitude also change a bit while hovering. Does this sound normal or do I need to run autotune for yaw as well?

Here is the log file

Best regards

You can set these:

INS_HNTCH_FREQ,53
INS_HNTCH_BW,30
INS_HNTCH_REF,0.21
PSC_ACCZ_I,0.48
PSC_ACCZ_P,0.24

then I would run Autotune again on all three axis, even if you do them one at a time. Do yaw last.