-
Notifications
You must be signed in to change notification settings - Fork 19k
Improve quadplane use of forward throttle in VTOL modes #13760
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
Improve quadplane use of forward throttle in VTOL modes #13760
Conversation
8095af6
to
b059077
Compare
Paul some questions on this...first ..is this adding forward motor when only pitch would be used is QMODEs to fly forward rapidly? like Mark manual forward throttle? what modes is this active? what about VTOL waypoint moves is AUTO? does 0 gain disable it? (if so should be noted in metadata) |
It performs te following:
This method works in all VTOL modes other than auto-tune
Yes it does and metadata has been updated to make this clear. Also I have updated metadata to make it clear that this method replaces the velocity controller method controlled by Q_VFWD_GAIN that is less accurate and only works on flight modes that use the velocity controller. |
751a072
to
45f7699
Compare
Going to test this soon. Will report back |
Correction, it also does NOT work in Qstabilize mode.... Which is a good thing. |
77667b9
to
d247fab
Compare
I've consolidated the patches, fixed the bug preventing use with tilt rotors and incorporated feedback on parameter names and descriptions. |
@priseborough |
This is essentially adding an acceleration P gain. I completely agree that this is the way we need to go. However I don't think this is the correct place. I would like to see a full PID acceleration controller implemented in the position controller and integrated with the 6DoF work @lthall and @bnsgeyer are working on. It will take a bit longer to get there, but the final result should be better. |
It is not adding a P gain, ie there is no new feedback loop. It is replacing the use of forward pitch to achieve acceleration with forward throttle to replace the acceleration lost due to pitch limiting,. As such I see this as being downstream of any acceleration feedback controller and belonging in a control mixer. |
Sorry, your of course right. I'm confusing what I had in mind and what you actually did. However I still think this is in the wrong place, the position controller needs visibility of this extra degree of freedom. For example this lets the vehicle go quite fast while staying level, however that speed is still constrained by To elaborate on the approach I was thinking about. We add a 2D acceleration controller, unlike the current position controller we align to vehicle yaw so we can have different forward/back and left/right gains. The closed loop nature of this controller means that we can just hard code the mixing that you have parameterized with |
I would propose a different way of architecting the required functionality. How about making the position controller agnostic to the method that is used to generate a specific force in the Front Right Down directions and let the vehicle libraries to the required mapping as this is gong to be unique to different vehicle types. I don't think long term the position controller should be responsible for the mapping from specific force demand to actuation. |
These changes should not impact on future position controller restructuring. The attached sketch shows how the position controller (PSC) pitch setpoint is limited in the quadplane code and converted to the forward throttle demand in quadplane::calc_fwd_tilt_throttle() This is all done open loop. Extending this to the tilt rotor case was trivial f896636 as the functionality required to convert a forward thrust demand to a rotor tilt already exisited. What I would like to see us adopt in the future is a more generic position controller interface that outputs specific force demands in the forward and right direction. The vehicle code would then convert that to whatever combination of vehicle attitude, actuation angles and motor throttle required to produce the required force. This would require the vehicle code to provide the position controller with dynamically updated saturation limits for specific force in the front, back, right, left directions. |
I'm expecting to see a position controller class. Am I missing something? |
Here is an example acceleration into wind in QLOITER mode from @pompecukor 's testing with Q_FWD_PIT_LIM 500 The aircraft can now achieve over 30 m/s of airspeed in QLOITER without porpoising or losing height. The following figure shows a stick forward acceleration to maximum ground speed followed by a stick release decel. ![]() Note the height gain during decel which is due to the pitch back and increase in wing lift. This PR does not modify that behaviour. Height control accuracy was good during the acceleration phase. ![]() The following figure shows right and left rotor tilt servo PWM demand where forward tilt are larger values. ![]() The position controller was able to control horizontal position accurately throughout. ![]() |
ArduPlane/mode_qloiter.cpp
Outdated
@@ -92,7 +92,7 @@ void ModeQLoiter::run() | |||
|
|||
// call attitude controller with conservative smoothing gain of 4.0f | |||
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(plane.nav_roll_cd, | |||
plane.nav_pitch_cd, | |||
MAX(plane.nav_pitch_cd, quadplane.q_fwd_nav_pitch_lim_cd), |
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.
We should apply this up on 84, the set_VTOL_roll_pitch_limit
call will be limiting to the wrong value other wise. So 84 would become:
plane.nav_pitch_cd = MAX(loiter_nav->get_pitch(), quadplane.q_fwd_nav_pitch_lim_cd);
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 throttle handling stuff all looks good. But I think we need to be very careful where we apply the angle limit, since were now directly affecting what a mode it doing by taking away pitch forward rather than just adding extra throttle I think we should output the throttle in the same place we apply the angle limit such that we can never get one without the other.
I think we also need to make sure we update nav_pitch_cd
to the limited value because it is used throughout the code in various odd places that might get upset if it does not represent what the vehicle is doing.
I'm happy to help with some re-work if that would be usefull.
ArduPlane/quadplane.cpp
Outdated
q_fwd_throttle = 0.0f; | ||
q_fwd_nav_pitch_lim_cd = -aparm.angle_max; |
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.
maybe a "is_active" method rather than keeping this copy.
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 understand.
ArduPlane/quadplane.cpp
Outdated
@@ -934,13 +953,13 @@ void QuadPlane::multicopter_attitude_rate_update(float yaw_rate_cds) | |||
|
|||
if (use_yaw_target) { | |||
attitude_control->input_euler_angle_roll_pitch_yaw(plane.nav_roll_cd, | |||
plane.nav_pitch_cd, | |||
MAX(plane.nav_pitch_cd, q_fwd_nav_pitch_lim_cd), |
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 think we have to set nav_pitch_cd
to this limit before getting into this call. For example tailsitter transitions need to break these rules. I know that tailsitters should never have this set, but they might.
I just thought of something else that makes this even more tricky to implement. We need to tell the position controller when we have run out of throttle or tilt so it can stop winding up I term. We do have a |
I can achieve the required integrator protection by calling set_lean_angle_max_cd to provide a lean angle that corresponds to when forward throttle will be saturated. I would like to split set_lean_angle_max_cd into a separate call for forwards tilt. I'll give you a call to discuss. |
59dfc69
to
918b46f
Compare
@IamPete1 I've reworked it to move the angle limiting and forward thrust calculation to just after we get the demanded pitch angle from the position controller so that a consistent pitch angle demand is guaranteed for all downstream processing. |
and use a common function for the active method
Don't unnecessarily increase the forward pitch limit when position control forward action is saturated.
ArduPlane/mode_qstabilize.cpp
Outdated
@@ -35,6 +35,11 @@ void ModeQStabilize::update() | |||
plane.nav_roll_cd = roll_input * plane.quadplane.aparm.angle_max; | |||
plane.nav_pitch_cd = pitch_input * plane.quadplane.aparm.angle_max; | |||
} | |||
|
|||
if (plane.control_mode->mode_number() == Mode::Number::QSTABILIZE) { |
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.
this check is preventing assign_tilt_to_fwd_thr() being called in QHOVER mode. I just tested QHOVER and the new functionality doesn't work with the RC switch
we can either remove the check and remove the call in qloiter, qrtl etc, or add the call into all the relevant modes
I think it is better to have it in one place?
I don't think we can fix the above issue by just always running in qstabilize for all modes as it would defeat the checks per-mode for things like throttle_wait, if a user put the nose down while in throttle wait it would run up the fwd motor |
this prevents double calling and fixes qhover
68c9928
to
1d4c738
Compare
@priseborough as discussed, I've fixed by moving the assign tilt to the run() function |
This patch provides a more direct control of forward thrust motor throttle during quadplane Q modes. I have found it to provide more precise position control in varying wind conditions in Q_LOITER and better control with less pitch/dive when operating in QSTABILIZE and QHOVER and applying forward tilt to reposition or hold position in wind.
I would be interested to get feedback from other quadplane flyers.