C# Class RemoteTech.FlightComputer.FlightComputer

This class describe the RemoteTech Flight Computer (FC). A FC is mostly used to handle the delay ('normal' + manual delay) if any and queue commands.
Inheritance: IDisposable
Show file Open project: RemoteTechnologiesGroup/RemoteTech Class Usage Examples

Public Properties

Property Type Description
LastTarget RemoteTech.FlightComputer.Commands.TargetCommand
OnActiveCommandAbort System.Action
OnNewCommandPop System.Action
Tf double
TfMax double
TfMin double
kdFactor double
kiFactor double
kpFactor double

Public Methods

Method Description
Dispose ( ) : void

Called when the flight computer is disposed. This happens when the ModuleSPU is destroyed.

Enqueue ( ICommand cmd, bool ignoreControl = false, bool ignoreDelay = false, bool ignoreExtra = false ) : void

Enqueue a command in the flight computer command queue.

FlightComputer ( ISignalProcessor s ) : System

Flight Computer constructor.

HasManeuverCommandByNode ( ManeuverNode node ) : bool

Looks for the passed node on the command queue and returns true if the node is already on the list.

HasManeuverCommands ( ) : bool

Returns true if there's a least one ManeuverCommand on the queue.

Load ( ConfigNode configNode ) : void

Restores the flight computer from the persistent save.

OnFixedUpdate ( ) : void

Called by the ModuleSPU.OnFixedUpdate method during the "Physics" engine phase.

OnUpdate ( ) : void

Called by the ModuleSPU.Update method during the Update() "Game Logic" engine phase.

This checks if there are any commands that can be removed from the FC queue if their delay has elapsed.

OnVesselChange ( Vessel vessel ) : void

After switching the vessel hide the current flight computer UI.

OrderCommandList ( ) : void

Orders the command queue to be chronological.

Remove ( ICommand cmd ) : void

Remove a command from the flight computer command queue.

RemoveManeuverCommandByNode ( ManeuverNode node ) : void

Triggers a CancelCommand for the given node

Reset ( ) : void

Abort all active commands.

Save ( ConfigNode n ) : void

Saves all values for the flight computer to the persistent.

setPIDParameters ( ) : void
updatePIDParameters ( ) : void

Private Methods

Method Description
Enqueue ( FlightCtrlState fs ) : void

Enqueue a FlightCtrlState to the flight control queue.

OnFlyByWirePost ( FlightCtrlState fcs ) : void

Control the flight. Called after the Vessel.OnFlyByWire method.

OnFlyByWirePre ( FlightCtrlState fcs ) : void

Control the flight. Called before the Vessel.OnFlyByWire method.

OnSceneSwitchRequested ( GameScenes>.GameEvents data ) : void

Called when a game switch is requested: close the current computer.

OnVesselSwitching ( Vessel fromVessel, Vessel toVessel ) : void

Called when there's a vessel switch, switching from `fromVessel` to `toVessel`.

PopCommand ( ) : void

Check whether there are commands that can be removed from the flight computer command queue (when their delay time has elapsed).

This is done during the Update() phase of the game engine. OnUpdate method.

PopFlightCtrl ( FlightCtrlState fcs, ISatellite sat ) : void

Remove a FlightCtrlState from the flight control queue.

UpdateLastTarget ( ) : void

Updates the last target command used by the flight computer.

Method Details

Dispose() public method

Called when the flight computer is disposed. This happens when the ModuleSPU is destroyed.
public Dispose ( ) : void
return void

Enqueue() public method

Enqueue a command in the flight computer command queue.
public Enqueue ( ICommand cmd, bool ignoreControl = false, bool ignoreDelay = false, bool ignoreExtra = false ) : void
cmd ICommand The command to be enqueued.
ignoreControl bool If true the command is not enqueued.
ignoreDelay bool If true, the command is executed immediately, otherwise the light speed delay is applied.
ignoreExtra bool If true, the command is executed without manual delay (if any). The normal light speed delay still applies.
return void

FlightComputer() public method

Flight Computer constructor.
public FlightComputer ( ISignalProcessor s ) : System
s ISignalProcessor A signal processor (most probably a instance.)
return System

HasManeuverCommandByNode() public method

Looks for the passed node on the command queue and returns true if the node is already on the list.
public HasManeuverCommandByNode ( ManeuverNode node ) : bool
node ManeuverNode Node to search in the queued commands
return bool

HasManeuverCommands() public method

Returns true if there's a least one ManeuverCommand on the queue.
public HasManeuverCommands ( ) : bool
return bool

Load() public method

Restores the flight computer from the persistent save.
public Load ( ConfigNode configNode ) : void
configNode System.ConfigNode Node with the informations for the flight computer
return void

OnFixedUpdate() public method

Called by the ModuleSPU.OnFixedUpdate method during the "Physics" engine phase.
public OnFixedUpdate ( ) : void
return void

OnUpdate() public method

Called by the ModuleSPU.Update method during the Update() "Game Logic" engine phase.
This checks if there are any commands that can be removed from the FC queue if their delay has elapsed.
public OnUpdate ( ) : void
return void

OnVesselChange() public method

After switching the vessel hide the current flight computer UI.
public OnVesselChange ( Vessel vessel ) : void
vessel Vessel The **new** vessel we are changing to.
return void

OrderCommandList() public method

Orders the command queue to be chronological.
public OrderCommandList ( ) : void
return void

Remove() public method

Remove a command from the flight computer command queue.
public Remove ( ICommand cmd ) : void
cmd ICommand The command to be removed from the command queue.
return void

RemoveManeuverCommandByNode() public method

Triggers a CancelCommand for the given node
public RemoveManeuverCommandByNode ( ManeuverNode node ) : void
node ManeuverNode Node to cancel from the queue
return void

Reset() public method

Abort all active commands.
public Reset ( ) : void
return void

Save() public method

Saves all values for the flight computer to the persistent.
public Save ( ConfigNode n ) : void
n System.ConfigNode Node to save in
return void

setPIDParameters() public method

public setPIDParameters ( ) : void
return void

updatePIDParameters() public method

public updatePIDParameters ( ) : void
return void

Property Details

LastTarget public property

The last TargetCommand used by the Flight Computer.
public TargetCommand,RemoteTech.FlightComputer.Commands LastTarget
return RemoteTech.FlightComputer.Commands.TargetCommand

OnActiveCommandAbort public property

Action triggered if the active command is aborted.
public Action,System OnActiveCommandAbort
return System.Action

OnNewCommandPop public property

Action triggered if a new command popped to an active command.
public Action,System OnNewCommandPop
return System.Action

Tf public property

public double Tf
return double

TfMax public property

public double TfMax
return double

TfMin public property

public double TfMin
return double

kdFactor public property

public double kdFactor
return double

kiFactor public property

public double kiFactor
return double

kpFactor public property

public double kpFactor
return double