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() override;
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 setCurrentMunitionType(const DtEntityType & currentMunitionName);
147  virtual const DtEntityType & currentMunitionType() 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 bool weaponInTransition();
198 
201  virtual void setWeaponStowed(bool v);
202 
203  static void setStowWeaponCallback(DtSimMessage* msg, void* usrData);
204  virtual void processSetStowWeapon(DtSimMessage* msg);
205 
206 protected:
207 
210 
213 
216  orig);
217 
218 
219 protected:
220 
223 
227 
234 
241 
248 
252 
259 
266 
272 
274 
281 
286 
290 
293 
297 
304 
307 };
const DtBaseWeaponControllerDescriptor * myBaseWeaponCtlrDesc
Get ammo select tables from here.
Definition: baseWeaponController.h:295
#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:258
DtBooleanOutputPort * myStowCommandOutputPort
Output Port Name: stow-command Output Port Description: Indicates if the controller wants to stow the...
Definition: baseWeaponController.h:271
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:265
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:303
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:247
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:32
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:289
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:285
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:233
DtOutputPortGroup * myWeaponOutputPortGroup
Output Port Group Name: weapon-control Output Port Group Description:
Definition: baseWeaponController.h:226
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:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
DtInputPortGroup * myWeaponInputPortGroup
Input Port Group Name: weapon-info Input Port Group Description:
Definition: baseWeaponController.h:251
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtReal myMaxAzimuthAngleOffBoresight
Definition: baseWeaponController.h:291
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:306
DtReal myMaxElevationAngleOffBoresight
Definition: baseWeaponController.h:292
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:280
DtBooleanOutputPort * myTriggerPort
Output Port Name: trigger Output Port Description: True to fire. Output Port Range: Output Port Defa...
Definition: baseWeaponController.h:240
A locally simulated VRF object.
Definition: localObject.h:98
DtBaseMountingController * myBaseMountingController
Definition: baseWeaponController.h:296

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)