![]() |
VR-Forces 4.0.4 Class Documentation
|
DtBaseWeaponController is a controller that creates the ports needed to choose ammo for, load, and trigger a weapon (a DtWeaponActuator). More...

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 DtOutputPortGroup * | weaponOutputPortGroup () |
| Returns myWeaponOutputPortGroup. | |
| virtual bool | createWeaponInputPortGroup () |
| Initializes myWeaponInputPortGroup. | |
| virtual DtInputPortGroup * | weaponInputPortGroup () |
| Returns myWeaponInputPortGroup. | |
| virtual bool | createTriggerPort () |
| These are called in init to create the ports used to communicate with the actuator. | |
| virtual DtBooleanOutputPort * | triggerPort () const |
| virtual bool | createLoadAmmunitionPort () |
| virtual DtAmmunitionOutputPort * | loadAmmunitionPort () const |
| virtual bool | createLoadedPort () |
| virtual DtBooleanOutputPort * | loadedPort () const |
| virtual bool | createArtPartTypePort () |
| virtual DtIntegerInputPort * | artPartTypePort () 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 DtBaseMountingController * | mountingController () |
| returns the DtBaseMountingController | |
| virtual void | setCurrentMunitionName (const DtString ¤tMunitionName) |
| sets the current munition name in the DtVrfWeaponPSR | |
| virtual const DtString & | currentMunitionName () const |
| gets the current munition name from the DtVrfWeaponPSR | |
| virtual DtVrfWeaponPSR * | weaponProcessState () |
| Returns the DtVrfWeaponPSR. | |
| virtual const DtVrfWeaponPSR * | weaponProcessState () 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 DtSimComponent * | creator (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 DtBaseWeaponController & | operator= (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. | |
| DtBaseMountingController * | myBaseMountingController |
| DtVrfWeaponPSR * | myWeaponProcessState |
| Pointer to a process state repository used to store state data associated with this component. | |
| bool | myFirstTick |
Ports and Port Groups | |
| DtOutputPortGroup * | myWeaponOutputPortGroup |
| Output Port Group Name: weapon-control Output Port Group Description: | |
| DtAmmunitionOutputPort * | myLoadAmmunitionPort |
| Output Port Name: ammunition Output Port Description: Type of ammunition to use Output Port Range: Output Port Default Value: Output Group Parent: weapon-control. | |
| DtBooleanOutputPort * | myTriggerPort |
| Output Port Name: trigger Output Port Description: True to fire. | |
| DtBooleanOutputPort * | myLoadedPort |
| Output Port Name: loaded Output Port Description: True if loaded. | |
| DtInputPortGroup * | myWeaponInputPortGroup |
| Input Port Group Name: weapon-info Input Port Group Description: | |
| DtIntegerInputPort * | myArtPartTypePort |
| Input Port Name: art-part-type Input Port Description: Type of articulated part. | |
DtBaseWeaponController is a controller that creates the ports needed to choose ammo for, load, and trigger a weapon (a DtWeaponActuator).
Uses Descriptor Type: DtBaseWeaponControllerDescriptor
| DtBaseWeaponController::DtBaseWeaponController | ( | 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 DtBaseWeaponController::~DtBaseWeaponController | ( | ) | [virtual] |
destructor
| DtBaseWeaponController::DtBaseWeaponController | ( | ) | [protected] |
default constructor; not implemented
| DtBaseWeaponController::DtBaseWeaponController | ( | const DtBaseWeaponController & | orig | ) | [protected] |
copy constructor; not implemented
| virtual bool DtBaseWeaponController::init | ( | ) | [virtual] |
Overridden to initialize values obtained from the descriptor.
Reimplemented from DtControllerComponent.
Reimplemented in DtWeaponController, and DtLauncherController.
| virtual bool DtBaseWeaponController::postAddComponentsInit | ( | ) | [virtual] |
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.
| virtual bool DtBaseWeaponController::createMountingController | ( | ) | [virtual] |
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.
Reimplemented from DtControllerComponent.
Reimplemented in DtLauncherController, DtWeaponController, DtIndirectFireWeaponController, and DtVerticalLauncherController.
| virtual void DtBaseWeaponController::fire | ( | ) | [virtual] |
fires the weapon
Reimplemented in DtLauncherController, and DtWeaponController.
| virtual bool DtBaseWeaponController::waitingForFire | ( | ) | [virtual] |
Returns true if the trigger has been set but the actuator has not yet fired.
| virtual void DtBaseWeaponController::setWaitingForFire | ( | bool | waiting | ) | [virtual] |
Sets myWaitingForFire.
| virtual bool DtBaseWeaponController::createWeaponOutputPortGroup | ( | ) | [virtual] |
Initializes myWeaponOutputPortGroup.
| virtual DtOutputPortGroup* DtBaseWeaponController::weaponOutputPortGroup | ( | ) | [virtual] |
Returns myWeaponOutputPortGroup.
| virtual bool DtBaseWeaponController::createWeaponInputPortGroup | ( | ) | [virtual] |
Initializes myWeaponInputPortGroup.
| virtual DtInputPortGroup* DtBaseWeaponController::weaponInputPortGroup | ( | ) | [virtual] |
Returns myWeaponInputPortGroup.
| virtual bool DtBaseWeaponController::createTriggerPort | ( | ) | [virtual] |
These are called in init to create the ports used to communicate with the actuator.
| virtual DtBooleanOutputPort* DtBaseWeaponController::triggerPort | ( | ) | const [virtual] |
| virtual bool DtBaseWeaponController::createLoadAmmunitionPort | ( | ) | [virtual] |
| virtual DtAmmunitionOutputPort* DtBaseWeaponController::loadAmmunitionPort | ( | ) | const [virtual] |
| virtual bool DtBaseWeaponController::createLoadedPort | ( | ) | [virtual] |
| virtual DtBooleanOutputPort* DtBaseWeaponController::loadedPort | ( | ) | const [virtual] |
| virtual bool DtBaseWeaponController::createArtPartTypePort | ( | ) | [virtual] |
| virtual DtIntegerInputPort* DtBaseWeaponController::artPartTypePort | ( | ) | const [virtual] |
| 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 bool DtBaseWeaponController::weaponCorrectlyOriented | ( | ) | 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 DtBaseMountingController* DtBaseWeaponController::mountingController | ( | ) | [virtual] |
returns the DtBaseMountingController
| 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
| virtual DtVrfWeaponPSR* DtBaseWeaponController::weaponProcessState | ( | ) | [virtual] |
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*,
| 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). |
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
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
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.
DtBooleanOutputPort* DtBaseWeaponController::myTriggerPort [protected] |
Output Port Name: trigger
Output Port Description: True to fire.
Output Port Range:
Output Port Default Value:
Output Group Parent: weapon-control
DtBooleanOutputPort* DtBaseWeaponController::myLoadedPort [protected] |
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
bool DtBaseWeaponController::myDoWeaponPreload [protected] |
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.
bool DtBaseWeaponController::myWaitingForFire [protected] |
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 DtBaseWeaponController::myFireMaxVehicleSpeed [protected] |
Some vehicles must stop to shoot, others have a maximum speed to launch a munition.
DtReal DtBaseWeaponController::myMaxAngleOffBoresight [protected] |
const DtBaseWeaponControllerDescriptor* DtBaseWeaponController::myBaseWeaponCtlrDesc [protected] |
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).
bool DtBaseWeaponController::myFirstTick [protected] |
Reimplemented in DtLauncherController.