Feature Request: Autopilot PID Throttle Limits
liamdennehy opened this issue ยท 0 comments
Presently, the throttle setting that comes from the autopilot's "Acceleration" PID (PIDRequestedThrottle
) is simply passed directly to the craft (CraftCommandedThrottle
). If the PID ever requests zero or full thrust this is applied even though the craft or flight may be harmed by this (max thrust means overheating engines, zero thrust stops rocket engines with limited ignitions etc).
This feature would introduce two new user-configurable PID limits (PIDThrustMax
and PIDThrustMin
) as mocked in the PID settings window section here:
Assuming these two values are stored internally as values between 0 and 100, while PID output and commanded thrust input are between 0 and 1, this can be implemented without changing the core logic of the PID (e.g. setting new bounds internally) by using the limits to determine the final commanded value from the PID's requested value:
CraftCommandedThrottle =
((PIDRequestedThrottle * (PIDThrustMax - PIDThrustMin))/100 + PIDThrustMin) / 100
Side note: Zero as a minimum for autopilot is problematic: IRL an autopilot would never command engine shutdown, only a reduction to flight idle, so a default of 5% or 1%` makes more sense than zero, which KSP interprets as "shut the active engines down". This would be a better match for realism mods especially. Perhaps a bonus in the feature is to detect if ROEngines/RealFuels is present and set a non-zero default minimum, but now I'm just being pushy ๐