VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtFixedWingPilotController Class Reference

DtFixedWingPilotController is a controller that models the capabilities of a fixed-wing pilot. More...

Inheritance diagram for DtFixedWingPilotController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtFixedWingPilotController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtFixedWingPilotController ()
 destructor
virtual bool init ()
 Initializes myFixedWingEntityState.
virtual void tick ()
 Only gets actuator values the first time it's called.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void clearTask ()
 Overridden to deactivate the port group when this controller completes a task.
virtual void taxiTo (const DtVector &destination, double speed)
 The following functions assume that the FWE is on the GROUND.
virtual void taxi (double speed, double turnRate)
 Call this to taxi at a given speed and turn rate.
virtual double calculateSteering (double turnAngle) const
 Calculates the pedal port value for the given turn angle.
virtual double approximateThrottle (double speed)
 Calculates the throttle port value for the given speed using: throttle = (slope/maxSlope + ((desiredSpeed/maxSpeed))
virtual double calculateCurrentBrakingDistance () const
 Returns the braking distance using the current speed and breaking ability to determine how long it would take to brake.
virtual void flyTo (const DtVector &destination, double speed)
 The following functions assume that the FWE is in the AIR.
virtual void flyToDirect (const DtVector &destination, double speed)
 Call this to fly to a specified 3D point at the given speed.
virtual void fly (double speed, double turnRate, double climbRate)
 Call this to fly at a given speed, turn rate and climb rate.
virtual void flyFixedPitch (double speed, double turnRate, double desiredPitch)
 Call this to fly at a given speed, turn rate and pitch.
virtual void circle (const DtVector &center, double radius, double speed, double altitude, bool clockwise=true)
 Call this to fly in a circle.
virtual double calcControlForRoll (double rollRate)
 Calculates and returns the stickY value needed to achieve the desired roll rate.
virtual double calcControlForThrottle (double speed, bool &deployFlaps)
 Calculates a throttle value based on the entity’s current speed, desired speed, and current acceleration.
virtual void calcControlForTurnAndClimb (double turnRate, double climbRate, double &stickX, double &pedal)
 The calcControlForTurnAndClimb() method determines the appropriate pitch angle to use to achieve the desired climb rate, then calls calccontrolForTurnAndPitch().
virtual void calcControlForTurnAndPitch (double turnRate, double desiredPitch, double &stickX, double &pedal)
 The calcControlForTurnAndClimb() method determines complementary stickX and pedal values to achieve a desired turn rate and climb rate.
virtual double calculateClimbRate (double altitude, double climbTime) const
 Calculates a climb rate to achieve the specified altitude in the climbTime specified.
virtual double calculateTurnRate (double turnAngle) const
 Determines the turn rate that will be used to change heading.
virtual double calculateRollAngle (double turnRate, double speed) const
 Calculates a roll angle for a turn based on the turn rate desired and the entity’s current speed.
virtual double calculateRollRate (double rollAngle)
 Calculates a desired rate of roll based on the current roll and the desired roll angle.
virtual void calculateNormalizedBodyVelocity ()
 Put current velocity into body coordinates.
virtual void calculateLocalAngularVelocity ()
 The calculateLocalAngularVelocity() function calculates the entity’s current rate of heading change and stores the value in myProcessState's myLocalAngularVelocity member.
virtual void calculateSpeedRatioSquared ()
 Calculate the square of our current speed divided by our max speed.
virtual void initializeControllerForTick ()
 The initializeControllerForTick() function is called to recompute the entity’s normalized body velocity, local angular velocity, and speed ratio squared.
virtual bool createFixedWingControlPortGroup ()
 These are called in init to create the ports used to communicate with the actuator.
virtual bool createThrottlePort ()
virtual bool createStickPort ()
virtual bool createPedalPort ()
virtual bool createBrakePort ()
virtual bool createFlapsDeployedPort ()
 This is not currently used.
virtual
DtConstrainedAnalogOutputPort
throttlePort ()
 These provide access to the ports.
virtual
DtConstrainedDualAxisAnalogOutputPort
stickPort ()
virtual
DtConstrainedAnalogOutputPort
pedalPort ()
virtual
DtConstrainedAnalogOutputPort
brakePort ()
virtual DtBooleanOutputPortflapsDeployedPort ()
virtual void setMaxThrustAcceleration (double maxThrustAcceleration)
 These are used to set values in the process state repository.
virtual void setTakeOffDir (const DtVector &takeOffDir)
 The direction vector for take off.
virtual const DtVectortakeOffDir () const
virtual DtReal maxTurningGs () const
 Parameter value from descriptor.
virtual DtReal maxTurnRateCutoffAngle () const
 Parameter value from descriptor.
virtual DtReal maxTaxiingTurnSpeed () const
 Parameter value from descriptor.
virtual DtReal taxiingNearDistance () const
 Parameter value from descriptor.
virtual DtReal taxiingAtDistance () const
 Parameter value from descriptor.
virtual DtReal taxiingApproachSpeed () const
 Parameter value from descriptor.
virtual DtReal maxPitchAngle () const
 Parameter value from descriptor.
virtual DtReal timeToTargetAltitude () const
 Parameter value from descriptor.

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual bool createPorts ()
 Overridden to create the fixed wing ports.
virtual bool createPortGroups ()
 Overridden to create myFixedWingControlPortGroup.
virtual void lookupAndCacheProcessSR ()
 This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.


virtual bool postAddComponentsInit ()
 Calls lookupAndCacheProcessSR(), to look up our process state repository after all of the components have been created and loaded.
virtual bool decideToGiveUpTask () const
 If the entity is attached and the target of the current task is not, give up on the task.
 DtFixedWingPilotController ()
 default constructor; not implemented
 DtFixedWingPilotController (const DtFixedWingPilotController &orig)
 copy constructor; not implemented
const DtFixedWingPilotControlleroperator= (const DtFixedWingPilotController &orig)
 assignment operator; not implemented

Protected Attributes

DtFixedWingEntityStateRepositorymyFixedWingEntityState
DtFixedWingFlightPSRmyProcessState
 Pointer to a process state repository used to store state data associated with this component.
Ports and Port Groups
DtOutputPortGroupmyFixedWingControlPortGroup
 Output Port Group Name: fixed-wing-control
Output Port Group Description:
DtConstrainedAnalogOutputPortmyThrottlePort
 Output Port Name: throttle
Output Port Description:
Output Port Range: 0.
DtConstrainedDualAxisAnalogOutputPortmyStickPort
 Output Port Name: stick
Output Port Description:
Output Port Range: X: -1.
DtConstrainedAnalogOutputPortmyPedalPort
 Output Port Name: pedal
Output Port Description:
Output Port Range: -1.
DtConstrainedAnalogOutputPortmyBrakePort
 Output Port Name: brake
Output Port Description:
Output Port Range: 0.
DtBooleanOutputPortmyFlapsDeployedPort
 Output Port Name: flaps
Output Port Description:
Output Port Range:
Output Port Default Value: true
Output Group Parent: fixed-wing-control.

Detailed Description

DtFixedWingPilotController is a controller that models the capabilities of a fixed-wing pilot.

Uses Descriptor Type: DtFixedWingPilotControllerDescriptor

Examples

Constructor & Destructor Documentation

DtFixedWingPilotController::DtFixedWingPilotController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

default constructor; not implemented

copy constructor; not implemented


Member Function Documentation

virtual bool DtFixedWingPilotController::init ( ) [virtual]

Initializes myFixedWingEntityState.

Reimplemented from DtControllerComponent.

Reimplemented in DtFixedWingDefaultController, DtFixedWingFlightCommandController, and DtCruiseMissileDefaultController.

virtual void DtFixedWingPilotController::tick ( ) [virtual]
virtual DtString DtFixedWingPilotController::type ( ) const [virtual]
virtual void DtFixedWingPilotController::clearTask ( ) [virtual]

Overridden to deactivate the port group when this controller completes a task.

Reimplemented from DtSingleTaskControllerComponent.

Reimplemented in DtFixedWingMoveAlongController, DtFixedWingMoveToController, and DtFixedWingFlightCommandController.

virtual void DtFixedWingPilotController::taxiTo ( const DtVector destination,
double  speed 
) [virtual]

The following functions assume that the FWE is on the GROUND.

Do NOT call the functions when the FWE is in the AIR.

Call this to taxi to a specified point at a given speed. The taxiTo() member function is called to taxi to a specified point at a specified speed. Assumes that the FWE is on the ground, and that its throttle, brake, and pedal ports all exist. Calculates the port values for braking, turning, and throttle based on the given speed and destination. NOTE: If the entity tries to turn to a heading while it is moving faster than the maximum allowed for turning, it will turn at a maximum of TURNING_SPEED_TOL, in the right direction, until it has slowed enough to turn by a greater amount.

virtual void DtFixedWingPilotController::taxi ( double  speed,
double  turnRate 
) [virtual]

Call this to taxi at a given speed and turn rate.

taxi() determines Assumes that the FWE is on the ground, and that its throttle, brake, and pedal ports all exist. Calculates the port values for braking, turning, and throttle based on the given speed and destination.

virtual double DtFixedWingPilotController::calculateSteering ( double  turnAngle) const [virtual]

Calculates the pedal port value for the given turn angle.

Takes into account the turning radius of the FWE as well as current speed.

virtual double DtFixedWingPilotController::approximateThrottle ( double  speed) [virtual]

Calculates the throttle port value for the given speed using: throttle = (slope/maxSlope + ((desiredSpeed/maxSpeed))

Returns the braking distance using the current speed and breaking ability to determine how long it would take to brake.

virtual void DtFixedWingPilotController::flyTo ( const DtVector destination,
double  speed 
) [virtual]

The following functions assume that the FWE is in the AIR.

Do NOT call the functions when the FWE is on the GROUND.

Call this to fly to a specified point at a given speed. The aircraft will fly to the ordered altitude as soon as possible and fly to the destination. The flyTo() member function is called to fly to a specified point at a specified speed. It creates a DtSmartPoint at the destination point and uses it to find the heading from the entity’s current position to this point. It then determines a turn rate by calling calculateTurnRate(), a climb rate by calling calculateClimbRate() (constrained by the plane's maxAltitude parameter), and then calls fly().

virtual void DtFixedWingPilotController::flyToDirect ( const DtVector destination,
double  speed 
) [virtual]

Call this to fly to a specified 3D point at the given speed.

This causes the aircraft to pitch and yaw itself directly toward the destination and fly at the given speed. The flyToDirect() method calculates the turn rate and pitch which will take to the destination, and calls flyFixedPitch().

virtual void DtFixedWingPilotController::fly ( double  speed,
double  turnRate,
double  climbRate 
) [virtual]

Call this to fly at a given speed, turn rate and climb rate.

fly() determines a roll angle and rate based on the specified turn rate and calls calcControlForRoll() to get a stickY value. if the current roll angle sign is different from the desired roll angle sign, it sets stickX and pedal to 0, otherwise it calls calcControlForTurnAndClimb() to determine those values. Finally, it calls calcControlForThrottle() with the desired speed to set the throttle port value.

virtual void DtFixedWingPilotController::flyFixedPitch ( double  speed,
double  turnRate,
double  desiredPitch 
) [virtual]

Call this to fly at a given speed, turn rate and pitch.

fly() determines a roll angle and rate based on the specified turn rate and calls calcControlForRoll() to get a stickY value. if the current roll angle sign is different from the desired roll angle sign, it sets stickX and pedal to 0, otherwise it calls calcControlForTurnAndPitch() to determine those values. Finally, it calls calcControlForThrottle() with the desired speed to set the throttle port value.

virtual void DtFixedWingPilotController::circle ( const DtVector center,
double  radius,
double  speed,
double  altitude,
bool  clockwise = true 
) [virtual]

Call this to fly in a circle.

The center parameter is no longer ignored. The circle() member function is called to fly in a circle of a specified radius, at a specified speed, either clockwise or counter clockwise, and at a specified altitude. The circle() function:

  1. Constrains the altitude to the entity's maxAltitude parameter
  2. Determines the desired turn rate for this simulation frame by if the fixed wing is inside or outside of the specified orbit, and adjusts the desired heading appropriately. Also adjusts for clockwise/counter-clockwise.
  3. Determines the desired heading, at the point tangent to the orbit.
  4. Uses the desired heading, and the current heading, to determine a turn rate.
  5. Determines a climb rate by calling calculateClimbRate().
  6. Calls fly() with the desired speed, turn rate, and climb rate.
Parameters:
centerThe center around which to circle.
radiusThe radius of the desired flight circle.
speedThe desired flight speed.
altitudeThe desired flight altitude.
clockwiseFly in a circle clockwise(true) or counterclockwise (false).
Note:
If the specified parameters are not "physically" possible for the fixed wing to follow, it will fly come as close as possible.
virtual double DtFixedWingPilotController::calcControlForRoll ( double  rollRate) [virtual]

Calculates and returns the stickY value needed to achieve the desired roll rate.

virtual double DtFixedWingPilotController::calcControlForThrottle ( double  speed,
bool deployFlaps 
) [virtual]

Calculates a throttle value based on the entity’s current speed, desired speed, and current acceleration.

First, the difference between the desired speed and the current speed is found, and the desired acceleration is chosen to be this difference over 1 second. The drag in the direction of motion is determined and added to the desired acceleration. The result is then divided by the maximum thrust acceleration parameter. Also sets the value of deployFlaps to TRUE if the desired speed is significanlty below the current speed.

virtual void DtFixedWingPilotController::calcControlForTurnAndClimb ( double  turnRate,
double  climbRate,
double &  stickX,
double &  pedal 
) [virtual]

The calcControlForTurnAndClimb() method determines the appropriate pitch angle to use to achieve the desired climb rate, then calls calccontrolForTurnAndPitch().

virtual void DtFixedWingPilotController::calcControlForTurnAndPitch ( double  turnRate,
double  desiredPitch,
double &  stickX,
double &  pedal 
) [virtual]

The calcControlForTurnAndClimb() method determines complementary stickX and pedal values to achieve a desired turn rate and climb rate.

It returns 0.0 for both values if the plane has a roll angle outside of +/- 90 degrees.

virtual double DtFixedWingPilotController::calculateClimbRate ( double  altitude,
double  climbTime 
) const [virtual]

Calculates a climb rate to achieve the specified altitude in the climbTime specified.

This climb rate is then constrained to be no greater than the entity's max climb rate parameter. The end result is that all climbs happen at max climb rate until the altitude difference is such that the plane levels off over the last several meters

Parameters:
climbTimeSpecified in seconds.
virtual double DtFixedWingPilotController::calculateTurnRate ( double  turnAngle) const [virtual]

Determines the turn rate that will be used to change heading.

If the magnitude of the heading change needed is greater than or equal to the max-turnrate-cutoff-angle parameter, then the max-pitch-rate parameter is used. Otherwise, the turn rate is calculated as: The magnitude of the calculated turn rate is then constrained to be less than or equal to the turn rate corresponding to the max-turning-gs parameter for the entity’s current speed.

virtual double DtFixedWingPilotController::calculateRollAngle ( double  turnRate,
double  speed 
) const [virtual]

Calculates a roll angle for a turn based on the turn rate desired and the entity’s current speed.

The angle is calculated as

virtual double DtFixedWingPilotController::calculateRollRate ( double  rollAngle) [virtual]

Calculates a desired rate of roll based on the current roll and the desired roll angle.

Put current velocity into body coordinates.

The calculateNormalizedBodyVelocity() function calculates a normal vector that points in the direction of the current velocity vector in body coordinates. This is used in determining both slippage and angle of attack. It is calculated as: DtEuler_to_BodyToLocalRef(current orientation, body to local matrix) DtDcmTranspose(body to local matrix, local to body matrix) DtDcmVecMul(local to body matrix, current velocity, body velocity) DtVecNormalize(body velocity, myNormalizedBodyVelocity) If the magnitude of the velocity vector is 0.0, the normalized body velocity vector is arbitrarily set to point down the nose of the entity (<1.0, 0.0, 0.0>). myNormalizedBodyVelocity is a member variable of myProcessState.

The calculateLocalAngularVelocity() function calculates the entity’s current rate of heading change and stores the value in myProcessState's myLocalAngularVelocity member.

It is computed as: local angular velocity = (SIN(current roll angle) * current pitch rate) + (COS(current roll angle) * current yaw rate).

Calculate the square of our current speed divided by our max speed.

The calculateSpeedRatioSquared() function calculates this value and stores it in the process state member variable myProcessState's mySpeedRatioSquared member variable as: mySpeedRatioSquared = current speed / max speed mySpeedRatioSquared *=

The initializeControllerForTick() function is called to recompute the entity’s normalized body velocity, local angular velocity, and speed ratio squared.

It calls: calculateNormalizedBodyVelocity() calculateLocalAngularVelocity() calculateSpeedRatioSquared().

These are called in init to create the ports used to communicate with the actuator.

This is not currently used.

These provide access to the ports.

virtual void DtFixedWingPilotController::setMaxThrustAcceleration ( double  maxThrustAcceleration) [virtual]

These are used to set values in the process state repository.

virtual void DtFixedWingPilotController::setTakeOffDir ( const DtVector takeOffDir) [virtual]

The direction vector for take off.

virtual const DtVector& DtFixedWingPilotController::takeOffDir ( ) const [virtual]
virtual DtReal DtFixedWingPilotController::maxTurningGs ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::maxTurnRateCutoffAngle ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::maxTaxiingTurnSpeed ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::taxiingNearDistance ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::taxiingAtDistance ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::taxiingApproachSpeed ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::maxPitchAngle ( ) const [virtual]

Parameter value from descriptor.

virtual DtReal DtFixedWingPilotController::timeToTargetAltitude ( ) const [virtual]

Parameter value from descriptor.

static DtSimComponent* DtFixedWingPilotController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented in DtFixedWingMoveToController, DtFixedWingMoveAlongController, DtFixedWingFollowEntityController, DtFixedWingPatrolRouteController, DtFixedWingFlightCommandController, DtFixedWingDefaultController, DtFixedWingFlyIntoController, DtFixedWingPatrolBetweenController, DtFixedWingJoyFlightController, DtFixedWingMoveToLocationController, DtCruiseMissileDefaultController, DtCruiseMissileMoveAlongController, and DtSimpleRadarWarningResponse.

virtual bool DtFixedWingPilotController::createPorts ( ) [protected, virtual]

Overridden to create the fixed wing ports.

Reimplemented from DtSimComponent.

Reimplemented in DtSimpleRadarWarningResponse.

virtual bool DtFixedWingPilotController::createPortGroups ( ) [protected, virtual]

Overridden to create myFixedWingControlPortGroup.

Reimplemented from DtSimComponent.

virtual void DtFixedWingPilotController::lookupAndCacheProcessSR ( ) [protected, virtual]

This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in

myProcessState.

The name (if it exists) is given in the component descriptor (DtComponentDescriptor::processStateRepositoryName). If the name does not exist, it uses the appropriate default name defined in procSRTypes.h. Another component is responsible for creating and destroying the process state repository.

virtual bool DtFixedWingPilotController::postAddComponentsInit ( ) [protected, virtual]

Calls lookupAndCacheProcessSR(), to look up our process state repository after all of the components have been created and loaded.

Initializes max turning Gs and max turn rate cutoff angle in the process state repository with values from pilot controller descriptor.

Reimplemented from DtSimComponent.

Reimplemented in DtFixedWingDefaultController.

virtual bool DtFixedWingPilotController::decideToGiveUpTask ( ) const [protected, virtual]

If the entity is attached and the target of the current task is not, give up on the task.

Reimplemented from DtSingleTaskControllerComponent.

const DtFixedWingPilotController& DtFixedWingPilotController::operator= ( const DtFixedWingPilotController orig) [protected]

assignment operator; not implemented


Member Data Documentation

Output Port Group Name: fixed-wing-control
Output Port Group Description:

Output Port Name: throttle
Output Port Description:
Output Port Range: 0.

to 1.
Output Port Default Value:
Output Group Parent: fixed-wing-control

Output Port Name: stick
Output Port Description:
Output Port Range: X: -1.

to 1. Y: -1. to 1.
Output Port Default Value:
Output Group Parent: fixed-wing-control

Output Port Name: pedal
Output Port Description:
Output Port Range: -1.

to 1.
Output Port Default Value:
Output Group Parent: fixed-wing-control

Output Port Name: brake
Output Port Description:
Output Port Range: 0.

to 1.
Output Port Default Value:
Output Group Parent: fixed-wing-control

Output Port Name: flaps
Output Port Description:
Output Port Range:
Output Port Default Value: true
Output Group Parent: fixed-wing-control.

Pointer to a process state repository used to store state data associated with this component.

This process state repository is shared with other components. Another component is responsible for creating and destroying the process state repository. This state is saved and restored as part of a scenario (or checkpoint).


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)