VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lasingController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 #include "vrfobjcore/simObject.h"
14 
15 class DtString;
17 class DtSimMessage;
19 class DtLasingPSR;
21 class DtOutputPortGroup;
22 class DtBooleanInputPort;
23 class DtVectorInputPort;
24 class DtStringInputPort;
26 class DtSetTargetRequest;
29 class DtVrfObjectMessage;
30 
31 namespace makVrf
32 {
33  class DtLaserDesignatorStateComponent;
34 }
35 
41 {
42 private:
45 
48  orig);
49 
51  const DtLasingController & operator=(const DtLasingController & orig);
52 
53 public:
54 
56  DtLasingController(const DtString& name,
57  DtLocalObject* owner,
58  DtSimulationServices* simManager,
59  DtComponentDescriptor* desc = 0,
60  DtReaderWriterRegistry* parentRegistry = 0);
61 
63  virtual ~DtLasingController();
64 
65  //Initializes the laser controller
66  virtual bool init();
67 
70  virtual const char* type() const;
71 
75  virtual void preFirstTickInit();
76 
83  virtual void tick();
84 
86  virtual void setDesignatorCode(const int code);
87  virtual const int designatorCode() const;
88 
89  virtual void clearTask();
90 
94  virtual bool createProcessSR();
95 
97  virtual void startLasing();
98  virtual void stopLasing();
99 
102  virtual void laseTarget(DtSimObjectReference targetObject);
103 
106  virtual void laseLocation(const DtVector& location);
107 
109  virtual bool lasing() const;
110 
111  //static creator
112  static DtSimComponent * creator(const DtString& name,
113  DtLocalObject* owner,
114  DtSimulationServices* simManager,
115  DtComponentDescriptor* desc = 0,
116  DtReaderWriterRegistry* parentRegistry = 0);
117 
119  virtual void registerTaskMsgCallbacks();
120  virtual void registerSetLaserCodeRequestMsgCallbacks();
121  virtual void registerSetLaserInformationRequestMsgCallbacks();
122 
123  //static callbacks to register with the radio for commands to lase a target
124  static void laseTargetTaskCallback(DtSimMessage *msg, void * usrData);
125  static void laseLocationTaskCallback(DtSimMessage *msg, void * usrData);
126  static void setLaserCodeRequestCallback(DtSimMessage* msg, void* usrData);
127  static void setLaserInformationRequestCallback(DtSimMessage* msg, void* usrData);
128 
129  //functions to do the work for the static function.
130  virtual void processLaseTargetTaskMessage(DtSimMessage *msg);
131  virtual void processLaseLocationTaskMessage(DtSimMessage *msg);
132  virtual void processSetLaserInformationRequestMessage(DtSimMessage* msg);
133  virtual void processSetLaserCodeRequestMessage(DtSimMessage* msg);
134 
135  static void requestLaserCodeCallback(const DtVrfObjectMessage* msg, void* usr);
136  virtual void processRequestLaserCode(const DtVrfObjectMessage* msg);
137 
139  virtual void disable();
140 
141  virtual bool tickWhileDestroyed() const override;
142 
143 protected:
144 
146  virtual bool createPortGroups();
147 
149  virtual bool createPorts();
150 
152  virtual bool lineOfSight(DtSimObjectReference target, DtString& reason);
153 
155  virtual bool targetPoint(const DtTaitBryan& orientation, DtVector& location);
156 
158  virtual DtVector localEyepoint() const;
159 
160  //updates the designator state and publishes it on the
161  //network
162  virtual void tickLaser();
163 
165  virtual void setRadio(DtSimRadio * radio);
166 
167  virtual bool createPublisher();
168 
169  virtual bool createTargetInput();
170 
173  virtual double laserPower() const;
174 
177  virtual double laserWavelength() const;
178 
181  virtual DtVector laserRelativePosition();
182 
187  virtual bool laseTargetValid(DtSimObjectReference target, DtString& invalidReason);
188 
193  virtual bool laseLocationValid(const DtVector& location, DtString& invalidReason);
194 
201  virtual void laseTargetSpotLocations(DtVector& spotLocation, DtVector& relativeSpotLocation) const;
202 
204  virtual int defaultLaserCode() const;
205 
206 protected:
208 
213  bool chordIntersectsExtent(const DtChord& chord,
214  const DtExtent& extent,
215  DtVector& intersectionEntryVector,
216  DtVector& intersectionExitVector) const;
217 
218 protected:
220 
224 
227 
230 
233 
239 
246 
253 
258 
266 
274 
276 };
277 
281 int generateLaserCodeFromName(const DtString& objectName);
makVrf::DtLaserDesignatorStateComponent * myLaserDesignatorComponent
Definition: lasingController.h:226
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
DtVectorInputPort * myPositionInputPort
Input Port Name: position Input Port Description: Specifies the position of the laser in body coordin...
Definition: lasingController.h:273
virtual void disable() override
Overridden to allow tasks controllers that can be disabled to call task complete. ...
Definition: simRadio.h:30
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtSetTargetRequest.
Definition: setTargetRequest.h:26
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Contains class declarations for DtStringInputPort, DtStringOutputPort, and DtStringPortData.
Definition: stringIOPort.h:27
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
bool myInvalidTargetMsgPrinted
Remember if an invalid-target message has been printed (print it once)
Definition: lasingController.h:232
Definition: readerWriterRegistry.h:39
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
DtOutputPortGroup is a data port group of a data provider. It may contain any number of DtOutputPorts...
Definition: outputPortGroup.h:34
virtual void setRadio(DtSimRadio *radio) override
Calls registerTaskMsgCallbacks.
DtStringInputPort * myTargetObjectInputPort
Input Port Name: target-object Input Port Description: Specifies a target object to be lased...
Definition: lasingController.h:252
DtBooleanInputPort * myLaserOnInputPort
Input Port Name: laser-on Input Port Description: Turns on the laser using the orientation and positi...
Definition: lasingController.h:238
double myTimeSinceSuccessfulLase
Definition: lasingController.h:275
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
virtual bool init() override
Calls setRadio()
File: lasingCtlrDesc.h.
Definition: lasingControllerDescriptor.h:33
1) Define the interface class that will be used to represent the next and curent frames. The UNDEFINED_ macros are convenience macros that will define methods that throw exceptions (until they are implemented)
Definition: laserDesignatorStateComponent.h:56
DtInputPortGroup * myLaserOffsetInputPortGroup
Input Port Group Name: laser-offset Input Port Group Description: Allows another component to communi...
Definition: lasingController.h:257
Contains class declarations for DtEntityListInputPort, DtEntityListOutputPort, and DtEntityListPortDa...
Definition: entListIOPort.h:29
File: simMsg.h.
Definition: simMessage.h:35
DtSimObjectReference myCurrentLasedTarget
Definition: lasingController.h:219
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
virtual bool tickWhileDestroyed() const
If the component returns true here, it will be ticked regardless of the destroyed state of the host e...
DtOrientationInputPort * myOrientationInputPort
Input Port Name: orientation Input Port Description: Specifies the orientation of the laser relative ...
Definition: lasingController.h:265
DtVectorInputPort * myTargetLocationInputPort
Input Port Name: target-location Input Port Description: Specifies a target location to be lased...
Definition: lasingController.h:245
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
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:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
Class Description: DtLasingController Lases a target location or entity. Determines the visibility of...
Definition: lasingController.h:40
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
Input and output ports containing a DtTaitBryan.
Definition: orientationIOPort.h:26
virtual void clearTask() override
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
DtInputPortGroup is a data port group of a data consumer. It may contain any number of DtInputPorts a...
Definition: inputPortGroup.h:35
bool myConnectedToLauncher
Indicates whether myLasingInput is connected to a launcher or not.
Definition: lasingController.h:229
DtLasingPSR * myProcessState
Current target we're lasing–point or entity.
Definition: lasingController.h:223
int generateLaserCodeFromName(const DtString &objectName)
Generates a pseudo-random laser code based on the object name of an entity.
const DtLasingControllerDescriptor * myComponentDescriptor
Definition: lasingController.h:225
DtLasingPSR.
Definition: lasingPSR.h:25
Represents the interface between the DtTargetSelectionController and a weapon system.
Definition: weaponComponentInterface.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

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)