Tradheli Autotune RC2 - Alpha level testing

Hi Shawn, Thanks for the info. I intend to gain a bit more experience with what the heli’s are capable of. There are many parameters that for which I would like to change the defaults. I know how to do it but it will wreak havoc on those users that fly the defaults. So probably at the next major upgrade (4.1 to 4.2) and considering that I am confident as to the values I want to use, I would make those changes and warn the users of it.

@bnsgeyer Yesterday, I tried ATC_ACCEL_Y_MAX at 72000 before the Autotune tests and it handle it fine. I couldn’t tell the difference from the default of 27000 and 72000. So, did all of the Autotune test at 72000.

Will post all the Autotune test files tonight.

@bnsgeyer

Here is a fullset of RC2.1 Autotune test flights except I didn’t do Pitch VFF because you ask me to set it to 0.1

AUTOTUNE_VELXY_P worked a treat and I slowing started increased it over the various test flights, stopping at 0.2.

I’ve included a general handling flight log after all the Autotune setting were saved and it flew around fine. I’m sure you will find a few issues. There is also a short vdieo as well. The ALT_Hold wasn’t doing a great job! I have only checked the logs to confirm that all flights were successful.

Pitch Max Gain

Pitch ANG_P

Roll VFF

Roll Max Gain

Roll ANG_P

Yaw VFF

Yaw Max Gain

Yaw ANG_P

General handling flight

30sec video

:+1: Thank you for your work.

1 Like

Great! Glad you were able to complete the test flights. I will look at your data tonight.

Glad to hear that this helped the aircraft maintain position during your testing.

I assume alt_hold worked fine before conducting the autotune? I saw in your video that the aircraft tended to climb and descend constantly while doing the tests. I’ll look to see if there was some relation to the autotune code. The vertical axis should be independent as far as control. there could be some coupling to the vertical axis that the controller can’t suppress. I’ll look into it.

Thanks again for your testing. I’m excited to dig into the results and see how it did!

@Steve_Mitchell Some great test flights. The code was fairly successful in identifying good gain settings for your heli. Here are some results and suggested additional flights to further refine your tune.

First lets talk about the pitch axis

Pitch VFF

The VFF tune was not so successful in identifying your proper VFF gain. So I asked you to set it to 0.1. That seemed to work pretty well for the Max gain testing. I might have you refine that and increase it by 10% to make it 0.11.

Pitch Max_gain, Rate P and Rate D

This seemed to be very successful in identifying safe gains for tuning. Your max allowable values for Rate P and Rate D
max allowable Rate D was 0.0105
max allowable Rate P was 0.113

In the rate D tuning it determined the highest rate D gain to be 0.0209 so that it did not cause an increase in response gain.

In the rate P tuning, it stopped early because it never achieved the response gain before it hit the limit that I arbitrarily set (60% max allowable). The rate P gain that it stopped at was 0.0679. So there is room for additional tuning there.

Pitch Angle P tuning

This tuning was skewed by bad gain data from the frequency sweep.

So you can see in here that time 35:25 the gain (red) drops off and as the frequency increases beyond that it is very noisy and we start getting very high values that are garbage. That caused the code to pick the wrong frequency to concentrate on tuning angle p.

I would suggest that you limit the max frequency for angle P tuning with this axis to 35 rad/s. That will help it choose a better frequency. I would also ask you to lower the min freq to 5 rad/s so I can see if the VFF is set properly.

Additional Pitch tests

Change VFF to 0.11
reset Angle_P back to 4.5
Set AUTOTUNE_MIN_FRQ to 5
Set AUTOTUNE_MAX_FRQ to 35
Re-run Pitch Angle P tuning test.

1 Like

@Steve_Mitchell The roll axis tuning summary is below

Roll VFF tuning

Seemed to work very well. Determined Roll VFF to be 0.102.

Roll Max Gain, Rate P, and Rate D

Did very well determining the frequency for the response with 180 deg phase.
Max allowable Rate D gain was 0.0013
Max allowable Rate P gain was 0.0855

For Rate D, it determined the response gain was larger with just the first iteration of Rate D gain and set Rate D to zero because of that.

For Rate P, it raised it until it achieved the response gain of 1.4. It determined the Rate P gain to be 0.0213.

Roll angle P tuning

Again, it looks like the code picked up the wrong frequency to tune the angle P.

So I would recommend limiting the max frequency to bound the frequency choice. I would limit it to 40 rad/s.

additional roll tests

reset ANGLE_P back to 4.5
Set AUTOTUNE_MIN_FRQ to 5
Set AUTOTUNE_MAX_FRQ to 40
Re-run Roll Angle P tuning test

1 Like

@Steve_Mitchell Here is the summary of the Yaw tuning

Yaw VFF tuning

The code ran the test successfully but determined the Yaw VFF gain was so low that it just set it to zero

Max Gain, Rate P, and Rate D

Max allowable gain determination was done successfully
Max allowable Rate D gain was determined to be 0.00866
Max allowable Rate P gain was determined to be 0.285

In running the Rate D tuning, it found that the base Rate D gain of 0.0025 was large enough to not need additional tuning.

Rate P tuning took the base rate P gain from 0.18 to 0.226 for a desired response gain of 1.1

Yaw Angle P tuning

maxed out the angle P value to 10 and didn’t achieve the desired response gain of 1.4.

additional Yaw tuning tests

I would suggest running the yaw angle P test with your current gain settings. I would suggest change the AUTOTUNE_MIN_FRQ to 5 and AUTOTUNE_MAX_FRQ to 60. Just allow it to do the frequency sweep and then you can stop it. I just want to see what the current sweep looks like.

1 Like

@Steve_Mitchell I looked at your vertical axis. It appears that @Leonardthall may have changed the althold controller between 4.0 and 4.1. There are additional tuning gains for the VELZ controller. I don’t know how this would have affected your althold in the upgrade. Due to the low frequency nature of the oscillation (1/3 hz), my first guess is that it may be due to VELZ_P or POSZ_P being too high. you may have to spend some time retuning the vertical axis. maybe cut those two in half to get rid of the oscillation. If it goes away then you can try raising one at a time to see which one is causing it.

@bnsgeyer Thanks for the suggestion on how to re-tune the oscillation. It defiantly wasn’t oscillating in the vertical axis in 4.0.

Thanks also for looking at the Autotune flights. Some interesting results! It’s too windy at the moment to re-test all the ANG_P axis. Might have to wait until the weekend.

@bnsgeyer I re-did the Autotune test ANG_P with your suggestions today. Looks like Pitch reach it’s limit again.

Flight log for Yaw: AT RC2.1_00000213 G380 Yaw ANG_P.BIN - Google Drive

Flight log for roll: AT RC2.1_00000214 G380 Roll ANG_P.BIN - Google Drive

Flight log for Pitch: AT RC2.1_00000215 G380 Pitch ANG_P.BIN - Google Drive

I did some more flying afterwards and there was a small oscillation in pitch. So, I will need to re-tune after you have had another look at the logs.

Was the flying you are referring to after the pitch tuning and contained within this log. Remember that you have to switch out of autotune after it completes and then back into autotune to test the new setting that it made. If you tested the settings in a different flight, please send me the log.
Thanks again for testing. This has been very helpful!!!

@bnsgeyer No, I try to keep the tuning flights as short as possible to keep the logs small.

Here is the next flight where I tried Loiter out and some medium speed runs that had the pitch oscillations.
https://drive.google.com/file/d/1U7QO41Ox0705O5tcb32th3yEx1CvwjKz/view?usp=sharing

I am enjoying the testing. The guys at the Heli club think I’m mad! I rolled the 800 over on the ground while adjusting the hover trim settings in Mission Planner. My fault, I should have know better. Not a lot of damage and should have it back flying again in a couple of weeks.

:+1: @Steve_Mitchell Thank you for your work!

Heri

1 Like

@Steve_Mitchell I didn’t see any part of this flight in loiter mode. Sorry it took me a while to look at this. Is this the correct log?

@bnsgeyer No, problem and yes it is. I have just double checked/downloaded the log from my link, it definitely has some loiter in the file.

Ok. I will try again. Maybe I mixed up the file with others.

@Steve_Mitchell So I found the part of the log in which you switch to loiter. At the point where there were larger oscillations, it appears that you were performing a heading change. This seemed to cause issues with the controller trying to maintain the desired pitch and roll attitudes and I think is what caused the oscillations in loiter. Here is a plot of where the heading change occurs and the attitude starts to deviate from the desired attitude

It appears in general that the position controller tune in loiter is not doing so well.



You can see in the plots of desired vs actual velocities that they don’t match so well and get worse once the heading is changed.

My concern is that the integrator is causing some of the issue with the heading change. From the attitude controller perspective, you could try adding more I gain to help the integrator keep up with the changing controller. The other thing that could help the loiter mode is to add some PSC_VELXY_D gain. Try 0.1 and see if that helps. It should help with the phase lag between the desired velocity and actual.

@Steve_Mitchell alongside to what Bill suggested you could try lowering a bit PSC_POSXY_P. That is what solved that obscillation in my case.

@bnsgeyer @Ferrosan Thank you for taking a look at Loiter and making a few suggestions. I’ll give it a go this weekend.

Bill, did you also get a chance to look at my Autotune pitch log with the changes you requested below? It seem to reach the tune limit and not find a good tune.