VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
baseWeaponController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
17 #include "vrfutil/simClock.h"
18 #include "vrfutil/simMunition.h"
19 #include <vlpi/disEnums.h>
21 
24 class DtInputPortGroup;
25 class DtIntegerInputPort;
26 
28 class DtVrfWeaponPSR;
29 
35 {
36 
37 public:
38 
41  DtBaseWeaponController(const DtString& name,
42  DtLocalObject* owner,
43  DtSimulationServices* simManager,
44  DtComponentDescriptor* desc = nullptr,
45  DtReaderWriterRegistry* parentRegistry = nullptr);
46 
48  virtual ~DtBaseWeaponController();
49 
51  virtual bool init() override;
52 
56  virtual bool postAddComponentsInit() override;
57 
59  virtual bool createMountingController();
60 
63  virtual const char* type() const override;
64 
66  virtual void fire();
67 
70  virtual bool waitingForFire();
71 
73  virtual void setWaitingForFire(bool waiting);
74 
76  virtual bool createWeaponOutputPortGroup();
77 
79  virtual DtOutputPortGroup* weaponOutputPortGroup();
80 
82  virtual bool createWeaponInputPortGroup();
83 
85  virtual DtInputPortGroup* weaponInputPortGroup();
86 
89  virtual bool createTriggerPort();
90  virtual DtBooleanOutputPort * triggerPort() const;
91 
92  virtual bool createLoadAmmunitionPort();
93  virtual DtAmmunitionOutputPort * loadAmmunitionPort() const;
94 
95  virtual bool createLoadedPort();
96  virtual DtBooleanOutputPort * loadedPort() const;
97 
98  virtual bool createArtPartTypePort();
99  virtual DtIntegerInputPort * artPartTypePort() const;
100 
108  virtual void setPreloadWeapon(bool doPreload);
109  virtual bool preloadWeapon() const;
110 
111  virtual void setLoadAmmoTime(DtTime loadAmmoTime);
112  virtual DtTime loadAmmoTime() const;
113 
114  virtual void setUnloadAmmoTime(DtTime unloadAmmoTime);
115  virtual DtTime unloadAmmoTime() const;
116 
120  virtual void setMaxVehicleSpeedToFire(DtReal maxVehicleSpeedToFire);
121  virtual DtReal maxVehicleSpeedToFire() const;
122 
123  virtual bool weaponCorrectlyOriented() const;
124 
131  virtual void setMaxAzimuthAngleOffBoresight(DtReal maxAngle);
132  virtual DtReal maxAzimuthAngleOffBoresight() const;
133  virtual void setMaxElevationAngleOffBoresight(DtReal maxAngle);
134  virtual DtReal maxElevationAngleOffBoresight() const;
136 
137 
139  virtual void initProcessSR();
140 
142  virtual DtBaseMountingController * mountingController();
143 
145  virtual void setCurrentMunitionName(const DtString & currentMunitionName);
147  virtual const DtString & currentMunitionName() const;
148 
150  virtual DtVrfWeaponPSR* weaponProcessState();
152  virtual const DtVrfWeaponPSR* weaponProcessState() const;
153 
155  virtual void tick() override;
156 
160  static DtSimComponent * creator(const DtString& name,
161  DtLocalObject* owner,
162  DtSimulationServices* simManager,
163  DtComponentDescriptor* desc = nullptr,
164  DtReaderWriterRegistry* parentRegistry = nullptr);
165 
166 protected:
167 
170  virtual bool createPortGroups() override;
171 
173  virtual bool createPorts() override;
174 
182  virtual void lookupAndCacheProcessSR();
183 
184  virtual void preFirstTickInit() override;
185 
187  virtual DtString weaponId() const;
188 
190  virtual bool weaponStowable();
191 
193  virtual bool weaponStowed();
194 
197  virtual void setWeaponStowed(bool v);
198 
199  static void setStowWeaponCallback(DtSimMessage* msg, void* usrData);
200  virtual void processSetStowWeapon(DtSimMessage* msg);
201 
202 protected:
203 
206 
209 
212  orig);
213 
214 
215 protected:
216 
219 
223 
230 
237 
244 
248 
255 
262 
268 
270 
277 
282 
286 
289 
293 
300 
303 };
const DtBaseWeaponControllerDescriptor * myBaseWeaponCtlrDesc
Get ammo select tables from here.
Definition: baseWeaponController.h:291
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtIntegerInputPort * myArtPartTypePort
Input Port Name: art-part-type Input Port Description: Type of articulated part. Input Port Range: I...
Definition: baseWeaponController.h:254
DtBooleanOutputPort * myStowCommandOutputPort
Output Port Name: stow-command Output Port Description: Indicates if the controller wants to stow the...
Definition: baseWeaponController.h:267
DtBaseWeaponController is a controller that creates the ports needed to choose ammo for...
Definition: baseWeaponController.h:34
virtual bool postAddComponentsInit() override
Calls enableTaskTypes()
DtIntegerInputPort * myStowedStateInputPort
Input Port Name: stowed-state Input Port Description: Receives the current stowed/deployed state of t...
Definition: baseWeaponController.h:261
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
DtVrfWeaponPSR * myWeaponProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: baseWeaponController.h:299
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtBooleanOutputPort * myLoadedPort
Output Port Name: loaded Output Port Description: True if loaded. Output Port Range: Output Port Def...
Definition: baseWeaponController.h:243
Definition: readerWriterRegistry.h:39
DtOutputPortGroup is a data port group of a data provider. It may contain any number of DtOutputPorts...
Definition: outputPortGroup.h:34
Instances of DtAmmunitionOutputPort are output ports through which data producers can send informatio...
Definition: ammunitionIOPort.h:48
File: weaponPSR.h.
Definition: vrfWeaponPSR.h:31
This file contains the class declaration for the.
Contains class declarations for DtIntegerInputPort, DtIntegerOutputPort, and DtIntegerPortData.
Definition: integerIOPort.h:25
virtual bool init() override
Calls setRadio()
DtReal myFireMaxVehicleSpeed
Some vehicles must stop to shoot, others have a maximum speed to launch a munition.
Definition: baseWeaponController.h:285
bool myWaitingForFire
This flag is set to true when the controller pulls the trigger, and set back to false when the contro...
Definition: baseWeaponController.h:281
File: simMsg.h.
Definition: simMessage.h:35
File: vlClock.h.
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtAmmunitionOutputPort * myLoadAmmunitionPort
Output Port Name: ammunition Output Port Description: Type of ammunition to use Output Port Range: O...
Definition: baseWeaponController.h:229
DtOutputPortGroup * myWeaponOutputPortGroup
Output Port Group Name: weapon-control Output Port Group Description:
Definition: baseWeaponController.h:222
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
DtBaseWeaponControllerDescriptor; descriptor for the DtBaseWeaponController component.
Definition: baseWeaponControllerDescriptor.h:30
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
DtInputPortGroup * myWeaponInputPortGroup
Input Port Group Name: weapon-info Input Port Group Description:
Definition: baseWeaponController.h:247
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtReal myMaxAzimuthAngleOffBoresight
Definition: baseWeaponController.h:287
DtInputPortGroup is a data port group of a data consumer. It may contain any number of DtInputPorts a...
Definition: inputPortGroup.h:35
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Member to allow for access to platform specific data.
Definition: baseWeaponController.h:302
DtReal myMaxElevationAngleOffBoresight
Definition: baseWeaponController.h:288
DtBaseMountingController is a controller that generates the azimuth and elevation controls needed to ...
Definition: baseMountingController.h:36
bool myDoWeaponPreload
If myDoWeaponPreload is true, the loader will load the first munition from the ammoselect table if th...
Definition: baseWeaponController.h:276
DtBooleanOutputPort * myTriggerPort
Output Port Name: trigger Output Port Description: True to fire. Output Port Range: Output Port Defa...
Definition: baseWeaponController.h:236
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
DtBaseMountingController * myBaseMountingController
Definition: baseWeaponController.h:292

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)