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

DtBaseWeaponController is a controller that creates the ports needed to choose ammo for, load, and trigger a weapon (a DtWeaponActuator). More...

Inheritance diagram for DtBaseWeaponController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtBaseWeaponController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtBaseWeaponController ()
 destructor
virtual bool init ()
 Overridden to initialize values obtained from the descriptor.
virtual bool postAddComponentsInit ()
 Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it).
virtual bool createMountingController ()
 Creates myBaseMountingController.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void fire ()
 fires the weapon
virtual bool waitingForFire ()
 Returns true if the trigger has been set but the actuator has not yet fired.
virtual void setWaitingForFire (bool waiting)
 Sets myWaitingForFire.
virtual bool createWeaponOutputPortGroup ()
 Initializes myWeaponOutputPortGroup.
virtual DtOutputPortGroupweaponOutputPortGroup ()
 Returns myWeaponOutputPortGroup.
virtual bool createWeaponInputPortGroup ()
 Initializes myWeaponInputPortGroup.
virtual DtInputPortGroupweaponInputPortGroup ()
 Returns myWeaponInputPortGroup.
virtual bool createTriggerPort ()
 These are called in init to create the ports used to communicate with the actuator.
virtual DtBooleanOutputPorttriggerPort () const
virtual bool createLoadAmmunitionPort ()
virtual DtAmmunitionOutputPortloadAmmunitionPort () const
virtual bool createLoadedPort ()
virtual DtBooleanOutputPortloadedPort () const
virtual bool createArtPartTypePort ()
virtual DtIntegerInputPortartPartTypePort () const
virtual void setPreloadWeapon (bool doPreload)
 If setPreloadWeapon to true, the loader will load the first munition from the ammoselect table if there is no target.
virtual bool preloadWeapon () const
virtual void setLoadAmmoTime (DtTime loadAmmoTime)
virtual DtTime loadAmmoTime () const
virtual void setUnloadAmmoTime (DtTime unloadAmmoTime)
virtual DtTime unloadAmmoTime () const
virtual void setMaxVehicleSpeedToFire (DtReal maxVehicleSpeedToFire)
 Some vehicles must stop to shoot, others have a maximum speed to launch a munition.
virtual DtReal maxVehicleSpeedToFire () const
virtual bool weaponCorrectlyOriented () const
virtual void setMaxAngleOffBoresight (DtReal maxAngleOffBoresight)
 Some munitions, especially missiles, can be fired before the launcher is pointing at the target, since the missile can maneuver to reach the target.
virtual DtReal maxAngleOffBoresight () const
virtual void initProcessSR ()
 Sets the load & unload ammo time from the component descriptor.
virtual DtBaseMountingControllermountingController ()
 returns the DtBaseMountingController
virtual void setCurrentMunitionName (const DtString &currentMunitionName)
 sets the current munition name in the DtVrfWeaponPSR
virtual const DtStringcurrentMunitionName () const
 gets the current munition name from the DtVrfWeaponPSR
virtual DtVrfWeaponPSRweaponProcessState ()
 Returns the DtVrfWeaponPSR.
virtual const DtVrfWeaponPSRweaponProcessState () const
 Returns the DtVrfWeaponPSR.
virtual void tick ()
 On the first tick, myCurrentMunition and myCurrentFuze are restored to the checkpointed value from the muntion loader of the DtVrfWeaponPSR.

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 ()
 Overridden to add port groups from myBaseMountingController, allowing OPD connections to be specified using the name of this component.
virtual bool createPorts ()
 Overridden to create input & output ports.
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

myWeaponProcessState.


 DtBaseWeaponController ()
 default constructor; not implemented
 DtBaseWeaponController (const DtBaseWeaponController &orig)
 copy constructor; not implemented
const DtBaseWeaponControlleroperator= (const DtBaseWeaponController &orig)
 assignment operator; not implemented

Protected Attributes

bool myDoWeaponPreload
 If myDoWeaponPreload is true, the loader will load the first munition from the ammoselect table if there is no target.
bool myWaitingForFire
 This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun).
DtReal myFireMaxVehicleSpeed
 Some vehicles must stop to shoot, others have a maximum speed to launch a munition.
DtReal myMaxAngleOffBoresight
const
DtBaseWeaponControllerDescriptor
myBaseWeaponCtlrDesc
 Get ammo select tables from here.
DtBaseMountingControllermyBaseMountingController
DtVrfWeaponPSRmyWeaponProcessState
 Pointer to a process state repository used to store state data associated with this component.
bool myFirstTick
Ports and Port Groups
DtOutputPortGroupmyWeaponOutputPortGroup
 Output Port Group Name: weapon-control
Output Port Group Description:
DtAmmunitionOutputPortmyLoadAmmunitionPort
 Output Port Name: ammunition
Output Port Description: Type of ammunition to use
Output Port Range:
Output Port Default Value:
Output Group Parent: weapon-control.
DtBooleanOutputPortmyTriggerPort
 Output Port Name: trigger
Output Port Description: True to fire.
DtBooleanOutputPortmyLoadedPort
 Output Port Name: loaded
Output Port Description: True if loaded.
DtInputPortGroupmyWeaponInputPortGroup
 Input Port Group Name: weapon-info
Input Port Group Description:
DtIntegerInputPortmyArtPartTypePort
 Input Port Name: art-part-type
Input Port Description: Type of articulated part.

Detailed Description

DtBaseWeaponController is a controller that creates the ports needed to choose ammo for, load, and trigger a weapon (a DtWeaponActuator).

Uses Descriptor Type: DtBaseWeaponControllerDescriptor


Constructor & Destructor Documentation

DtBaseWeaponController::DtBaseWeaponController ( 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 bool DtBaseWeaponController::init ( ) [virtual]

Overridden to initialize values obtained from the descriptor.

Reimplemented from DtControllerComponent.

Reimplemented in DtWeaponController, and DtLauncherController.

Override to call lookupAndCacheProcessSR() (another component creates it - we just look it up and keep a pointer to it).

Also calls initProcessSR().

Reimplemented from DtSimComponent.

Creates myBaseMountingController.

Reimplemented in DtWeaponController.

virtual DtString DtBaseWeaponController::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:
DtBaseWeaponControllerType

Reimplemented from DtControllerComponent.

Reimplemented in DtLauncherController, DtWeaponController, DtIndirectFireWeaponController, and DtVerticalLauncherController.

virtual void DtBaseWeaponController::fire ( ) [virtual]

fires the weapon

Reimplemented in DtLauncherController, and DtWeaponController.

Returns true if the trigger has been set but the actuator has not yet fired.

virtual void DtBaseWeaponController::setWaitingForFire ( bool  waiting) [virtual]

Sets myWaitingForFire.

Initializes myWeaponOutputPortGroup.

Returns myWeaponOutputPortGroup.

Initializes myWeaponInputPortGroup.

Returns myWeaponInputPortGroup.

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

virtual void DtBaseWeaponController::setPreloadWeapon ( bool  doPreload) [virtual]

If setPreloadWeapon to true, the loader will load the first munition from the ammoselect table if there is no target.

This has the advantage of having the weapon ready to fire, but the disadvantage of possibly having the wrong munition loaded when a target appears. Setting it to false means the weapon isn't loaded until a target appears.

virtual bool DtBaseWeaponController::preloadWeapon ( ) const [virtual]
virtual void DtBaseWeaponController::setLoadAmmoTime ( DtTime  loadAmmoTime) [virtual]
virtual DtTime DtBaseWeaponController::loadAmmoTime ( ) const [virtual]
virtual void DtBaseWeaponController::setUnloadAmmoTime ( DtTime  unloadAmmoTime) [virtual]
virtual DtTime DtBaseWeaponController::unloadAmmoTime ( ) const [virtual]
virtual void DtBaseWeaponController::setMaxVehicleSpeedToFire ( DtReal  maxVehicleSpeedToFire) [virtual]

Some vehicles must stop to shoot, others have a maximum speed to launch a munition.

This is the maximum speed the vehicle can be moving when it fires this weapon.

virtual DtReal DtBaseWeaponController::maxVehicleSpeedToFire ( ) const [virtual]
virtual void DtBaseWeaponController::setMaxAngleOffBoresight ( DtReal  maxAngleOffBoresight) [virtual]

Some munitions, especially missiles, can be fired before the launcher is pointing at the target, since the missile can maneuver to reach the target.

This method allows the user to set the maximum number of radians off of boresight the target can be and still reasonably fire the weapon. This margin is used in both azimuth and elevation.

virtual DtReal DtBaseWeaponController::maxAngleOffBoresight ( ) const [virtual]
virtual void DtBaseWeaponController::initProcessSR ( ) [virtual]

Sets the load & unload ammo time from the component descriptor.

virtual void DtBaseWeaponController::setCurrentMunitionName ( const DtString currentMunitionName) [virtual]

sets the current munition name in the DtVrfWeaponPSR

virtual const DtString& DtBaseWeaponController::currentMunitionName ( ) const [virtual]

gets the current munition name from the DtVrfWeaponPSR

Returns the DtVrfWeaponPSR.

virtual const DtVrfWeaponPSR* DtBaseWeaponController::weaponProcessState ( ) const [virtual]

Returns the DtVrfWeaponPSR.

virtual void DtBaseWeaponController::tick ( ) [virtual]

On the first tick, myCurrentMunition and myCurrentFuze are restored to the checkpointed value from the muntion loader of the DtVrfWeaponPSR.

Reimplemented from DtSimComponent.

Reimplemented in DtWeaponController, and DtLauncherController.

static DtSimComponent* DtBaseWeaponController::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 DtWeaponController, DtLauncherController, DtIndirectFireWeaponController, and DtVerticalLauncherController.

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

Overridden to add port groups from myBaseMountingController, allowing OPD connections to be specified using the name of this component.

Reimplemented from DtSimComponent.

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

Overridden to create input & output ports.

Reimplemented from DtSimComponent.

Reimplemented in DtWeaponController, DtLauncherController, and DtIndirectFireWeaponController.

virtual void DtBaseWeaponController::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

myWeaponProcessState.

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.

Reimplemented in DtIndirectFireWeaponController.

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

assignment operator; not implemented


Member Data Documentation

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

Output Port Name: ammunition
Output Port Description: Type of ammunition to use
Output Port Range:
Output Port Default Value:
Output Group Parent: weapon-control.

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


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

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


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

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

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


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

If myDoWeaponPreload is true, the loader will load the first munition from the ammoselect table if there is no target.

This has the advantage of having the weapon ready to fire, but the disadvantage of possibly having the wrong munition loaded when a target appears.

This flag is set to true when the controller pulls the trigger, and set back to false when the controllers sees that the loaded munition has been unloaded (by the gun).

Some vehicles must stop to shoot, others have a maximum speed to launch a munition.

Get ammo select tables from here.

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 DtLauncherController.


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)