Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Public Member Functions | Public Attributes | List of all members
VesselAutopilot.VesselSAS Class Reference

Public Member Functions

void AutoTuneReset ()
 
void AutoTuneScalar ()
 Autotune the PID channel as a factor of maximum angular acceleration (torque-to-MOI ratio). Autoscalar Formula: scalarFactor * angularAccelerationMax + scalarIntx Higher Ratio gives lower scalar (reducing the PID response) More...
 
bool CanEngageSAS ()
 
void ConnectFlyByWire (bool reset)
 
void Destroy ()
 
void DisconnectFlyByWire ()
 
void LockRotation (Quaternion newRotation)
 
void ModuleSetup ()
 
void ResetAllPIDS ()
 
void ResetTuningScalars ()
 
void SetDampingMode (bool isEnabled)
 
void SetLockPitchPID (float Kp, float Ki, float Kd, float clamp)
 
void SetLockRollPID (float Kp, float Ki, float Kd, float clamp)
 
void SetLockYawPID (float Kp, float Ki, float Kd, float clamp)
 
void SetTargetOrientation (Vector3 tgtOrientation, bool reset)
 Connects the fly-by-wire and sets the target orientation for non-stability hold modes. More...
 
void SetTuningScalar (float scalar)
 
void Start ()
 
void TuneScalars (float scalar)
 
void Update ()
 
 VesselSAS (Vessel v)
 

Public Attributes

Vector3 autoScalarMax = new Vector3(10f, 10f, 10f)
 Clamp maximum autoScalar. More...
 
Vector3 autoScalarMin = new Vector3(0.50f, 0.50f, 0.50f)
 Clamp minimum autoScalar. More...
 
bool autoTune = true
 Flags use of the PID auto tuner. More...
 
float coastScalar = 2f
 When switching targets, this scales when to coast (reduce SAS inputs) More...
 
float controlDetectionThreshold = 0.05f
 Input deadband. More...
 
int dampingCooldown = 20
 
bool dampingMode = false
 True if the SAS is in damping mode (not stuck on a heading yet). Used to flag the UI button. More...
 
Vector3 decayDeltaThreshold = 0.1f * Vector3.one
 Decay when delta error below threshold. More...
 
Vector3 decayMin = 0.10f * Vector3.one
 Min clamp for the decay scalar. More...
 
Vector3 decayRate = 0.005f * Vector3.one
 Rate to decay the scalar. More...
 
Vector3 decayResponseThreshold = 0.02f * Vector3.one
 Decay when sas response below threshold. More...
 
bool lockedMode = true
 Set to true for stability assist, false for all other SAS modes. More...
 
Quaternion lockedRotation
 The rotation the SAS is trying to maintain. More...
 
Vector3 negTorque
 
float overrideMinimumMagnitude = 0.1f
 Above this angular velocity, the SAS enters damping mode. More...
 
PIDclamp pidLockedPitch
 Pitch PID controller (Pitch is X axis) More...
 
PIDclamp pidLockedRoll
 Roll PID controller (Roll is Y axis) More...
 
PIDclamp pidLockedYaw
 Yaw PID controller (Yaw is Z axis) More...
 
Vector3 posTorque
 
Vector3 scalarFactor = new Vector3(-0.3f, -0.3f, -0.3f)
 Slope factor for autoScalar. More...
 
Vector3 scalarIntx = new Vector3(2f, 2f, 2f)
 Intercept factor for autoScalar. More...
 
float scalarRate = 0.9f
 Lerp rate for change in scalar. More...
 
float stopScalar = 1f
 When switching targets, this scales when to reverse SAS inputs to stop the turn. More...
 
Vector3 targetOrientation
 Orientation SAS is trying to reach. More...
 
bool useDecay = true
 Flag usage of the decay response. More...
 

Constructor & Destructor Documentation

VesselAutopilot.VesselSAS.VesselSAS ( Vessel  v)
inline

Member Function Documentation

void VesselAutopilot.VesselSAS.AutoTuneReset ( )
inline
void VesselAutopilot.VesselSAS.AutoTuneScalar ( )
inline

Autotune the PID channel as a factor of maximum angular acceleration (torque-to-MOI ratio). Autoscalar Formula: scalarFactor * angularAccelerationMax + scalarIntx Higher Ratio gives lower scalar (reducing the PID response)

< ki decays as craft settles onto target orientation (prevents accumulation of integral error)

bool VesselAutopilot.VesselSAS.CanEngageSAS ( )
inline
void VesselAutopilot.VesselSAS.ConnectFlyByWire ( bool  reset)
inline
void VesselAutopilot.VesselSAS.Destroy ( )
inline
void VesselAutopilot.VesselSAS.DisconnectFlyByWire ( )
inline

< Disconnect the Fly By Wire

void VesselAutopilot.VesselSAS.LockRotation ( Quaternion  newRotation)
inline
void VesselAutopilot.VesselSAS.ModuleSetup ( )
inline
void VesselAutopilot.VesselSAS.ResetAllPIDS ( )
inline
void VesselAutopilot.VesselSAS.ResetTuningScalars ( )
inline
void VesselAutopilot.VesselSAS.SetDampingMode ( bool  isEnabled)
inline
void VesselAutopilot.VesselSAS.SetLockPitchPID ( float  Kp,
float  Ki,
float  Kd,
float  clamp 
)
inline
void VesselAutopilot.VesselSAS.SetLockRollPID ( float  Kp,
float  Ki,
float  Kd,
float  clamp 
)
inline
void VesselAutopilot.VesselSAS.SetLockYawPID ( float  Kp,
float  Ki,
float  Kd,
float  clamp 
)
inline
void VesselAutopilot.VesselSAS.SetTargetOrientation ( Vector3  tgtOrientation,
bool  reset 
)
inline

Connects the fly-by-wire and sets the target orientation for non-stability hold modes.

Parameters
tgtOrientationThe desired orientation
resetResets the PID when true
void VesselAutopilot.VesselSAS.SetTuningScalar ( float  scalar)
inline
void VesselAutopilot.VesselSAS.Start ( )
inline
void VesselAutopilot.VesselSAS.TuneScalars ( float  scalar)
inline
void VesselAutopilot.VesselSAS.Update ( )
inline

Member Data Documentation

Vector3 VesselAutopilot.VesselSAS.autoScalarMax = new Vector3(10f, 10f, 10f)

Clamp maximum autoScalar.

Vector3 VesselAutopilot.VesselSAS.autoScalarMin = new Vector3(0.50f, 0.50f, 0.50f)

Clamp minimum autoScalar.

bool VesselAutopilot.VesselSAS.autoTune = true

Flags use of the PID auto tuner.

float VesselAutopilot.VesselSAS.coastScalar = 2f

When switching targets, this scales when to coast (reduce SAS inputs)

float VesselAutopilot.VesselSAS.controlDetectionThreshold = 0.05f

Input deadband.

int VesselAutopilot.VesselSAS.dampingCooldown = 20
bool VesselAutopilot.VesselSAS.dampingMode = false

True if the SAS is in damping mode (not stuck on a heading yet). Used to flag the UI button.

Vector3 VesselAutopilot.VesselSAS.decayDeltaThreshold = 0.1f * Vector3.one

Decay when delta error below threshold.

Vector3 VesselAutopilot.VesselSAS.decayMin = 0.10f * Vector3.one

Min clamp for the decay scalar.

Vector3 VesselAutopilot.VesselSAS.decayRate = 0.005f * Vector3.one

Rate to decay the scalar.

Vector3 VesselAutopilot.VesselSAS.decayResponseThreshold = 0.02f * Vector3.one

Decay when sas response below threshold.

bool VesselAutopilot.VesselSAS.lockedMode = true

Set to true for stability assist, false for all other SAS modes.

Quaternion VesselAutopilot.VesselSAS.lockedRotation

The rotation the SAS is trying to maintain.

Vector3 VesselAutopilot.VesselSAS.negTorque
float VesselAutopilot.VesselSAS.overrideMinimumMagnitude = 0.1f

Above this angular velocity, the SAS enters damping mode.

PIDclamp VesselAutopilot.VesselSAS.pidLockedPitch

Pitch PID controller (Pitch is X axis)

PIDclamp VesselAutopilot.VesselSAS.pidLockedRoll

Roll PID controller (Roll is Y axis)

PIDclamp VesselAutopilot.VesselSAS.pidLockedYaw

Yaw PID controller (Yaw is Z axis)

Vector3 VesselAutopilot.VesselSAS.posTorque
Vector3 VesselAutopilot.VesselSAS.scalarFactor = new Vector3(-0.3f, -0.3f, -0.3f)

Slope factor for autoScalar.

Vector3 VesselAutopilot.VesselSAS.scalarIntx = new Vector3(2f, 2f, 2f)

Intercept factor for autoScalar.

float VesselAutopilot.VesselSAS.scalarRate = 0.9f

Lerp rate for change in scalar.

float VesselAutopilot.VesselSAS.stopScalar = 1f

When switching targets, this scales when to reverse SAS inputs to stop the turn.

Vector3 VesselAutopilot.VesselSAS.targetOrientation

Orientation SAS is trying to reach.

bool VesselAutopilot.VesselSAS.useDecay = true

Flag usage of the decay response.


The documentation for this class was generated from the following file: