VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
indirectFireActuator.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
16 #include <map>
17 #include <tbb/spin_mutex.h>
18 
24 
25 class DtAnalogInputPort;
26 class DtVectorInputPort;
27 class DtBooleanInputPort;
28 class DtVectorOutputPort;
29 class DtVrfObjectMessage;
30 
44 
45 namespace makVrfEvents
46 {
47  class DtDetonationEvent;
48  class DtEvent;
49 }
51 {
52 
53 public:
54 
57  DtIndirectFireActuator(const DtString& name,
58  DtLocalObject* owner,
59  DtSimulationServices* simManager,
60  DtComponentDescriptor* desc = 0,
61  DtReaderWriterRegistry* parentRegistry = 0);
62 
64  virtual ~DtIndirectFireActuator();
65 
67  virtual bool postAddComponentsInit();
68 
71  virtual void preFirstTickInit();
72 
79  virtual void initPendingDetonations();
80 
83  virtual const char* type() const;
84 
92  virtual makVrfEvents::DtFireEvent * createFireInteraction(const DtVector& localTargetPoint,
93  const DtVector geocentricMuzzlePosition, const DtVector geocentricMuzzleVelocity);
94 
102  virtual makVrfEvents::DtDetonationEvent * createDetonationInteraction(DtTime&
103  detTime);
104 
108  virtual void scheduleDetonation(makVrfEvents::DtDetonationEvent * detInter,
109  DtTime detTime);
110 
114  virtual void fireTheWeapon();
115 
116 
120  virtual DtCreateObjectHandle createMissileObject(const DtString& eventId, double& timeOfFlight,
121  const DtVector& localTargetPoint, const DtVector& localMuzzlePosition, DtDcm& localMuzzlePositionToTopoDcm,
122  const DtVector& geocentricMuzzlePosition, const DtVector& geocentricMuzzleVelocity, const double angleOfFire);
123 
129  virtual double determineMuzzleSpeed(double range);
130 
135  virtual void addDispersion(DtVector& detLocation,
136  bool addHeightDispersion);
137 
140  virtual double calculateRangeFactorOnError(const double rangeToTarget, const DtVector errorCoefficients);
141 
143  virtual double skillLevelModifier();
144 
146  static void detonationCallback(DtTimer * timer);
147 
151  static DtSimComponent * creator(const DtString& name,
152  DtLocalObject* owner,
153  DtSimulationServices* simManager,
154  DtComponentDescriptor* desc = 0,
155  DtReaderWriterRegistry* parentRegistry = 0);
156 
162  virtual makVrfEvents::DtDetonationEvent * createDetonationInteraction(
163  const DtDetonationDescriptor& desc, DtTime& detTime);
164 
167  virtual DtDetonationDescriptor* createDetonationDescriptor(
168  makVrfEvents::DtDetonationEvent* detInter, DtTime simTime);
169 
174  virtual void processSimObjectAdded(DtSimObjectReference vrfObject);
175 
177  virtual bool taskVisualizationsActive() const;
178 
179 protected:
180  virtual void tick();
181 
182  static void requestLaunchedMunitionsCallback(const DtVrfObjectMessage* msg, void* usr);
183  virtual void processRequestLaunchedMunitions(const DtVrfObjectMessage* msg);
184 
185  virtual void sendCurrentLaunchedMunition(const DtRwLaunchedMunition*, const DtUUID&);
186  virtual void sendAllMunitions(const DtUUID&);
187 
188  virtual void sendNextLaunchTime(const DtUUID&);
189 
190  virtual DtMunitionInFlight munitionInFlight(const DtRwLaunchedMunition*) const;
191 
194  virtual void detonationCallback(const makVrfEvents::DtEvent&);
195  virtual void processDetonation(const makVrfEvents::DtDetonationEvent& detonation);
197 
199  virtual bool createPorts();
200 
206  virtual bool createPSR();
207 
209  virtual void updateTaskVisualizations();
210 
212  virtual void generateKnownTargetPoint(const DtVector& worldLocation, DtString knownPointName);
213  virtual DtString generateKnownTargetPointName();
214 
215  virtual void munitionDeleted(const DtSimObject*);
216 
219  virtual bool determineMunitionPositionsParameters(DtVector& localTargetPoint, DtVector& localMuzzlePosition, DtDcm& localMuzzlePositionToTopoDcm,
220  DtVector& geocentricMuzzlePosition, DtVector& geocentricMuzzleVelocity, double& angleOfFire);
221 
225  virtual void registerAttributeFunctions();
226 
230  static bool unloadAmmunition(void* actuator, DtReaderWriter* dummy);
231 
232  virtual bool processUnloadAmmunition();
234 
242  virtual void retrieveMunitionAccuracyParameters(bool & useErrorVariesByRange,
243  DtVector & errorCoefficients,
244  double & errorInRange,
245  double & errorInDisplacement,
246  double & errorInBurstHeight);
248 
249 protected:
250 
253 
256 
259  const DtIndirectFireActuator & orig);
260 
261 
262 protected:
263 
266 
273 
280 
287 
295 
302 
304 
306  DtList myTimerList;
308 
312 
313  boost::signals2::scoped_connection mySimObjectAddedConnection;
317 
318  std::map<DtUUID, boost::signals2::connection*> myMunitionRemovalConnections;
319  tbb::spin_mutex myRemovalMutex;
320 };
UUID is a unique ID wrapper class.
Definition: uuid.h:59
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual bool createPSR()
Creates #myProcessState data member, and adds it to our process state repository manager. Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.
DtVrfIndirectFirePSR * myIndirectFireProcessState
We&#39;ve overrode createPSR() to create derived kind of DtVrfWeaponPSR. This member variable provided fo...
Definition: indirectFireActuator.h:311
DtVectorOutputPort * myMuzzleOffsetPort
Output Port Name: muzzle-offset-port Output Port Description: The entity&#39;s muzzle offset location...
Definition: indirectFireActuator.h:301
Instances of DtTimer are used to maintain the information needed to represent some kind of scheduled ...
Definition: timer.h:38
Handle returned from Create Object Service calls.
Definition: createObjectHandle.h:12
virtual bool taskVisualizationsActive() const
Returns true if task visualizations are currently active for this component. Default behavior is to r...
DtBooleanInputPort * myAlignedDirectlyPort
Input Port Name: aligned-directly-port Input Port Description: Whether this gun can align directly wi...
Definition: indirectFireActuator.h:294
bool myNeedsLoadSend
Definition: indirectFireActuator.h:316
DtAnalogInputPort * myAngleOfFirePort
Input Port Name: angle-of-fire-port Input Port Description: Elevation angle of fire in radians...
Definition: indirectFireActuator.h:286
Definition: fireEvent.h:16
double myLastLoadTimeReported
Definition: indirectFireActuator.h:315
const DtWeaponActuator & operator=(const DtWeaponActuator &orig)
assignment operator; not implemented
double myLastTimeReported
Definition: indirectFireActuator.h:314
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Definition: readerWriter.h:85
DtReal myMuzzleSpeed
Definition: indirectFireActuator.h:305
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
boost::signals2::scoped_connection mySimObjectAddedConnection
Definition: indirectFireActuator.h:313
Definition: readerWriterRegistry.h:39
virtual void tick()
Fire if requested.
Definition: detonationEvent.h:20
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:437
std::map< DtUUID, boost::signals2::connection * > myMunitionRemovalConnections
Definition: indirectFireActuator.h:318
Definition: event.h:13
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
class DtDetonationDescriptor:
Definition: detonationDescriptor.h:33
DtWeaponActuator is a simple model of a ballistic gun.
Definition: weaponActuator.h:54
virtual bool postAddComponentsInit()
Overridden to initialize the value on myArtPartTypePort.
virtual void fireTheWeapon()
Calls createFireInteraction() and sends the resulting makVrfEvents::DtFireEvent through the exercise ...
Definition: indirectFireActuator.h:50
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
virtual bool createPorts()
Creates the input ports and adds them to the component.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
Definition: rwLaunchedMunition.h:16
DtIndirectFireActuatorDescriptor * myIndirectFireActuatorDescriptor
Definition: indirectFireActuator.h:307
DtList myTimerList
Definition: indirectFireActuator.h:306
virtual makVrfEvents::DtFireEvent * createFireInteraction()
Creates and fills out a makVrfEvents::DtFireEvent. Returns a makVrfEvents::DtFireEvent.
DtVectorInputPort * myTargetPointPort
Input Port Name: target-point-port Input Port Description: Local position to fire at...
Definition: indirectFireActuator.h:272
tbb::spin_mutex myRemovalMutex
Definition: indirectFireActuator.h:319
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtAnalogInputPort * myMuzzleSpeedPort
Input Port Name: muzzle-speed-port Input Port Description: Muzzle speed in meters/second. Input Port Range: Input Port Default Value: Input Group Parent:
Definition: indirectFireActuator.h:279
Contains class declarations for DtAnalogInputPort, DtAnalogOutputPort, and DtAnalogPortData.
Definition: analogIOPort.h:25
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:133
File: indirectFirePSR.h.
Definition: vrfIndirectFirePSR.h:30
DtIndirectFireActuatorDescriptor; descriptor for the DtIndirectFireActuator component.
Definition: indirectFireActuatorDescriptor.h:20
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
This structure contains the information related to an individual munition currently in launch...
Definition: launchedMunitionsResponseAdmin.h:15

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)