VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
indirectFireWeaponController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1999-2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
12 #pragma once
13 
14 class DtVectorOutputPort;
15 class DtAnalogOutputPort;
17 class DtVectorInputPort;
21 class DtMunitionResource;
23 
26 #include "vrfutil/simMunition.h"
27 
36 {
37 
38 public:
39 
43  DtLocalObject* owner,
44  DtSimulationServices* simManager,
45  DtComponentDescriptor* desc = 0,
46  DtReaderWriterRegistry* parentRegistry = 0);
47 
50 
53  virtual const char* type() const;
54 
55  virtual bool init();
56 
58  virtual bool createMountingController();
59 
63  virtual void preFirstTickInit();
64 
65  virtual void tick();
66 
68  virtual bool createTargetPointPort();
70  virtual DtVectorOutputPort * targetPointPort() const;
71 
73  virtual bool createMuzzleSpeedPort();
75  virtual DtAnalogOutputPort * muzzleSpeedPort() const;
76 
78  virtual bool createAngleOfFirePort();
80  virtual DtAnalogOutputPort * angleOfFirePort() const;
81 
83  virtual bool createAlignedDirectlyPort();
85  virtual DtBooleanOutputPort * alignedDirectlyPort() const;
86 
88  virtual bool createMuzzleOffsetPort();
90  virtual DtVectorInputPort * muzzleOffsetPort() const;
91 
95  static DtSimComponent * creator(const DtString& name,
96  DtLocalObject* owner,
97  DtSimulationServices* simManager,
98  DtComponentDescriptor* desc = 0,
99  DtReaderWriterRegistry* parentRegistry = 0);
100 
101  virtual DtVrfIndirectFirePSR* indirectFireProcessState();
102  virtual const DtVrfIndirectFirePSR* indirectFireProcessState() const;
103 
107  virtual void registerAttributeFunctions();
108 
115  static DtReaderWriter* provideWeaponName(void* controller);
117 
120  virtual bool haveAmmo(const DtString & ammoName) const;
121 
124  virtual const DtString & findDefaultAmmo() const;
125 
128  virtual void getMunitionFromResourceName(const DtString & resourceName,
129  DtSimMunition& munition) const;
130 
133  virtual DtMunitionResource * lookupMunitionResource(const DtString &
134  resource) const;
136  virtual void setMyFuzeToUse(DtDetonatorFuze fuzeToUse);
138  virtual DtDetonatorFuze fuzeToUse() const;
139 
141  virtual void setCurrentMuzzleSpeed(DtReal speed);
142 
144  virtual DtReal currentMuzzleSpeed() const;
145 
146  virtual void addRangeItems();
147 
152  virtual bool initializeController(const DtString& ammoType,
153  DtReal heightAboveTerrain, const DtUUID & targetName, bool& waitingForTerrain, DtDetonatorFuze fuseType,
154  bool generateKnownTargetPoint = false, const DtString& knownTargetPointName = "");
155 
156 protected:
157 
159  virtual bool createPorts();
160 
170  virtual void lookupAndCacheProcessSR();
171 
180  virtual bool calculateTrajectory(const DtVector& shooterLoc, const DtVector& detonationLoc,
181  const double maxRange);
182 
186  virtual void calculateTrajectoryWithHeight(double horizontalDist, double verticalDist,
187  double maxHeight, double& muzzleSpeed, double& launchAngle, double& flightTime);
188 
192  virtual bool calculateElevationAngle(double lateralDist, double verticalDist, double muzzleSpeed,
193  double& angle, double& flightTime, double& maxHeight) const;
194 
199  virtual bool checkMuzzleSpeedAndAngle(double lateralDist, double verticalDist,
200  double speed, double angle, double& flightTime, double& maxHeight) const;
201 
204  virtual void getMunitionResources(std::list<DtString>& resourceList);
205 
207  virtual void updateResourceList();
208 
212  static void setResourceCallback(DtSimMessage * msg, void * usrData);
213  virtual void processSetResource(DtSimMessage * msg);
215 
219  static void setRestoreCallback(DtSimMessage * msg, void * usrData);
220  virtual void processSetRestore(DtSimMessage * msg);
222 
225  static void setPreferredAltitudeCallback(DtSimMessage * msg, void * usrData);
226  virtual void processSetPreferredAltitude(DtSimMessage * msg);
228 
231  virtual DtVector computeLeadPosition(const DtVector& position,
232  const DtVector& velocity);
233 
236  virtual const DtVector& muzzleLocalPosition();
237 
240  virtual DtReaderWriter* processProvideWeaponName();
241 
244  virtual double preferredAltitude() const;
245 
248 
251 
255 
256  virtual void enable();
257 
258  virtual void disable();
259 
260 protected:
264 
266  DtDetonatorFuze myFuzeToUse;
267 
270 
273 
276 
280 
284 
286 
289 
296 
303 
310 
319 
326 
328 
334 
336 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtMountingController; models rotation of a launcher.
Definition: mountingController.h:23
virtual void tick()
Sets the current dT on the base mounting controller and ticks it.
DtBaseWeaponController is a controller that creates the ports needed to choose ammo for...
Definition: baseWeaponController.h:33
bool myIsDirectFire
If weapon is capable of directly firing on a target like a naval gun then check if the target is with...
Definition: indirectFireWeaponController.h:333
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
DtIndirectWeaponComponentInterface * myWeaponComponentInterface
Interface between this weapon controller and the entity&#39;s DtIndirectFireController.
Definition: indirectFireWeaponController.h:263
DtIndirectFireControllerDescriptor; descriptor for the DtIndirectFireController compenent.
Definition: indirectFireControllerDescriptor.h:30
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
Definition: readerWriter.h:85
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
This file contains the class declaration for the.
virtual void disable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
virtual bool createPorts()
Overridden to create input &amp; output ports.
const DtBaseWeaponController & operator=(const DtBaseWeaponController &orig)
assignment operator; not implemented
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
DtVectorInputPort * myMuzzleOffsetPort
Input Port Name: muzzle-offset-port Input Port Description: The entity&#39;s muzzle offset location...
Definition: indirectFireWeaponController.h:325
DtReal myCurrentElevationAngle
The elevation angle selected for the next shot.
Definition: indirectFireWeaponController.h:275
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
DtReal myCurrentMunitionFlightTime
The expected flight time for the next shot.
Definition: indirectFireWeaponController.h:272
Instances of DtAnalogOutputPort are input ports through which data producers can send real numbers...
Definition: analogIOPort.h:45
virtual void lookupAndCacheProcessSR()
This function looks up a process state repository in the process state repository manager by name...
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
virtual void enable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
DT_DLL_vrfutil double angle(double vec1[3], double vec2[3])
File: simMsg.h.
Definition: simMessage.h:35
DtIndirectFireWeaponController is a controller that models firing an indirect fire weapon (e...
Definition: indirectFireWeaponController.h:35
virtual bool createMountingController()
Creates myBaseMountingController.
virtual bool init()
Overridden to initialize values obtained from the descriptor.
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtBooleanOutputPort * myAlignedDirectlyPort
Output Port Name: aligned-directly-port Output Port Description: If the target is close enough for th...
Definition: indirectFireWeaponController.h:318
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
DtDetonatorFuze myFuzeToUse
Set based on height above terrain value.
Definition: indirectFireWeaponController.h:266
Represents the interface between the DtIndirectFireController and an indirect fire weapon system...
Definition: indirectWeaponComponentInterface.h:24
DtIndirectFireControllerDescriptor * myIndFireDescriptor
Definition: indirectFireWeaponController.h:285
bool myWeaponIsAimed
Whether the weapon is fully aimed at the target, or if adjustments still need to be made...
Definition: indirectFireWeaponController.h:279
virtual void registerAttributeFunctions()
Called to register functions that provide system attribute values. Called by init(). Empty in this class. Overridden in different components to add attribute provider functions.
Definition: simComponent.h:112
DtAnalogOutputPort * myAngleOfFirePort
Output Port Name: angle-of-fire-port Output Port Description: The elevation angle of fire...
Definition: indirectFireWeaponController.h:309
DtVectorOutputPort * myTargetPointPort
Output Port Name: target-point-port Output Port Description: Local position to fire at...
Definition: indirectFireWeaponController.h:295
File: indirectFirePSR.h.
Definition: vrfIndirectFirePSR.h:30
DtSimMunition myMunitionToUse
This could just be a stack variable in tick, but since these are expensive to construct, we create on and reuse it.
Definition: indirectFireWeaponController.h:283
DtAnalogOutputPort * myMuzzleSpeedPort
Output Port Name: muzzle-speed-port Output Port Description: Muzzle speed in m/s. Output Port Range: ...
Definition: indirectFireWeaponController.h:302
DtSimMunition class.
Definition: simMunition.h:31
DtMountingController * myMountingController
Output Port Name: target-point-port Output Port Description: Local position to fire at...
Definition: indirectFireWeaponController.h:327
DtReal myCurrentMuzzleSpeed
The muzzle speed selected for the next shot.
Definition: indirectFireWeaponController.h:269
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
Contains the DtMunitionResource class declaration.
Definition: munitionResource.h:24

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)