Notch filter center frequency

I have a few questions about how I should go about setting up the harmonic notch filters in ardupilot. I have read through all the documentation on it but I just wanted to be certain before I move forward since crashing this particular drone is not an option for me.

I am currently in the process of tuning a large quad rotor that will eventually be a gas hybrid platform. It has about 43in props and the flight controller is a pixhawk 6x. Due to the high vibrations I anticipate, the Pixhawk is mounted in a similar fashion as in this tutorial. The vibrations do seem low so I believe that is working but the engine is not currently running.

In regards to the notch filter I would like to set that up before I continue tuning but after downloading the logs the graphs look like this:

There are very strange lines coming down off the GYR0 plot and I am not sure if this is a cause for concern so I was hoping I could get some clarity on that. My main question is what should the centering frequency be set to when the GYR0 and GYR3 plots center at slightly different peaks (40hz and 55hz)? Also on the GYR3 graph there is a small peak at 100hz after the main peak, would it be worth it to set up a second notch for that? I’ve read that setting up a double notch can be counter productive. There is also a noticeable separation between the three lines and I am not sure if that is normal as well.

The tune is still quite poor but that is a work in progress, if you had any suggestions on how I should adjust the tune I’m all ears. I have been against using autotune since I’ve had a bad experience with it a few years back.

Thanks for all your help I really appreciate it!

Log file can be found here

When checking FFT for setting up the harmonic notch filter, it is best to set the Magnitude option
image

I cant check your log because it seems the FFT graphs dont work for the .log format, at least not for me.

But anyway…
For 43inch props you will need to start with these

ATC_INPUT_TC,0.22
INS_ACCEL_FILTER,10
INS_HNTCH_REF,0.18
INS_HNTCH_FREQ,30
INS_HNTCH_BW,15
INS_HNTCH_FM_RAT,0.7
LOG_BITMASK,180222

and I advise setting
FENCE_ENABLE,1
and check the other fence parameters - altitude and radius.
And experiment with GPS_GNSS_MODE and GPS_GNSS_MODE2 and what works best for your area.
Only select 2 constellations, usually GPS + GLONASS or Galileo. Only select SBAS and other option if you know they are actually available in your area.

You will definitely need to set up voltage monitoring at least - all the values are present in your parameters but there is no voltage to record. try to get this working before any more flights.

With those big props you will want to run the VTOL Quick tune script before you go any further. Make sure all your MOT_THST_EXPO , MOT_PWM and MOT_SPIN params are correct and suited to your ESCs first.

1 Like

My apologies, here is the bin file for your reference.

I will give those params a shot and see if there is a noticeable difference.

After setting the magnitude option it makes it a bit more clear that I believe it should be centered around about 40hz:

I’ll need to flash to the 4.4.0 beta to allow for the voltage module to work but I was a bit hesitant since it’s a beta. Do you recommend I attempt the quick tune before I go ahead with setting up the notch filter? The loiter is still a bit unstable so I really do not want to put this thing at risk of crashing during the tuning stage.

The problem is the motor outputs are very spread, giving you that very wide spread of frequencies in the FFT graph.

So you should first check COG and check that your motors are all perfectly level and the frame is not twisting under load. At the moment you may have weight shifted towards Motor4, but I think it’s more likely a twisted motor mount or frame. The easy check is to see if all the prop tips “point to each other” in perfect alignment.
image

When the motors are all running with a more even load, the FFT graph will show us a much more defined frequency range.

Why a firmware change for voltage monitoring? Are you not using the I2C based monitor that came with the 6X ?
I would definitely stick with the stable firmware release - with any large props you do not want any unexpected behaviours.

At this stage use all the parameters I already suggested, except change

INS_HNTCH_FREQ,40
INS_HNTCH_BW,40

This bandwidth is really too wide and may give issues, so try to stick with INS_HNTCH_BW,20 until more is known and other issues are sorted.
Plan to do that VTOL quick tune with the next flight too.

Especially with these big copters the build, tuning and general flight is a “whole package” so just changing a couple of params and attempting flight again rarely fixes much - you need to work on everything (like motor mount twist) in conjunction with the updated parameters to get better flight.
I just mention it because so many people try just changing one thing they had focused on and go test again - this is not so bad with a small quad where the danger is low.

Wow you really know your stuff I appreciate your support on this! You were right, I leveled all the motors prior to tuning but it looks like 3 of the motors were knocked out of level about 1.5 degrees all in the same direction. That explains why motors 3 and 4 were working a bit harder to counteract the yawing moment. The engine is mounted rearward and the gas tank is empty so there is a bit of a bias toward the rear motors right now but I felt like tuning it again at full weight would be better than going straight to that configuration.

The 6x only accepts digital power modules and the one included was only a 6s, I purchased this 12s power module but it is only supported in the beta so I have no choice but to use it for tuning at least. I’m not sure what I am going to do about this since I have no other option, I’m not well versed enough in ardupilot to make a custom firmware that allows for the voltage module to work through I2c.

I went ahead and set those params and attempted to run the quick tune without a voltage module. I was unable to begin the quick tune since the initial oscillations in loiter were already far too great, I was messing with the PIDS in an attempt to calm it down but it was consistently too violent to begin the tune. It’s performance in stabilize is flyable but in loiter it oscillates in both pitch and roll. Struggling to find any guidelines in terms of the proper way to set the stabilize error rates and acceleration values but I don’t think that is the root cause of my problem.

In other news the corrections to the motor level seemed to help bring all the thrust values closer together which is great. Looking at the new GYR3 plot it seems to have improved as well but it was not in the air for very long.

Please let me know what you think of the log as I have not been able to solve this loiter issue for a while.
Thanks again for all your help!

Stick with using Stabilise and AltHold until that quicktune and more tuning has been done, then we can work on Loiter.
Loiter itself is usually not the problem, but because it is trying to hold a specific position the position controller places more demands on attitude control which will “enhance” any issues you have hiding.

That’s weird - I’ll look into that more.
I would have thought that the only difference would be the voltage and current data, not the connectivity.

What ESCs do you have?
I suspect these are a bit wrong

MOT_PWM_MAX
MOT_PWM_MIN
MOT_SPIN_ARM
MOT_SPIN_MIN
MOT_THST_EXPO

Set these PIDs ready for the next flight to try and improve the oscillations before running the quicktune

ATC_ACCEL_Y_MAX,8000
ATC_ANG_RLL_P,4.0
ATC_ANG_PIT_P,4.0
ATC_RAT_PIT_D,0.0034
ATC_RAT_PIT_I,0.12
ATC_RAT_PIT_P,0.12
ATC_RAT_RLL_D,0.0034
ATC_RAT_RLL_I,0.12
ATC_RAT_RLL_P,0.12

But please dont fly until you’ve confirmed those ESCs for me because this information might change a few things and some behaviour.

Can quick tune still work in alt hold? I though it waits for 4 seconds after pilot input to begin tuning?

There is little to no documentation on the ESCs I have but I settled on them due to the efficiency ratings for the full power system, I can reach out to the manufacturer if you are looking for any specific information however. I believe those params are set mostly correctly as far as I know, I tried setting mot_pwm_min to 1100 but two of the escs would not arm so I had to revert back. Additionally the minimum speed to get all the props rotating is quite high but it is set correctly (esc calibrations would not fix this I tried multiple times). Mot_thst_Expo on the other hand I’m not sure, I used the calculator and it said to set it to about 0.85 but from what I’ve read with quicktune setting it lower will help based on the ESC you have. I could not find any information on whether or not these escs use linearization so I have it set a bit lower just to be safe.

I will try those PIDs tomorrow when the wind dies down, hopefully they will allow me to loiter so I can run the quick tune.

Thanks again,

They look suspiciously like the T-Motor or Hobbywing integrated power units, or copies.
It’s disappointing and somewhat crazy that they cant supply the most basic info, and the support page just has nothing… not even links to information.

I would set
MOT_PWM_MIN,1100
MOT_PWM_MAX,1940
and use motor test to recheck those MOT_SPIN_ARM and MOT_SPIN_MIN values.

Your MOT_THST_EXPO will be Ok until we see more results.

At the moment I cant find any special updates for the PM02D but I’ll keep searching…

Do you have it plugged into Power1 ?
image

Try changing the BATT_I2C_BUS

Also can you show a screenshot of the MissionPlanner / Setup / HWID screen please

EDIT
Found it!
This Pull Request went in just 2 weeks ago, to support a slightly different I2C power monitor chip
The new chip might appear on BATT_I2C_ADDR,45 instead of 65 - you can set 0 to probe all valid addresses. I dont think this will work for you though, until the stable firmware is updated.

1 Like

Yes they do look fairly similar and I wish I could have bought the kit from T motor instead but the efficiency and thrust rating of this power system was hard to beat. The lack of documentation is very disappointing but I can’t argue with the price to performance.

I tried setting MOT_PWM_MIN to 1100 but again two of the escs would not initialize after pressing the hardware safety switch. MOT_PWM_MAX was set to 1940. I used motor test to set the mot spin arm and min values and those are indeed the minimums, I made them a bit lower but any lower and some of the motors don’t rotate while others do.

Here is a screenshot of the HWID screen:

Wow that’s a nice find! Yes I had the power module plugged into power1, but messing with the BATT_I2C_ADDR could not get the power module to report any data. They say the defaults are supposed to just work and it did with the 6s module but running it on a voltage stepdown wouldn’t do much good for me.

The tune worked a bit better, I noticed that there were still oscillations in loiter but they were less than before. Unfortunately attempting the quick tune resulted in the drone crashing pretty violently so I think I will be stepping away from ardupilot at least for the near future. I felt like I was really close to getting it working right but since I couldn’t nail the root cause of this issue it would be too expensive to try again to continue testing. But thanks again for all your help I did really appreciate it.