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

DtMissileControllerComponent is a controller that contains all of the functionality common to all missile controllers. More...

Inheritance diagram for DtMissileControllerComponent:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtMissileControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtMissileControllerComponent ()
 destructor
virtual bool init ()
 Overridden to initialze myMissileState and call calculateTargetErrorOffset.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual double distanceToTarget () const
virtual double approximateThrust (double speed) const
 We use this to approximate the correct thrust for a given speed.
virtual void calculateSteering (const DtVector &relativeVelocity, const DtVector &localPosition, const DtVector &targetVelocity, const DtVector &targetPoint, double &maneuverAccelXOut, double &maneuverAccelYOut, double &maneuverAccelZOut)=0
 Calculates the maneuvering thrust necessary to aim at the target.
virtual void calculateSteeringToPoint (const DtVector &relativeVelocity, const DtVector &localPosition, const DtVector &targetPoint, double &maneuverAccelXOut, double &maneuverAccelYOut, double &maneuverAccelZOut)
 Uses a simple algorithm to aim the missile at a static or slowly-moving target point.
virtual void calculateSteeringUsingPropNav (const DtVector &relativeVelocity, const DtVector &localPosition, const DtVector &targetVelocity, const DtVector &targetPoint, double &maneuverAccelXOut, double &maneuverAccelYOut, double &maneuverAccelZOut)
 Uses proportional navigation to steer at an entity that may be moving at a high velocity.
virtual bool createMissileControlPortGroup ()
 These are called in init to create the ports used to communicate with the actuator.
virtual bool createThrustPort ()
virtual bool createManeuverAccelXPort ()
virtual bool createManeuverAccelYPort ()
virtual bool createManeuverAccelZPort ()
virtual bool createSelfDestructPort ()
virtual
DtConstrainedAnalogOutputPort
thrustPort ()
virtual
DtConstrainedAnalogOutputPort
maneuverAccelXPort ()
virtual
DtConstrainedAnalogOutputPort
maneuverAccelYPort ()
virtual
DtConstrainedAnalogOutputPort
maneuverAccelZPort ()
virtual DtBooleanOutputPortselfDestructPort ()

Protected Member Functions

virtual bool createPortGroups ()
 Overridden to call createMissileControlPortGroup.
virtual bool createPorts ()
 Overridden to create missile ports.
virtual void calculateTargetErrorOffset ()
 Calculate offset (in target body coordinates) to be applied when steering toward the target.
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 void addRangeItems ()
 Adds all items that have a range to the object state repository.
 DtMissileControllerComponent ()
 default constructor; not implemented
 DtMissileControllerComponent (const DtMissileControllerComponent &orig)
 copy constructor; not implemented
const
DtMissileControllerComponent
operator= (const DtMissileControllerComponent &orig)
 assignment operator; not implemented

Protected Attributes

DtMissileStateRepositorymyMissileState
double myDistanceToTarget
DtVector myTargetErrorOffset
DtMissileFlightPSRmyProcessState
 Pointer to a process state repository used to store state data associated with this component.
Ports and Port Groups
DtOutputPortGroupmyMissileControlPortGroup
 Output Port Group Name: missile-control
Output Port Group Description:
DtConstrainedAnalogOutputPortmyThrustPort
 Output Port Name: thrust
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: missile-control.
DtConstrainedAnalogOutputPortmyManeuverAccelXPort
 Output Port Name: maneuver-accel-x
Output Port Description:
Output Port Range: -100000.
DtConstrainedAnalogOutputPortmyManeuverAccelYPort
 Output Port Name: maneuver-accel-y
Output Port Description:
Output Port Range: -100000.
DtConstrainedAnalogOutputPortmyManeuverAccelZPort
 Output Port Name: maneuver-accel-z
Output Port Description:
Output Port Range: -100000.
DtBooleanOutputPortmySelfDestructPort
 Output Port Name: self-destruct
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: missile-control.

Detailed Description

DtMissileControllerComponent is a controller that contains all of the functionality common to all missile controllers.

Developer Description: Creates the ports needed to control missile actuators.

Uses Descriptor Type: DtComponentDescriptor


Constructor & Destructor Documentation

DtMissileControllerComponent::DtMissileControllerComponent ( 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

Overridden to initialze myMissileState and call calculateTargetErrorOffset.

Reimplemented from DtControllerComponent.

Reimplemented in DtLasingMissileTrackController.

virtual DtString DtMissileControllerComponent::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtMissileMovementControllerType

Implements DtTaskControllerComponent.

Reimplemented in DtMissileMoveToControllerComponent, DtMissileTrackEntityController, and DtLasingMissileTrackController.

virtual double DtMissileControllerComponent::distanceToTarget ( ) const [virtual]
virtual double DtMissileControllerComponent::approximateThrust ( double  speed) const [virtual]

We use this to approximate the correct thrust for a given speed.

Takes speed as an argument and returns a thrust value (a value between 0.0 and 1.0, with 1 corresponding to maximum thrust).

virtual void DtMissileControllerComponent::calculateSteering ( const DtVector relativeVelocity,
const DtVector localPosition,
const DtVector targetVelocity,
const DtVector targetPoint,
double &  maneuverAccelXOut,
double &  maneuverAccelYOut,
double &  maneuverAccelZOut 
) [pure virtual]

Calculates the maneuvering thrust necessary to aim at the target.

Usually calls either calculateSteeringToPoint or calculateSteeringWithPropNav. Takes the local velocity and local position of the missile, along with the target point, and generates a vector of maneuver acceleration inputs needed to maneuver the missile toward the target. The output maneuver acceleration vector is perpendicular to the missile’s velocity vector, scaled to put the missile on a course with the target point. The acceleration vector is limited by the max maneuver Gs (a parameter of the missile entity). To calculate the steering: Start with two vectors in database coordinates: myVelocity and the target point. Change the target point vector into a vector from myPosition to the target. Let velocity vector be V, and the position-to-target vector P. P × V gives a perpendicular vector. If the result has no length, the missile is already heading in the right direction, so return zeros for maneuvering. If V is crossed with the above result, the result is a vector in the direction of our maneuver acceleration (V × (P × V)). With the direction set, normalize the new acceleration vector. To set the acceleration size, scale the normalized vector by the sine of the angle between the vectors. The resulting equation is V × (P × V) / (|V|^2 |P|). Scale the vector by the maximum maneuver Gs to get the missile turned as quickly as possible.

Implemented in DtMissileMoveToControllerComponent, and DtMissileTrackEntityController.

virtual void DtMissileControllerComponent::calculateSteeringToPoint ( const DtVector relativeVelocity,
const DtVector localPosition,
const DtVector targetPoint,
double &  maneuverAccelXOut,
double &  maneuverAccelYOut,
double &  maneuverAccelZOut 
) [virtual]

Uses a simple algorithm to aim the missile at a static or slowly-moving target point.

This algorithm will still work even if the target is way off the velocity vector, however it will not work well for fast-moving target points.

virtual void DtMissileControllerComponent::calculateSteeringUsingPropNav ( const DtVector relativeVelocity,
const DtVector localPosition,
const DtVector targetVelocity,
const DtVector targetPoint,
double &  maneuverAccelXOut,
double &  maneuverAccelYOut,
double &  maneuverAccelZOut 
) [virtual]

Uses proportional navigation to steer at an entity that may be moving at a high velocity.

This algorithm does not work well for targets 80 degrees or more away from the relativeVelocity vector. In fact, if the missile misses the target, this algorithm will aim the missile directly AWAY from the target, which is usually the desired behavior anyway.

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

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

Overridden to call createMissileControlPortGroup.

Reimplemented from DtSimComponent.

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

Overridden to create missile ports.

Reimplemented from DtSimComponent.

virtual void DtMissileControllerComponent::calculateTargetErrorOffset ( ) [protected, virtual]

Calculate offset (in target body coordinates) to be applied when steering toward the target.

Calculated as a function of the radius CEP. Instead of always maneuvering toward the precise location of a target, it flies to the target position modified by a constant offset. This introduces the possibility of a miss. The radius CEP is the Circular-Error-Probable radius, the radius around the target within which 50% of missiles fired will hit.

virtual void DtMissileControllerComponent::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.

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

Reimplemented from DtSimComponent.

virtual void DtMissileControllerComponent::addRangeItems ( ) [protected, virtual]

Adds all items that have a range to the object state repository.

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

assignment operator; not implemented


Member Data Documentation

Output Port Group Name: missile-control
Output Port Group Description:

Output Port Name: thrust
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: missile-control.

Output Port Name: maneuver-accel-x
Output Port Description:
Output Port Range: -100000.

to 100000.
Output Port Default Value:
Output Group Parent: missile-control

Output Port Name: maneuver-accel-y
Output Port Description:
Output Port Range: -100000.

to 100000.
Output Port Default Value:
Output Group Parent: missile-control

Output Port Name: maneuver-accel-z
Output Port Description:
Output Port Range: -100000.

to 100000.
Output Port Default Value:
Output Group Parent: missile-control

Output Port Name: self-destruct
Output Port Description:
Output Port Range:
Output Port Default Value:
Output Group Parent: missile-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).

Reimplemented in DtLasingMissileTrackController.


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)