VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtTopAndDirectAttackMissileController Class Reference

Detailed Description

DtTopAndDirectAttackMissileController models the movement of a Javelin missile along a path to its target, supporting two different attack modes:

  • Top-attack mode: Missile climbs to maximum altitude, then descends on target
  • Direct-attack mode: Missile follows a more direct path to the target

Each mode has different flight phases, and the controller manages transitions between phases based on altitude, distance to target, and attack angles.

#include <topAndDirectAttackMissileController.h>

Inheritance diagram for makVre::DtTopAndDirectAttackMissileController:
[legend]

Public Member Functions

 DtTopAndDirectAttackMissileController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtTopAndDirectAttackMissileController () override
 
virtual const char * type () const override
 
virtual void preFirstTickInit () override
 
virtual void setTargetEntity (const DtUUID &entity) override
 
virtual DtSimObjectReference targetEntity () const override
 
virtual void calculateSteering (const DtVector &relativeVelocity, const DtVector &localPosition, const DtVector &targetVelocity, const DtVector &targetPoint, double &maneuverAccelXOut, double &maneuverAccelYOut, double &maneuverAccelZOut) override
 
virtual void processTargetPointTask (DtSimMessage *msg) override
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtMissileMoveToControllerComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static void targetPointCallback (DtSimMessage *msg, void *usr)
 
static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Member Functions

 DtTopAndDirectAttackMissileController ()
 
 DtTopAndDirectAttackMissileController (const DtTopAndDirectAttackMissileController &orig)
 
const DtTopAndDirectAttackMissileControlleroperator= (const DtTopAndDirectAttackMissileController &orig)
 
virtual void registerTaskMsgCallbacks () override
 
virtual bool setupControlPoint () override
 
virtual DtVector calculateClimbOutPoint ()
 
virtual bool reachedClimbOutAltitude ()
 
virtual DtVector calculateAltitudeHoldPoint ()
 
virtual bool reachedTerminalAngleToTarget ()
 
virtual DtVector calculateTerminalPoint ()
 
virtual makVre::DtVreMessageResult handleUpdateMissileTarget (makVre::DtVreMessage *msg)
 
virtual void lookupAndCacheProcessSR () override
 
virtual void processObjectAdded (const DtLocalObject *simObject)
 

Static Protected Member Functions

static void objectAddedCallback (const DtLocalObject *simObject, void *usr)
 

Protected Attributes

DtSimObjectReference myTargetPointer
 
bool myLookupWarningSent
 
DtTopAndDirectMissileFlightPSRmyVreMissileFlightPSR
 
DtTopAndDirectAttackMissileControllerDescriptormyTopAndDirectAttackMissileControllerDescriptor
 
double myClimbOutAngle
 
double myTerminalAngle
 
double myMaxAltitude
 
bool myCallbackAdded
 

Constructor & Destructor Documentation

◆ DtTopAndDirectAttackMissileController() [1/3]

makVre::DtTopAndDirectAttackMissileController::DtTopAndDirectAttackMissileController ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )

Constructor.

Parameters
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional parent registry for reader/writer functionality

Creates a new top and direct attack missile controller component with the specified parameters.

Referenced by DtTopAndDirectAttackMissileController(), and operator=().

◆ ~DtTopAndDirectAttackMissileController()

virtual makVre::DtTopAndDirectAttackMissileController::~DtTopAndDirectAttackMissileController ( )
overridevirtual

Virtual destructor.

Cleans up resources used by the top and direct attack missile controller component.

◆ DtTopAndDirectAttackMissileController() [2/3]

makVre::DtTopAndDirectAttackMissileController::DtTopAndDirectAttackMissileController ( )
protected

Default constructor (protected, not for direct use)

This constructor is protected and not meant to be called directly. It exists because the compiler would otherwise generate an unprotected one.

◆ DtTopAndDirectAttackMissileController() [3/3]

makVre::DtTopAndDirectAttackMissileController::DtTopAndDirectAttackMissileController ( const DtTopAndDirectAttackMissileController & orig)
protected

Copy constructor (protected, performs shallow copy)

Parameters
origThe original object to copy from

Performs a shallow copy operation that does not copy the ports. This constructor is protected and not meant for general use.

References DtTopAndDirectAttackMissileController().

Member Function Documentation

◆ type()

virtual const char * makVre::DtTopAndDirectAttackMissileController::type ( ) const
overridevirtual

Gets the type identifier for this component.

Returns
String identifying the component type (DtTopAndDirectAttackMissileControllerType)

Implements the DtSimComponent::type() method to return the type identifier for this component.

◆ preFirstTickInit()

virtual void makVre::DtTopAndDirectAttackMissileController::preFirstTickInit ( )
overridevirtual

Performs initialization before the first simulation tick.

Gets the missile attack mode (top-attack or direct-attack) from the entity's extended data and sets it in the process state repository. Also caches the appropriate flight parameters based on the selected mode.

◆ setTargetEntity()

virtual void makVre::DtTopAndDirectAttackMissileController::setTargetEntity ( const DtUUID & entity)
overridevirtual

Sets the target entity that the missile should fly to.

Parameters
entityUUID of the target entity

Sets the target entity the missile should fly to. The flight path will depend on the current attack mode (top-attack or direct-attack). The trajectory is not direct but follows the phases defined for the selected mode.

◆ targetEntity()

virtual DtSimObjectReference makVre::DtTopAndDirectAttackMissileController::targetEntity ( ) const
overridevirtual

Gets the currently set target entity.

Returns
Reference to the current target entity

Returns a reference to the entity currently set as the missile's target.

◆ calculateSteering()

virtual void makVre::DtTopAndDirectAttackMissileController::calculateSteering ( const DtVector & relativeVelocity,
const DtVector & localPosition,
const DtVector & targetVelocity,
const DtVector & targetPoint,
double & maneuverAccelXOut,
double & maneuverAccelYOut,
double & maneuverAccelZOut )
overridevirtual

Calculates steering parameters to guide the missile to target.

Parameters
relativeVelocityRelative velocity vector between missile and target
localPositionCurrent position of the missile
targetVelocityVelocity vector of the target
targetPointTarget position vector
maneuverAccelXOutOutput parameter for X-axis maneuver acceleration
maneuverAccelYOutOutput parameter for Y-axis maneuver acceleration
maneuverAccelZOutOutput parameter for Z-axis maneuver acceleration

Overrides the base class implementation to calculate steering parameters for guiding the missile along its multi-phase flight path to the target. Updates the output acceleration parameters to achieve the desired trajectory.

◆ targetPointCallback()

static void makVre::DtTopAndDirectAttackMissileController::targetPointCallback ( DtSimMessage * msg,
void * usr )
static

Static callback function for target point messages.

Parameters
msgThe simulation message containing the target point information
usrUser data pointer (contains the controller instance)

Static function registered as a callback to handle target point messages. Instances of this component register this callback with their own 'this' pointer as user data with the message executive to receive notification of move-to tasks.

◆ processTargetPointTask()

virtual void makVre::DtTopAndDirectAttackMissileController::processTargetPointTask ( DtSimMessage * msg)
overridevirtual

Processes a target point task message.

Parameters
msgThe simulation message containing the target point task

Extracts the target entity information from the DtTargetPointTask message and calls setTargetEntity() with the UUID of the specified target entity.

◆ creator()

static DtSimComponent * makVre::DtTopAndDirectAttackMissileController::creator ( const DtString & name,
DtLocalObject * owner,
DtSimulationServices * simManager,
DtComponentDescriptor * desc = 0,
DtReaderWriterRegistry * parentRegistry = 0 )
static

Factory method to create a new instance of this component.

Parameters
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional parent registry for reader/writer functionality
Returns
Pointer to the newly created component

Static factory method used by the component creation system to instantiate new instances of this component type.

◆ operator=()

const DtTopAndDirectAttackMissileController & makVre::DtTopAndDirectAttackMissileController::operator= ( const DtTopAndDirectAttackMissileController & orig)
protected

Assignment operator (protected, performs shallow copy)

Parameters
origThe original object to assign from
Returns
Reference to this object

Performs a shallow assignment operation similar to the copy constructor. This operator is protected and not meant for general use.

References DtTopAndDirectAttackMissileController().

◆ registerTaskMsgCallbacks()

virtual void makVre::DtTopAndDirectAttackMissileController::registerTaskMsgCallbacks ( )
overrideprotectedvirtual

Registers message callbacks for handling task messages.

Registers the callback targetPointCallback() for handling DtTargetPointTask messages sent to this missile controller.

◆ setupControlPoint()

virtual bool makVre::DtTopAndDirectAttackMissileController::setupControlPoint ( )
overrideprotectedvirtual

Sets up the current control point for missile guidance.

Returns
True if a valid control point was established, false otherwise

Determines the appropriate working target point based on the current flight phase (climb-out, altitude-hold, or terminal) and then calls setTargetPoint() to update the missile's guidance system.

◆ calculateClimbOutPoint()

virtual DtVector makVre::DtTopAndDirectAttackMissileController::calculateClimbOutPoint ( )
protectedvirtual

Calculates the endpoint for the climb-out flight phase.

Returns
Vector position for the end of the climb-out phase

Determines the position that marks the end of the climb-out phase based on the current missile position, target position, and configured climb-out angle.

◆ reachedClimbOutAltitude()

virtual bool makVre::DtTopAndDirectAttackMissileController::reachedClimbOutAltitude ( )
protectedvirtual

Checks if the missile has reached its climb-out altitude.

Returns
True if the missile has reached or exceeded the climb-out altitude

Compares the missile's current altitude with the configured climb-out altitude to determine if the missile should transition to the next flight phase.

◆ calculateAltitudeHoldPoint()

virtual DtVector makVre::DtTopAndDirectAttackMissileController::calculateAltitudeHoldPoint ( )
protectedvirtual

Calculates the control point for the altitude-hold flight phase.

Returns
Vector position for the altitude-hold phase

Returns a position directly above the target at the maximum altitude configured for the missile. This point is used for guidance during the altitude-hold phase of top-attack mode.

◆ reachedTerminalAngleToTarget()

virtual bool makVre::DtTopAndDirectAttackMissileController::reachedTerminalAngleToTarget ( )
protectedvirtual

Checks if the missile has reached the terminal angle to target.

Returns
True if the missile has reached or exceeded the terminal angle

Calculates the inclination angle from the target to the missile and determines if it has reached the configured terminal angle, indicating that the missile should transition to the terminal phase of flight.

◆ calculateTerminalPoint()

virtual DtVector makVre::DtTopAndDirectAttackMissileController::calculateTerminalPoint ( )
protectedvirtual

Calculates the endpoint for the terminal flight phase.

Returns
Vector position for the terminal phase targeting

Determines the position of the target entity, accounting for any movement during flight. This is the final aim point for the missile during the terminal phase of flight.

◆ handleUpdateMissileTarget()

virtual makVre::DtVreMessageResult makVre::DtTopAndDirectAttackMissileController::handleUpdateMissileTarget ( makVre::DtVreMessage * msg)
protectedvirtual

Moves the missile's target waypoint based on the VRE message. Waypoint will have its position updated or be attached to a target entity. Processes UpdateMissileTargetMessage events. This message can either set the target to a new location or an entity.

◆ lookupAndCacheProcessSR()

virtual void makVre::DtTopAndDirectAttackMissileController::lookupAndCacheProcessSR ( )
overrideprotectedvirtual

Retrieves and caches the missile flight process state repository.

Looks up the missile flight process state repository and caches it for efficient access during simulation updates. The PSR contains the state information for the missile's flight phases and attack mode.

◆ objectAddedCallback()

static void makVre::DtTopAndDirectAttackMissileController::objectAddedCallback ( const DtLocalObject * simObject,
void * usr )
staticprotected

This callback is necessary to make sure the handleUpdateMissileTarget callback is registered in the main thread. It needs to be registered in that thread because the sim's component worker threads don't tick the DtVreMessageManager.

◆ processObjectAdded()

virtual void makVre::DtTopAndDirectAttackMissileController::processObjectAdded ( const DtLocalObject * simObject)
protectedvirtual

Member Data Documentation

◆ myTargetPointer

DtSimObjectReference makVre::DtTopAndDirectAttackMissileController::myTargetPointer
protected

Reference to the current target entity.

Reference to the current target entity that the missile is tracking. This is updated each frame by the setupControlPoint() method.

◆ myLookupWarningSent

bool makVre::DtTopAndDirectAttackMissileController::myLookupWarningSent
protected

Flag to prevent repeated warning messages.

When true, prevents the component from repeatedly sending 'failed to find target' warnings to the log. Ensures that warning messages are only sent once per missile instance.

◆ myVreMissileFlightPSR

DtTopAndDirectMissileFlightPSR* makVre::DtTopAndDirectAttackMissileController::myVreMissileFlightPSR
protected

Cached pointer to the missile flight process state repository.

Cached pointer to the derived type of process state repository used to store missile flight state information. This avoids repeated lookups and type casting during the missile's flight.

◆ myTopAndDirectAttackMissileControllerDescriptor

DtTopAndDirectAttackMissileControllerDescriptor* makVre::DtTopAndDirectAttackMissileController::myTopAndDirectAttackMissileControllerDescriptor
protected

Cached pointer to the component descriptor.

Cached pointer to the derived type of component descriptor that contains configuration parameters specific to this missile controller. This allows efficient access to configuration settings without repeated type casting.

◆ myClimbOutAngle

double makVre::DtTopAndDirectAttackMissileController::myClimbOutAngle
protected

Cached climb-out angle for the current attack mode.

The angle used during the climb-out phase of flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.

◆ myTerminalAngle

double makVre::DtTopAndDirectAttackMissileController::myTerminalAngle
protected

Cached terminal angle for the current attack mode.

The angle used to determine transition to the terminal phase of flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.

◆ myMaxAltitude

double makVre::DtTopAndDirectAttackMissileController::myMaxAltitude
protected

Cached maximum altitude for the current attack mode.

The maximum altitude the missile should reach during flight. This value is set in preFirstTickInit() based on the attack mode and remains constant for the lifetime of the missile.

◆ myCallbackAdded

bool makVre::DtTopAndDirectAttackMissileController::myCallbackAdded
protected

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