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

DtIndirectFireActuator is an actuator that provides a simple model of a cannon. More...

Inheritance diagram for DtIndirectFireActuator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtIndirectFireActuator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtIndirectFireActuator ()
 destructor
virtual void tick ()
 Override to call initPendingDetonations() in the first tick, to schedule any outstanding detonations saved in our process state.
virtual void initPendingDetonations ()
 Called in the first tick.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual DtFireInteraction * createFireInteraction ()
 Overrides the DtWeaponActuator to create a DtFireInteraction based on the values from the input ports.
virtual DtDetonationInteractioncreateDetonationInteraction (DtTime &detTime)
 Instantiates a DtDetonationInteraction and fills out its values based on the values from the input ports.
virtual void scheduleDetonation (DtDetonationInteraction *detInter, DtTime detTime)
 Creates a DtDetonationTimerData object from detInter which is put into a DtTimer which generates a one-time callback to detonationCallback after detTime seconds.
virtual void fireTheWeapon ()
 DtWeaponActuator::fireTheWeapon is overridden to schedule a detonation interaction in addition to creating a fire interaction like the base class does.
virtual void addDispersion (DtVector &detLocation, bool addHeightDispersion)
 Adjusts detLocation based on the range and displacement error probabilities in myIndirectFireActuatorDescriptor.
virtual DtDetonationInteractioncreateDetonationInteraction (const DtDetonationDescriptor &desc, DtTime &detTime)
 Creates a new DtDetonationInteraction, given a DtDetonationDescriptor.
virtual DtDetonationDescriptorcreateDetonationDescriptor (DtDetonationInteraction *detInter, DtTime simTime)
 Creates and fills out a new DtDetonationDescriptor, given a DtDetonationInteraction and a time (simulation time to fire, in seconds).
virtual void processObjectAdded (DtVrfObject *vrfObject)
 Checks pending detonation list (in the process state repository) for target with same name as new object.

Static Public Member Functions

static void detonationCallback (DtTimer *timer)
 Extracts and sends the DtDetonationInteraction stored in the DtTimer.
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
static void objectAddedCb (DtVrfObject *vrfObject, void *usr)
 Calls processObjectAdded().

Protected Member Functions

virtual bool createPorts ()
 Creates the input ports and adds them to the component.
virtual bool createPSR ()
 Creates #myProcessState data member, and adds it to our process state repository manager.
 DtIndirectFireActuator ()
 default constructor; not implemented
 DtIndirectFireActuator (const DtIndirectFireActuator &orig)
 copy constructor; not implemented
const DtIndirectFireActuatoroperator= (const DtIndirectFireActuator &orig)
 assignment operator; not implemented

Protected Attributes

DtReal myMuzzleSpeed
DtList myTimerList
DtIndirectFireActuatorDescriptormyIndirectFireActuatorDescriptor
DtVrfIndirectFirePSRmyIndirectFireProcessState
 We've overrode createPSR() to create derived kind of DtVrfWeaponPSR.
bool myFirstTick
Ports and Port Groups
DtVectorInputPortmyTargetPointPort
 Input Port Name: target-point-port
Input Port Description: Local position to fire at.
DtAnalogInputPortmyMaxRangePort
 Input Port Name: max-range-port
Input Port Description: Maximum range in meters.

Detailed Description

DtIndirectFireActuator is an actuator that provides a simple model of a cannon.

End User Description: It can be given ammo to load, and the command to fire. It creates a fire interaction and creates a detonation interaction, which it schedules to be sent.

The accuracy of indirect fire is measured by a set of probably error distances. Fifty percent of all rounds will fall within this range (25% over, 25% under, 25% left, 25% right). All rounds will fall within four times the probably error distance.

Uses Descriptor Type: DtIndirectFireActuatorDescriptor


Constructor & Destructor Documentation

DtIndirectFireActuator::DtIndirectFireActuator ( 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 void DtIndirectFireActuator::tick ( ) [virtual]

Override to call initPendingDetonations() in the first tick, to schedule any outstanding detonations saved in our process state.

Reimplemented from DtWeaponActuator.

Called in the first tick.

Creates and schedules any pending detonations from detonation descriptor data in the process state repository. For those detonations whose target does not exist yet (e.g. target may be remote and not discovered yet), registers the objectAddedCb to provide an opportunity to create and schedule those pending detonations at a later time.

virtual DtString DtIndirectFireActuator::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:
DtIndirectFireActuatorType

Reimplemented from DtWeaponActuator.

virtual DtFireInteraction* DtIndirectFireActuator::createFireInteraction ( ) [virtual]

Overrides the DtWeaponActuator to create a DtFireInteraction based on the values from the input ports.

The myMuzzleSpeed member variable is calculated as the square root of the product of the maximum range times DtGRAVITY_CONSTANT. The myCurrentRange member variable is calculated as the distance from the weapon to the target in meters. A new event Id is obtained from the exercise connection and assigned to the myCurrentEventId member variable.

Reimplemented from DtWeaponActuator.

Instantiates a DtDetonationInteraction and fills out its values based on the values from the input ports.

It will modify the given DtReal parameter to contain the amount of time in seconds before the detonation should be sent out. The delay is calculated as range / (muzzle speed * launch angle). Calls addDispersion() to introduce random error into the location of the detonation. If the fuze type is not DtFuzeContact, addDispersion() will be called with height dispersion enabled.

virtual void DtIndirectFireActuator::scheduleDetonation ( DtDetonationInteraction detInter,
DtTime  detTime 
) [virtual]

Creates a DtDetonationTimerData object from detInter which is put into a DtTimer which generates a one-time callback to detonationCallback after detTime seconds.

virtual void DtIndirectFireActuator::fireTheWeapon ( ) [virtual]

DtWeaponActuator::fireTheWeapon is overridden to schedule a detonation interaction in addition to creating a fire interaction like the base class does.

Reimplemented from DtWeaponActuator.

virtual void DtIndirectFireActuator::addDispersion ( DtVector detLocation,
bool  addHeightDispersion 
) [virtual]

Adjusts detLocation based on the range and displacement error probabilities in myIndirectFireActuatorDescriptor.

If addHeightDispersion is true, then it will also adjust the height of the detonation based on the burst height probability.

static void DtIndirectFireActuator::detonationCallback ( DtTimer timer) [static]

Extracts and sends the DtDetonationInteraction stored in the DtTimer.

static DtSimComponent* DtIndirectFireActuator::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 from DtWeaponActuator.

virtual DtDetonationInteraction* DtIndirectFireActuator::createDetonationInteraction ( const DtDetonationDescriptor desc,
DtTime &  detTime 
) [virtual]

Creates a new DtDetonationInteraction, given a DtDetonationDescriptor.

Fills out new new interaction with data from the descriptor and returns the detonation time (time in seconds relative to current sim time). The resulting DtDetonationInteraction and DtTime can be directly passed into scheduleDetonation.

Creates and fills out a new DtDetonationDescriptor, given a DtDetonationInteraction and a time (simulation time to fire, in seconds).

static void DtIndirectFireActuator::objectAddedCb ( DtVrfObject vrfObject,
void *  usr 
) [static]
virtual void DtIndirectFireActuator::processObjectAdded ( DtVrfObject vrfObject) [virtual]

Checks pending detonation list (in the process state repository) for target with same name as new object.

If one exists, sets the target global id in the pending object item (a DtDetonationDescriptor), and then schedules the detonation, given the data in the descriptor.

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

Creates the input ports and adds them to the component.

Reimplemented from DtWeaponActuator.

virtual bool DtIndirectFireActuator::createPSR ( ) [protected, virtual]

Creates #myProcessState data member, and adds it to our process state repository manager.

Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.

Reimplemented from DtWeaponActuator.

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

assignment operator; not implemented


Member Data Documentation

Input Port Name: target-point-port
Input Port Description: Local position to fire at.


Input Port Range:
Input Port Default Value:
Input Group Parent:

Input Port Name: max-range-port
Input Port Description: Maximum range in meters.


Input Port Range:
Input Port Default Value:
Input Group Parent:

We've overrode createPSR() to create derived kind of DtVrfWeaponPSR.

This member variable provided for convenient point to derived type.


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)