VR-Forces 5.0.1 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 
23 
24 class DtAnalogInputPort;
25 class DtVectorInputPort;
26 class DtBooleanInputPort;
27 class DtVectorOutputPort;
28 class DtVrfObjectMessage;
29 
43 
44 namespace makVrfEvents
45 {
46  class DtDetonationEvent;
47  class DtEvent;
48 }
50 {
51 
52 public:
53 
56  DtIndirectFireActuator(const DtString& name,
57  DtLocalObject* owner,
58  DtSimulationServices* simManager,
59  DtComponentDescriptor* desc = 0,
60  DtReaderWriterRegistry* parentRegistry = 0);
61 
63  virtual ~DtIndirectFireActuator();
64 
66  virtual bool postAddComponentsInit();
67 
70  virtual void preFirstTickInit();
71 
78  virtual void initPendingDetonations();
79 
82  virtual const char* type() const;
83 
91  virtual makVrfEvents::DtFireEvent * createFireInteraction(const DtVector& localTargetPoint,
92  const DtVector geocentricMuzzlePosition, const DtVector geocentricMuzzleVelocity);
93 
101  virtual makVrfEvents::DtDetonationEvent * createDetonationInteraction(DtTime&
102  detTime);
103 
107  virtual void scheduleDetonation(makVrfEvents::DtDetonationEvent * detInter,
108  DtTime detTime);
109 
113  virtual void fireTheWeapon();
114 
115 
119  virtual DtCreateObjectHandle createMissileObject(const DtString& eventId, double& timeOfFlight,
120  const DtVector& localTargetPoint, const DtVector& localMuzzlePosition, DtDcm& localMuzzlePositionToTopoDcm,
121  const DtVector& geocentricMuzzlePosition, const DtVector& geocentricMuzzleVelocity, const double angleOfFire);
122 
128  virtual double determineMuzzleSpeed(double range);
129 
134  virtual void addDispersion(DtVector& detLocation,
135  bool addHeightDispersion);
136 
139  virtual double calculateRangeFactorOnError(const double rangeToTarget);
140 
142  virtual double skillLevelModifier();
143 
145  static void detonationCallback(DtTimer * timer);
146 
150  static DtSimComponent * creator(const DtString& name,
151  DtLocalObject* owner,
152  DtSimulationServices* simManager,
153  DtComponentDescriptor* desc = 0,
154  DtReaderWriterRegistry* parentRegistry = 0);
155 
161  virtual makVrfEvents::DtDetonationEvent * createDetonationInteraction(
162  const DtDetonationDescriptor& desc, DtTime& detTime);
163 
166  virtual DtDetonationDescriptor* createDetonationDescriptor(
167  makVrfEvents::DtDetonationEvent* detInter, DtTime simTime);
168 
173  virtual void processSimObjectAdded(DtSimObjectReference vrfObject);
174 
176  virtual bool taskVisualizationsActive() const;
177 
178 protected:
179  virtual void tick();
180 
181  static void requestLaunchedMunitionsCallback(const DtVrfObjectMessage* msg, void* usr);
182  virtual void processRequestLaunchedMunitions(const DtVrfObjectMessage* msg);
183 
184  virtual void sendCurrentLaunchedMunition(const DtRwLaunchedMunition*, const DtUUID&);
185  virtual void sendAllMunitions(const DtUUID&);
186 
187  virtual void sendNextLaunchTime(const DtUUID&);
188 
189  virtual DtMunitionInFlight munitionInFlight(const DtRwLaunchedMunition*) const;
190 
193  virtual void detonationCallback(const makVrfEvents::DtEvent&);
194  virtual void processDetonation(const makVrfEvents::DtDetonationEvent& detonation);
196 
198  virtual bool createPorts();
199 
205  virtual bool createPSR();
206 
208  virtual void updateTaskVisualizations();
209 
211  virtual void generateKnownTargetPoint(const DtVector& worldLocation, DtString knownPointName);
212  virtual DtString generateKnownTargetPointName();
213 
214  virtual void munitionDeleted(const DtSimObject*);
215 
218  virtual bool determineMunitionPositionsParameters(DtVector& localTargetPoint, DtVector& localMuzzlePosition, DtDcm& localMuzzlePositionToTopoDcm,
219  DtVector& geocentricMuzzlePosition, DtVector& geocentricMuzzleVelocity, double& angleOfFire);
220 
224  virtual void registerAttributeFunctions();
225 
229  static bool unloadAmmunition(void* actuator, DtReaderWriter* dummy);
230 
231  virtual bool processUnloadAmmunition();
233 
234 protected:
235 
238 
241 
244  const DtIndirectFireActuator & orig);
245 
246 
247 protected:
248 
251 
258 
265 
272 
280 
287 
289 
291  DtList myTimerList;
293 
297 
298  boost::signals2::scoped_connection mySimObjectAddedConnection;
302 
303  std::map<DtUUID, boost::signals2::connection*> myMunitionRemovalConnections;
304 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:226
#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:296
DtVectorOutputPort * myMuzzleOffsetPort
Output Port Name: muzzle-offset-port Output Port Description: The entity&#39;s muzzle offset location...
Definition: indirectFireActuator.h:286
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:279
bool myNeedsLoadSend
Definition: indirectFireActuator.h:301
DtAnalogInputPort * myAngleOfFirePort
Input Port Name: angle-of-fire-port Input Port Description: Elevation angle of fire in radians...
Definition: indirectFireActuator.h:271
Definition: fireEvent.h:16
double myLastLoadTimeReported
Definition: indirectFireActuator.h:300
const DtWeaponActuator & operator=(const DtWeaponActuator &orig)
assignment operator; not implemented
double myLastTimeReported
Definition: indirectFireActuator.h:299
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:290
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:298
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:436
std::map< DtUUID, boost::signals2::connection * > myMunitionRemovalConnections
Definition: indirectFireActuator.h:303
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:32
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:49
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:292
DtList myTimerList
Definition: indirectFireActuator.h:291
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:257
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:89
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
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:79
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:264
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:112
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 Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)