Skip to main content

Class: AutopilotDriver

Defined in: src/sdk/autopilot/AutopilotDriver.ts:56

An autopilot driver to set pitch and bank values in the sim AP.

This driver follows the sim's convention for negative and positive values: AUTOPILOT BANK HOLD REF/PLANE BANK DEGREES: negative = right, positive = left AUTOPILOT PITCH HOLD REF/PLANE PITCH DEGREES: negative = up, positive = down INCIDENCE ALPHA: negative = down, positive = up AMBIENT WIND Y: negative = down, positive = up

Constructors​

Constructor​

new AutopilotDriver(bus, apValues, apMasterOn, options?): AutopilotDriver

Defined in: src/sdk/autopilot/AutopilotDriver.ts:99

Creates an instance of this Autopilot Driver.

Parameters​

ParameterTypeDescription
busEventBusAn instance of the Event Bus.
apValuesAPValuesAutopilot values from this driver's parent autopilot.
apMasterOnSubscribable<boolean>Whether the AP is engaged.
options?Readonly<AutopilotDriverOptions>Options for this driver.

Returns​

AutopilotDriver

Methods​

driveBank()​

driveBank(bank, rate?): void

Defined in: src/sdk/autopilot/AutopilotDriver.ts:187

Drives the commanded autopilot bank angle toward a desired value using a linear servo.

Parameters​

ParameterTypeDescription
banknumberThe desired bank angle, in degrees. Positive values indicate left bank.
rate?numberThe rate at which to drive the commanded bank angle, in degrees per second. Defaults to the bank servo's default rate.

Returns​

void


drivePitch()​

drivePitch(pitch, adjustForAoa, adjustForVerticalWind, rate?, maxNoseDownPitch?, maxNoseUpPitch?): void

Defined in: src/sdk/autopilot/AutopilotDriver.ts:250

Drives the commanded autopilot pitch angle toward a desired value using a linear servo while optionally correcting for angle of attack and vertical wind.

Parameters​

ParameterTypeDefault valueDescription
pitchnumberundefinedThe desired pitch angle, in degrees. Positive values indicate downward pitch.
adjustForAoabooleanfalseWhether to adjust the commanded pitch angle for angle of attack. If true, the provided pitch angle is treated as a desired flight path angle and a new commanded pitch angle will be calculated to produce the desired FPA given the airplane's current angle of attack. This correction can be used in conjunction with the vertical wind correction. Defaults to false.
adjustForVerticalWindbooleanfalseWhether to adjust the commanded pitch angle for vertical wind velocity. If true, the provided pitch angle is treated as a desired flight path angle and a new commanded pitch angle will be calculated to produce the desired FPA given the current vertical wind component. This correction can be used in conjunction with the angle of attack correction. Defaults to false.
rate?numberundefinedThe rate at which to drive the commanded pitch angle, in degrees per second. Defaults to the pitch servo's default rate.
maxNoseDownPitch?number...The maximum nose down pitch angle, defaults to the global AP pitch limit.
maxNoseUpPitch?number...The maximum nose up pitch angle, defaults to the global AP pitch limit.

Returns​

void


getAdjustedPitch()​

getAdjustedPitch(pitch, adjustForAoa, adjustForVerticalWind): number

Defined in: src/sdk/autopilot/AutopilotDriver.ts:311

Adjusts a pitch angle optionally for AOA and vertical wind.

Parameters​

ParameterTypeDefault valueDescription
pitchnumberundefinedThe desired pitch angle, in degrees. Positive values indicate downward pitch.
adjustForAoabooleanfalseWhether to adjust the commanded pitch angle for angle of attack. If true, the provided pitch angle is treated as a desired flight path angle and a new commanded pitch angle will be calculated to produce the desired FPA given the airplane's current angle of attack. This correction can be used in conjunction with the vertical wind correction. Defaults to false.
adjustForVerticalWindbooleanfalseWhether to adjust the commanded pitch angle for vertical wind velocity. If true, the provided pitch angle is treated as a desired flight path angle and a new commanded pitch angle will be calculated to produce the desired FPA given the current vertical wind component. This correction can be used in conjunction with the angle of attack correction. Defaults to false.

Returns​

number

The adjusted pitch.


setBank()​

setBank(bank, resetServo): void

Defined in: src/sdk/autopilot/AutopilotDriver.ts:213

Sets the commanded autopilot bank angle, in degrees.

Parameters​

ParameterTypeDefault valueDescription
banknumberundefinedThe commanded bank angle, in degrees. Positive values indicate left bank.
resetServobooleantrueWhether to reset the bank servo. Defaults to true.

Returns​

void


setPitch()​

setPitch(pitch, resetServo, maxNoseDownPitch, maxNoseUpPitch): void

Defined in: src/sdk/autopilot/AutopilotDriver.ts:285

Sets the commanded autopilot pitch angle, in degrees.

Parameters​

ParameterTypeDefault valueDescription
pitchnumberundefinedThe commanded pitch angle, in degrees. Positive values indicate downward pitch.
resetServobooleantrueWhether to reset the pitch servo. Defaults to true.
maxNoseDownPitchnumber...The maximum nose down pitch angle, defaults to the global AP pitch limit.
maxNoseUpPitchnumber...The maximum nose up pitch angle, defaults to the global AP pitch limit.

Returns​

void


update()​

update(): void

Defined in: src/sdk/autopilot/AutopilotDriver.ts:164

Update loop to keep Ambient Wind Y constantly updated.

Returns​

void