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

DtWeaponActuator is a simple model of a ballistic gun. More...

Inheritance diagram for DtWeaponActuator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtWeaponActuator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtWeaponActuator ()
 destructor
virtual bool init ()
 to get access to the entity's localStateRepository, which this component will update, and then connect to the controller's ports.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void tick ()
 Fire if requested.
virtual bool postAddComponentsInit ()
 Overridden to initialize the value on myArtPartTypePort.
virtual void fireTheWeapon ()
 Calls createFireInteraction() and sends the resulting DtFireInteraction through the exercise connection.
virtual DtFireInteraction * createFireInteraction ()
 Creates and fills out a DtFireInteraction. Returns a DtFireInteraction.
virtual void setProjectileStartSpeed (DtReal startSpeed)
virtual DtReal projectileStartSpeed ()
virtual void setMuzzleOffset (const DtVector &muzzleOffset)
virtual const DtVectormuzzleOffset ()
virtual const DtVectormuzzleLocalPosition ()
 Returns the weapon muzzle’s position in local coordinates.
virtual const DtDcm & weaponOrientation ()
 Returns the rotation matrix needed to rotate a vector from body coordinates of the weapon to local coordinates.
virtual
DtArticulatedPartStateRepository
getWeaponSimBody ()
 Looks up the DtSimBody* for the weapon in the entity’s state repository.

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 createPortGroups ()
 Creates the local port groups.
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.
 DtWeaponActuator ()
 default constructor; not implemented
 DtWeaponActuator (const DtWeaponActuator &orig)
 copy constructor; not implemented
const DtWeaponActuatoroperator= (const DtWeaponActuator &orig)
 assignment operator; not implemented

Protected Attributes

DtWeaponActuatorDescriptormyWeaponActuatorDescriptor
DtEntityIdentifier myObjectId
DtReal myProjectileStartSpeed
DtVector myMuzzleOffset
DtVrfObjectmyCurrentEntityTarget
 These are set by createFireInteraction and used by createDetonationInteraction.
DtEventId myCurrentEventId
DtReal myCurrentRange
DtVrfWeaponPSRmyWeaponProcessState
Ports and Port Groups
DtInputPortGroupmyWeaponInputPortGroup
 Input Port Group Name: weapon-control
Input Port Group Description:
DtAmmunitionInputPortmyAmmunitionPort
 Input Port Name: ammunition
Input Port Description: Type of ammo to fire.
DtConstrainedIntegerInputPortmyFusePort
 Input Port Name: fuze
Input Port Description: DIS Enumeration for fuze (see DIS Enumeration and Bit Encoded Values document for values).
DtBooleanInputPortmyTriggerPort
 Input Port Name: trigger
Input Port Description: True to fire.
DtBooleanInputPortmyLoadedPort
 Input Port Name: loaded
Input Port Description: True if loaded.
DtOutputPortGroupmyWeaponOutputPortGroup
 Output Port Group Name: weapon-info
Output Port Group Description:
DtIntegerOutputPortmyArtPartTypePort
 Output Port Name: art-part-type
Output Port Description: Type of the articulated part.

Detailed Description

DtWeaponActuator is a simple model of a ballistic gun.

End User Description: It can be given ammo to load, and the command to fire. It creates a fire interaction and preps a detonation interaction at the appropriate time. A derived type of this component, the DtLauncherActuator is used to simulate missile launchers in VR-Forces.

The weapon actuator provides a generic model of a ballistic gun. The indirect fire actuator and launcher actuator are children of the weapon actuator. It accepts ammunition type, load status, and trigger inputs. When the actuator is fired, it creates and sends a fire interaction. Because the weapon actuator does not prepare and send a detonation interaction as part of the firing process, the ballistic gun actuator may be a more appropriate choice for some situations (the ballistic gun actuator determines the detonation result of munition using probability tables, and generates the detonation interaction.).

Uses Descriptor Type: DtWeaponActuatorDescriptor


Constructor & Destructor Documentation

DtWeaponActuator::DtWeaponActuator ( 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)

virtual DtWeaponActuator::~DtWeaponActuator ( ) [virtual]

destructor

default constructor; not implemented

copy constructor; not implemented


Member Function Documentation

virtual bool DtWeaponActuator::init ( ) [virtual]

to get access to the entity's localStateRepository, which this component will update, and then connect to the controller's ports.

Calls createPSR() to creat e

Reimplemented from DtActuatorComponent.

Reimplemented in DtLauncherActuator.

virtual DtString DtWeaponActuator::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:
DtWeaponActuatorType

Reimplemented from DtSimComponent.

Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.

virtual void DtWeaponActuator::tick ( ) [virtual]

Fire if requested.

Reimplemented from DtSimComponent.

Reimplemented in DtIndirectFireActuator.

Overridden to initialize the value on myArtPartTypePort.

Reimplemented from DtSimComponent.

virtual void DtWeaponActuator::fireTheWeapon ( ) [virtual]

Calls createFireInteraction() and sends the resulting DtFireInteraction through the exercise connection.

Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.

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

Creates and fills out a DtFireInteraction. Returns a DtFireInteraction.

Reimplemented in DtIndirectFireActuator.

virtual void DtWeaponActuator::setProjectileStartSpeed ( DtReal  startSpeed) [virtual]
virtual DtReal DtWeaponActuator::projectileStartSpeed ( ) [virtual]
virtual void DtWeaponActuator::setMuzzleOffset ( const DtVector muzzleOffset) [virtual]
virtual const DtVector& DtWeaponActuator::muzzleOffset ( ) [virtual]
virtual const DtVector& DtWeaponActuator::muzzleLocalPosition ( ) [virtual]

Returns the weapon muzzle’s position in local coordinates.

It calls getWeaponSimBody() to get the DtSimBody associated with the weapon. If no DtSimBody part is found for the weapon, it returns the local position of the entity. If it is found, it calls DtSimBody::calculateMeInWorld() to get the position of the weapon in local coordinates. It rotates the muzzle offset (stored by the entity in body coordinates in myMuzzleOffset) by the weapon’s current orientation (a rotation matrix returned by weaponOrientation()), to get the offset in local coordinates. It then adds the offset to the weapon’s local position to get the muzzle position in local coordinates, and returns.

virtual const DtDcm& DtWeaponActuator::weaponOrientation ( ) [virtual]

Returns the rotation matrix needed to rotate a vector from body coordinates of the weapon to local coordinates.

It looks up the DtSimBody associated with the weapon by calling getWeaponSimBody(). If it finds the DtSimBody, it returns the rotation matrix given by the DtSimBody::calculateMeToWorld(). If it does not find the DtSimBody, it calls DtEuler_to_BodyToLocalRef() with the entity’s local orientation, and returns the resulting matrix instead.

Looks up the DtSimBody* for the weapon in the entity’s state repository.

It first looks up the articulated part type specified in the component’s articulated part descriptor list. If it finds the articulated part type, it tries to look up the DtSimBody in the entity’s state repository, using the articulated part type as a key. If it finds DtSimBody, it returns a pointer to the DtSimBody, if it does not, it returns NULL.

static DtSimComponent* DtWeaponActuator::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 DtIndirectFireActuator, and DtLauncherActuator.

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

Creates the local port groups.

Reimplemented from DtSimComponent.

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

Creates the input ports and adds them to the component.

Reimplemented from DtSimComponent.

Reimplemented in DtIndirectFireActuator, and DtLauncherActuator.

virtual bool DtWeaponActuator::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 in DtIndirectFireActuator.

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

assignment operator; not implemented


Member Data Documentation

Input Port Group Name: weapon-control
Input Port Group Description:

Input Port Name: ammunition
Input Port Description: Type of ammo to fire.


Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control

Input Port Name: fuze
Input Port Description: DIS Enumeration for fuze (see DIS Enumeration and Bit Encoded Values document for values).


Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control

Input Port Name: trigger
Input Port Description: True to fire.


Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control

Input Port Name: loaded
Input Port Description: True if loaded.


Input Port Range:
Input Port Default Value:
Input Group Parent: weapon-control

Output Port Group Name: weapon-info
Output Port Group Description:

Output Port Name: art-part-type
Output Port Description: Type of the articulated part.

See the DIS Enumeration and Bit Encoded Values document for values.
Output Port Range:
Output Port Default Value:
Output Group Parent: weapon-info

DtEntityIdentifier DtWeaponActuator::myObjectId [protected]

These are set by createFireInteraction and used by createDetonationInteraction.

DtEventId DtWeaponActuator::myCurrentEventId [protected]

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)