I auto tuned with ESC telemetry and filmed it

The drone seems to bounce between twitches.

This is the gyro noise. I don’t know if an amplitude of 1.2 is good or bad

This is the log file

Pixhawk Autotune with ESC telemetry 02/11/2021. This is only the pitch axis tune.

I am using the following:
Pixhawk from 2014
T-Motor P50A ESC
RCTimer 360KV motors
6S batteries, each 2650 mA
Currently a prototype aluminium frame

I removed the retractable legs, gimbal and camera to try and have the least number of variables.

You’ve got some sort of weight or thrust imbalance going on, motor2 has high output and motor4 has low output. In stabilise mode that could easily cause the drift you are seeing.
Maybe retry the level setting too - level the whole frame across the top of the motors with a spirit level and press the Calibrate Level button in MissionPlanner. This needs to be quite exact.

Also you might want to lower your MOT_SPIN_MIN a little to 0.12 - it was hitting minimum a lot during that Autotune.

The messages say the autotune gains were saved, but I dont see them in parameters.
Acording to messages they should be:
ATC_RAT_PIT_P,0.243103
ATC_RAT_PIT_I,0.243103
ATC_RAT_PIT_D,0.012755
ATC_ANG_PIT_P,16.80055
ATC_ACCEL_P_MAX,71600.00
Check what you see in parameters now, see if they are the same as what I copied in here, or unchanged from previous flights. You might need to run Autotune again to verify what it does - after making a few adjustments as per below.
If you are not actually in the process of transmitter based tuning then set TUNE = 0 or it will be setting the selected PID value whether you like it or not.

That battery failsafe was interfering a lot, you’ll need a better battery. To save time, and if the new tuning values did exist in params, copy the new Pitch params to Roll and see how it goes.

You’ve got Harmonic Notch Filter enabled and working via ESC telemetry, which is great. You have to set INS_HNTCH_REF,1
And you’ve also got a static Notch enabled at 80Hz. I would set INS_NOTCH_ENABLE = 0 to disable that and let the harmonic notch do it’s job.
Lets see a test flight with these set, to see if the harmonic notch filter is doing it’s job. It looks to me like your primary frequency is about 42Hz not 80Hz as configured.
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,2

1 Like

Thank you. I am at the field now so I will set the config

Seems the auto tune values saved. I will record another video now again

Done the following
Mot_spin_min = 0.12
Tune = 0
I calibrated the battery monitor so should have another 1. 5V available
Copied values


INS_HNTCH_REF = 1
INS_NOTCH_ENABLE = 0
INS_LOG_BAT_MASK = 1
INS_LOG_BAT_OPT = 2

Will try to fly now

@ xfacta Sorry, the gimbal didn’t track as well this time so there are some sections where the drone isn’t in the video, it is just 5 to 10 seconds at a time. I fixed it as soon as I had a moment.

This was trying the new settings and then auto tuning. The new settings didn’t seem great on the roll. I see the drone auto tuned roll pack to how it was before. Should I maybe look at how I can design the drone to have the batteries sit in the middle? I have it this way so that the gimbal can sit in the middle, but maybe it is just too much weight on the edges.

This was after saving the auto tune and testing the drone

This is the log file

When I get back to the workshop I will look at the level again. I attached a wire on the top of the drone so that it can hang freely. I will show a video of that later today.

I had a look at the noise, seems that is at 90 on the one graph and 88 on the other

Pitch is quite good now, I would copy all the same values into Roll and probably no need to Autotune since your aircraft is quite symmetrical. If the weight is a bit uneven you could still Autotune on Roll axis.
You can do Yaw Autotune any time, but it’s not as critical as pitch and roll.

I think the Harmonic Notch filter needs a bit more adjustment:
INS_HNTCH_FREQ,45
INS_HNTCH_BW,22

Later when you get it all put back together, gimbal and all, just change these parameters to suit the difference in take off weight:

new ATC_ACCEL_P_MAX = ATC_ACCEL_P_MAX x (min_TOW / max_TOW)
new ATC_ACCEL_R_MAX = ATC_ACCEL_R_MAX x (min_TOW / max_TOW)
new ATC_ACCEL_Y_MAX = ATC_ACCEL_Y_MAX x (min_TOW / max_TOW)

I wouldn’t suspend the frame for determining level, I would sit it on flat stable ground and pack it under corners to achieve level.

Your vibrations are nice and low, so you should be able to set this too:
ATC_THR_MIX_MAN,0.5
and these:
PSC_ACCZ_I,0.4
PSC_ACCZ_P,0.2

Remember to set these too.
BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2

Do another flight when you can to check the Harmonic Notch (and other settings). There could be a couple of alternative configs to try.

Try these Loiter params too, I think you’ll like them
LOIT_ACC_MAX,600
LOIT_BRK_ACCEL,300
LOIT_BRK_DELAY,0.3
LOIT_BRK_JERK,300

I think sometimes the altitude drop you see is a combination of the wind affecting the baro pressure, and also probably some prop-wash since those props are quite big for that sized frame.

Also the prop size is what is making that INS_HNTCH_FREQ so low, 45, instead of up around 80 for smaller props. That’s not necessarily a bad thing.

I’ve been trying to work out what to do with compass calibration, if anything…

Thank you again for helping. The pack should be full in the next hour then I can try again.

I copied all the values from Pitch to Roll again. I will fly a whole battery this way to see what it does.

Changed INS_HNTCH_FREQ from 80 to 45
Changed INS_HNTCH_BW from 40 to 22
Changed ATC_THR_MIX_MAN from 0.1 to 0.5
Changed PSC_ACCZ_I from 1.5 to 0.4
Changed PSC_ACCZ_P from 0.75 to 0.2
Changed BATT_FS_CRT_ACT from 0 to 1
Changed BATT_FS_LOW_ACT from 0 to 2
Changed LOIT_ACC_MAX from 500 to 600
Changed LOIT_BRK_ACCEL from 250 to 300
Changed LOIT_BRK_DELAY from 1 to 0.3
Changed LOIT_BRK_JERK from 500 to 300

I shifted the rear battery slightly, 1cm to the right, away from motor 2 towards motor 4.

I calibrated the compass before the second flight. What do you see with the compass? I have the GPS mounted as high as possible. Maybe it is moving slightly because the GPS holder base isn’t very tall and maybe the balsa wood has some give. I can see if I can get an aluminium tube of this size or I will just have to design a print a new base and top. I am also flying about 50m from a cellphone tower. Not sure if that could be an issue. I also have to slightly lift the drone now, because it doesn’t have legs, to connect the batteries.

The compass/GPS position should be OK provided it’s not vibrating too much, I’m just checking for interference.

This was from the flight after all the changes

Auto also seems to work well. Huge difference between today and last week when it was actually chasing me around the field.

I will see what I can do about motor 2. It gets very hot. Moving the battery didn’t help. I will see if that leg is horizontal. I might fly once without the rear battery to remove weight there and see what it does.

What do you think of the flight? Is the sound normal? It doesn’t fly very fast. I am ok with that but will it be able to handle strong wind or do I need more power?

This is after I removed motor 4 and installed it again. I think it is even worst now.
https://www.dropbox.com/s/h4sylh5bx53nuor/00000170.BIN?dl=0

The flight seemed fine. Still twitches a little bit on its own. Probably that motor 4. I will check if the frame is level tomorrow. Now that everything is working I will start converting to carbon. That should also help I think because it will be very stiff.

I think I am doing something wrong with the mission planning. It isn’t turning towards the middle. I created a circle and made every second waypoint do_set_roi and moved each point into the middle. Looking at this tutorial that is the mistake I made. I should just set the a single ROI and if I set it again it will disable it so I will try tomorrow with a single ROI.

I also received my range finder. The TF-luna
https://amzn.to/3pVJFA4

I found links about how to set it up using I2C. I had to swap wires 2 and 3 for it to work. 2 goes to pin 3 and 3 goes to pin 2.

It is reading a value and I believe I configured everything so that it will actually activate.
This is all my parameters now

On this page Simple Object Avoidance — Copter documentation it says to set PRX_TYPE to 4 so that it will work as a proximity sensor. If I set it to 4 then there aren’t any rangefinder readings on the status tab. If I set it to 0 then I get values again. So not sure if I should set it or not.

I went flying today. Things went very well. Nobody almost died so that is always a good thing :slight_smile:
It does a twitch here and there but it is probably because of the body

Things I need to sort out:

Figure out what I am doing wrong on mission planner. I set a single DO_SET_ROI but it didn’t turn to the middle. I tried every second waypoint and now I tried a single waypoint.

I need a better battery monitor. I think I probably damaged my battery today.
Seems people like this company ( Mauch) https://baskaerospace.com.au/shop/sensors/mauch-002/

Rangefinder
I tested the rangefinder. If I set PRX_TYPE to 0 then the values show up in the status tab. If I change PRX_TYPE to 4 then nothing shows up.
I walked towards my drone and when the numbers showed up I went up to where the numbers showed 300 and it didn’t move backwards. When I wasn’t close the number would show 1200. I was too scared to try and fly it into a pole to test it.

Replace the aluminium body with a carbon body so that I can make sure everything is level. The aluminium body bends too easily. I can bend the legs up and down on the bench.

Replace the aluminium 20mm x 20mm legs with carbon 15mm x 15mm legs.

This is the log of today. I flew for +20 minutes. I was flying left and right, forward and back, not just hovering. So I am happy with the length of flight. I could not have done it with the help of everyone that has helped me so far. So thank you again to everybody. If I could afford it I would send everyone a Christmas present. Maybe if I get drone jobs in the near future that might be possible :slight_smile:

Yes to the Mauch sensor. Bask will be your best supplier too I think.
Usually the standard current/votage sensors can be manually calibrated a bit better than the default BATT_VOLT_MULT too.

Pitch, Roll and Yaw are all tracking nicely.
Other good news is the Harmonic Notch filter is set up correctly and working right on the motor RPM frequency.

Bad news is Motor2/ESC1 were having a hard time starting on this arming attempt - is that the one you’ve been saying is twitching?
Check over the connections and wires for any breakages, or breakages about to happen.

.What are your BLHELI settings in the ESCs?

Yes, I have been having issues with motor 2 on and off. When it spins it spins but sometimes it takes a moment to get going. I took the whole drone apart a few days ago and everything seemed fine.

I pulled on all the wires on the ESC just now and nothing came off. I might swap the motor and see if it is the motor. If I still have issues I will probably redo the bullet connectors. I will just need to get more connectors, I have nothing left in stock now.

How do you see that the filter is working well?
Are these values good? That long spike makes me worry.

You mentioned some other noise that you are worried about. How do you see that? Shouldn’t the aluminium body block most electrical noise?

When I lifted off I had the error I always have with lift off, ground mag anomaly. I am going to fly now again and take a video.

I sent the designs in now to get milled out of carbon fibre. The aluminium frame is 1.2mm. It bends too easily and the bends don’t go away. I am not sure if I want the frame out of 1mm or 0.8mm carbon. I don’t know what the minimum is I can get away with.

What I added to the design vs now:
A base that will be on anti vibration dampeners so the flight controller will have double dampening
A roof so that I can put a hook on top to make sure the drone is always level. It will also protect the wiring if the drone flips, but as it is flying now I don’t think that will happen again.

This is the BLHeli setup

All ESC’s info

Config screen all ESC’s

ESC 2 info

Do you have an idea why the rangefinder isn’t causing the drone to move backwards when I walk towards it?

So seems when you set a rangefinder to a proximity sensor it doesn’t display the rangefinder values anymore. You need to open up the proximity map.
This guy describes how to do it

I will test this probably tomorrow. Too many people now on the field.

I did a quick test in the backyard and it works. I will do a full test tomorrow. It seems the sensor area is very small. It will be fine for a tree or a wall but not a human or a lamp post. I probably need a few more sensors on the front or some how make the sensor move slightly left and right the whole time

The shape of the FFT graphs looks similar to how they were before any filtering but the amplitude is the big change.
On the FFT graphs if you hover the mouse pointer over the graph lines it tells you the frequency and associated RPM.
Check in the log under ESC for you individual motor RPMs.

You can see from the FFT graphs and ESC data we picked the correct value to suit the motor RPM. You can also see the following peaks are multiples of that first peak. If they were unevenly spaced you would have to decide which was the primary (and secondary) due to motor noise and set HNOTCH values accordingly, and which peak (if any) requires a static notch.

Aluminium can act like a ground plane and may also filter some electrical noise, as will carbon fibre since it is conductive, but neither are ferrous and wont shield against magnetic fields.
I think you are getting some magnetic interference from battery and power wiring to the compass. If you keep using this frame while the new one is built, you might want to do the compass/motor calibration.
https://ardupilot.org/copter/docs/common-compass-setup-advanced.html#common-compass-setup-advanced-compassmot-compensation-for-interference-from-the-power-wires-escs-and-motors
Read over the instructions carefully - it can be dangerous if precautions are not followed.

Be aware that it is possible to over-damped the flight controller and it wont pick up tiny movements that it should, and it wont react as quick or as well. If you vibrations are low and tuning was successful how it is now then you have it just right.
Your existing damping system is working well, but a nice stiff CF frame might change that too. Your aluminium frame might (or might not) have some resonance that a CF frame wont, it could be better or worse - you’ll have to assess that once the new build is complete. It will be good to have the option of more or less damping.

I couldnt see anything wrong with your ESC config. So you may still have an issue with that motor, or that ESC.
One thing I would change → I would drop the temperature protection to 100°C or 110°C.
/rant
I haven’t been able to work out why BLHELI makes the default value 140°C since the tiny little processor (MCU) is rated for “Temperature range from -40 to 85 ° C or from -40 to 105 ° C” and stops working at 120 or less. Sure the temperature reported should be the FETs and not the MCU, but in reality the whole ESC is only small and it will all heat up. And depending on the ESC design and manufacturer, the temperature is often taken from the MCU internal temperature sensor.
/end rant

Make sure that rangefinder is powered from an external 5vdc source (BEC) and not from the Flight Controller serial port.

I will change the esc temperature now before my flight. Currently I am running the rangefinder via I2C so I will redo the wiring to get the power from my VTX 5V line after this flight.

I did a flight now. Will show the logs. Everything went very well I think. I am not sure if I should set my D on PID to get it to stop stuttering when I go left and right.

I also had an error come up again and had to reboot. Not sure where to log bugs

I am getting more confident now that it isn’t always trying to kill me. I will go get an SD card to record the flight through the vtx. Next is to attach legs again and the gopro.

1 Like