-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tradheli Autotune Improvements #26722
Tradheli Autotune Improvements #26722
Conversation
@IamPete1 I made a pretty significant clean up of the heli autotune code. At least by my standards ;) I was wondering if you might take a look over the heli.cpp and provide any additional pointers on how to clean it up a little more. I'm sure there is a little more refactoring and ways that I could make it more readable. Already I have save 6K in flash on the cube orange+ :) |
@bnsgeyer you asked me to have a look at the autotests for this PR. It doesn't look like you're changing the test suite itself, just the simulated vehicle and default tuning values? I can have a look at the test failures, but if it's a vehicle dynamics sort of thing then you're far better off with help from @IamPete1 (or many other developers!) vs my rudimentary knowledge :-) |
@peterbarker sorrry, this was not the PR I was referring to. I just submitted the autotest PR last night. It is this PR I was having troubles with it but I think I figured out the error. Still would like you to look at it. |
b2d06ae
to
0b3c2e1
Compare
fe46f83
to
cf14372
Compare
d8f8d38
to
ab0c00d
Compare
d37eb8f
to
71183ec
Compare
@@ -572,6 +607,7 @@ void AC_AutoTune_Heli::load_gain_set(AxisType s_axis, float rate_p, float rate_i | |||
attitude_control->get_rate_roll_pid().slew_limit(smax); | |||
attitude_control->get_angle_roll_p().kP(angle_p); | |||
attitude_control->set_accel_roll_max_cdss(max_accel); | |||
attitude_control->set_ang_vel_roll_max_degs(max_rate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these are ever saved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are only set to allow user to limit rates during autotune, if desired. autotune does not determine max rates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a load call to put it back to the user's value after the tune is done in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The load gain set method is used by the post test gain set method to load the original values. look above at the other methods that call the load gain set method. You have
load_tuned_gains
load_intra_test_gains
load_test_gains
load_orig_gains
in all cases except load_test_gains the orig rate max is used.
19605d2
to
6cf7b52
Compare
void AC_AutoTune_FreqResp::set_dwell_cycles(uint8_t cycles) | ||
{ | ||
dwell_cycles = cycles; | ||
delete meas_peak_info_buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Randy or PeterB will come up with a suggestion on how we can avoid the delete by create a larger-than-required ring buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmackay9 @peterbarker I removed the ring buffer delete statement and cleaned things up. I think my code works fine without them. I just clear the buffer before it is used the next time. I guess the buffer pops that first thing that was given to it if it is not full? Please have a look and let me konw.
Co-authored-by: Peter Hall <[email protected]>
00f6997
to
15e183b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (review only, I have not tested)
This has been tested on actual helicopters by myself and @Ferruccio1984 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK to me
This PR was primarily focused on enabling the safe tuning of larger helicopters. I have made other changes along the way that help clean up the code and make it more efficient. Here is a list of changes