![]() |
VR-Forces 4.0.4 Class Documentation
|
DtMissileControllerComponent is a controller that contains all of the functionality common to all missile controllers. More...

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 DtBooleanOutputPort * | selfDestructPort () |
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 | |
| DtMissileStateRepository * | myMissileState |
| double | myDistanceToTarget |
| DtVector | myTargetErrorOffset |
| DtMissileFlightPSR * | myProcessState |
| Pointer to a process state repository used to store state data associated with this component. | |
Ports and Port Groups | |
| DtOutputPortGroup * | myMissileControlPortGroup |
| Output Port Group Name: missile-control Output Port Group Description: | |
| DtConstrainedAnalogOutputPort * | myThrustPort |
| Output Port Name: thrust Output Port Description: Output Port Range: Output Port Default Value: Output Group Parent: missile-control. | |
| DtConstrainedAnalogOutputPort * | myManeuverAccelXPort |
| Output Port Name: maneuver-accel-x Output Port Description: Output Port Range: -100000. | |
| DtConstrainedAnalogOutputPort * | myManeuverAccelYPort |
| Output Port Name: maneuver-accel-y Output Port Description: Output Port Range: -100000. | |
| DtConstrainedAnalogOutputPort * | myManeuverAccelZPort |
| Output Port Name: maneuver-accel-z Output Port Description: Output Port Range: -100000. | |
| DtBooleanOutputPort * | mySelfDestructPort |
| Output Port Name: self-destruct Output Port Description: Output Port Range: Output Port Default Value: Output Group Parent: missile-control. | |
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
| DtMissileControllerComponent::DtMissileControllerComponent | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtMissileControllerComponent::~DtMissileControllerComponent | ( | ) | [virtual] |
destructor
| DtMissileControllerComponent::DtMissileControllerComponent | ( | ) | [protected] |
default constructor; not implemented
| DtMissileControllerComponent::DtMissileControllerComponent | ( | const DtMissileControllerComponent & | orig | ) | [protected] |
copy constructor; not implemented
| virtual bool DtMissileControllerComponent::init | ( | ) | [virtual] |
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.
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.
| virtual bool DtMissileControllerComponent::createMissileControlPortGroup | ( | ) | [virtual] |
These are called in init to create the ports used to communicate with the actuator.
| virtual bool DtMissileControllerComponent::createThrustPort | ( | ) | [virtual] |
| virtual bool DtMissileControllerComponent::createManeuverAccelXPort | ( | ) | [virtual] |
| virtual bool DtMissileControllerComponent::createManeuverAccelYPort | ( | ) | [virtual] |
| virtual bool DtMissileControllerComponent::createManeuverAccelZPort | ( | ) | [virtual] |
| virtual bool DtMissileControllerComponent::createSelfDestructPort | ( | ) | [virtual] |
| virtual DtConstrainedAnalogOutputPort* DtMissileControllerComponent::thrustPort | ( | ) | [virtual] |
| virtual DtConstrainedAnalogOutputPort* DtMissileControllerComponent::maneuverAccelXPort | ( | ) | [virtual] |
| virtual DtConstrainedAnalogOutputPort* DtMissileControllerComponent::maneuverAccelYPort | ( | ) | [virtual] |
| virtual DtConstrainedAnalogOutputPort* DtMissileControllerComponent::maneuverAccelZPort | ( | ) | [virtual] |
| virtual DtBooleanOutputPort* DtMissileControllerComponent::selfDestructPort | ( | ) | [virtual] |
| 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
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 DtMissileControllerComponent::postAddComponentsInit | ( | ) | [protected, virtual] |
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
double DtMissileControllerComponent::myDistanceToTarget [protected] |
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.