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() override;
64 
65  //Initializes the laser controller
66  virtual bool init() override;
67 
70  virtual const char* type() const override;
71 
75  virtual void preFirstTickInit() override;
76 
83  virtual void tick() override;
84 
86  virtual void setDesignatorCode(const int code);
87  virtual const int designatorCode() const;
88 
89  virtual void clearTask() override;
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() override;
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 setLaserCodeRequestCallback(DtSimMessage* msg, void* usrData);
126  static void setLaserInformationRequestCallback(DtSimMessage* msg, void* usrData);
127 
128  //functions to do the work for the static function.
129  virtual void processLaseTargetTaskMessage(DtSimMessage *msg);
130  virtual void processSetLaserInformationRequestMessage(DtSimMessage* msg);
131  virtual void processSetLaserCodeRequestMessage(DtSimMessage* msg);
132 
133  static void requestLaserCodeCallback(const DtVrfObjectMessage* msg, void* usr);
134  virtual void processRequestLaserCode(const DtVrfObjectMessage* msg);
135 
137  virtual void disable() override;
138 
139  virtual bool tickWhileDestroyed() const override;
140 
141 protected:
142 
144  virtual bool createPortGroups() override;
145 
147  virtual bool createPorts() override;
148 
150  virtual bool lineOfSight(DtSimObjectReference target, DtString& reason);
151 
153  virtual bool targetPoint(const DtTaitBryan& orientation, DtVector& location);
154 
156  virtual DtVector localEyepoint() const;
157 
158  //updates the designator state and publishes it on the
159  //network
160  virtual void tickLaser();
161 
163  virtual void setRadio(DtSimRadio* radio) override;
164 
165  virtual bool createPublisher();
166 
167  virtual bool createTargetInput();
168 
171  virtual double laserPower() const;
172 
175  virtual double laserWavelength() const;
176 
179  virtual DtVector laserRelativePosition();
180 
185  virtual bool laseTargetValid(DtSimObjectReference target, DtString& invalidReason);
186 
191  virtual bool laseLocationValid(const DtVector& location, DtString& invalidReason);
192 
199  virtual void laseTargetSpotLocations(DtVector& spotLocation, DtVector& relativeSpotLocation) const;
200 
202  virtual int defaultLaserCode() const;
203 
204 protected:
206 
211  bool chordIntersectsExtent(const DtChord& chord,
212  const DtExtent& extent,
213  DtVector& intersectionEntryVector,
214  DtVector& intersectionExitVector) const;
215 
216 protected:
218 
222 
225 
228 
231 
237 
244 
251 
256 
264 
272 
274  bool myReinitializeLaser = false;
275 };
276 
280 DT_DLL_vrfmodel int generateLaserCodeFromName(const DtString& objectName);
makVrf::DtLaserDesignatorStateComponent * myLaserDesignatorComponent
Definition: lasingController.h:224
#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:271
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:25
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
DT_DLL_vrfmodel int generateLaserCodeFromName(const DtString &objectName)
Generates a pseudo-random laser code based on the object name of an entity.
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
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:230
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:250
DtBooleanInputPort * myLaserOnInputPort
Input Port Name: laser-on Input Port Description: Turns on the laser using the orientation and positi...
Definition: lasingController.h:236
double myTimeSinceSuccessfulLase
Definition: lasingController.h:273
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:64
DtInputPortGroup * myLaserOffsetInputPortGroup
Input Port Group Name: laser-offset Input Port Group Description: Allows another component to communi...
Definition: lasingController.h:255
Contains class declarations for DtEntityListInputPort, DtEntityListOutputPort, and DtEntityListPortDa...
Definition: entListIOPort.h:29
virtual void disable() override
Overridden to 1) remove any task message callbacks registered by this controller 2) call clear task...
File: simMsg.h.
Definition: simMessage.h:35
DtSimObjectReference myCurrentLasedTarget
Definition: lasingController.h:217
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation frame...
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:263
DtVectorInputPort * myTargetLocationInputPort
Input Port Name: target-location Input Port Description: Specifies a target location to be lased...
Definition: lasingController.h:243
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:97
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
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:227
DtLasingPSR * myProcessState
Current target we're lasing–point or entity.
Definition: lasingController.h:221
const DtLasingControllerDescriptor * myComponentDescriptor
Definition: lasingController.h:223
DtLasingPSR.
Definition: lasingPSR.h:25
Represents the interface between the DtTargetSelectionController and a weapon system.
Definition: weaponComponentInterface.h:20
A locally simulated VRF object.
Definition: localObject.h:98

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)