-
Notifications
You must be signed in to change notification settings - Fork 17k
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
Copter: improve shaping of rate controlled axes #20307
Conversation
We discussed this on the dev call and @bnsgeyer is going to move the parameters to the vehicle code. |
@rmackay9 need your help with how to pass in the time constants. I took my best guess at doing this. Please review and let me know what you think. It seems like a lot to pass them in on every cycle. I thought that we might be able to get away with passing them in when you enter the flight mode through the INIT function. However if someone was to make a change to a parameter while in the flight mode it would never be seen by the attitude controller. Looking for guidance. |
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 great to me.
7405d2b
to
703bed9
Compare
@lthall @rmackay9 So I did as Randy suggested and moved the time constant into the shaping call instead of having it as a separate accessor set function. It made me realize what I probably missed as far as parts of the code that use these shaping functions. So this change I just made was very invasive and will affect both plane and sub. I designed it that if you put zeros in for the time constants, it will revert back to the existing shaping function. But everywhere that calls any of these shaping functions will need to have the arguments added to comply with the new list. I thought of making a separate shaping function with the extra arguments that would be used only by copter and that would keep from having to mess with plane and sub. the function would just set the time constants and then call the existing function. Thoughts? |
541fd09
to
a2b5dd0
Compare
|
02f102a
to
6b8e371
Compare
e19899b
to
46daee5
Compare
We discussed this on the dev call today and agreed the approach looks good and BillG is going to add in the required param conversion. The enhancement to quadplanes to use this can be done in a future PR (PeterH may have expressed some interest in doing this). |
76ae393
to
5bb6a84
Compare
This looks good to me. Just a few things and then we're OK to merge
BillG, Tridge and IamPete1 suggested that if this command model was used in Plane and Sub we could reclaim about 1K of flash. |
ea5c52b
to
7ef0501
Compare
@rmackay9 So I was able to combine the two methods into input_shaping_ang_vel putting the if statement on rate_tc in the method. Much cleaner and really nothing needs to be done once quadplane adds the command model params.
lastly I set the default for the rate_tc to zero so there will be no change in behavior. I tested to ensure the rates were being shaped properly with the time constant and without and flew it in real flight as one final sanity check. please review and merge if you are happy. Thanks, |
Merged, thanks! |
I haven't included this in Copter-4.2.3-rc1 because it's a big enough change to make me worry and so I'd prefer we leave it to 4.3 which starts beta testing in a few weeks. Please tell me if you strongly disagree though because it's a team effort after all. |
@rmackay9 thats what I expected, I don’t think there is any reason that it has to go into 4.2. Thanks! |
This PR improves the shaping for rate controlled axes. This would include the yaw axis in stabilize mode and pitch, roll and yaw axes in Acro mode. The target rate shaping is improved by using the square root controller to provide a first order response to achieve the requested rate. Currently this is done by linearly increasing rate at ACCEL_MAX until the requested rate is achieved. Using the ACCEL_MAX to adjust the shape is not conducive to shaping the response. It doesn't adjust the acceleration request with the size of the rate request. The square root controller does a nice job at that.
This adds two parameters to allow users to adjust the rise time of the target rate to achieve the requested rate. One for pitch and roll axes and the other for yaw axis.