VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
objectSensor.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2005 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
8 
11 
12 #pragma once
13 
20 
24 class DtObjectSensorPSR;
29 class DtObjectType;
32 class DtVectorInputPort;
33 class DtInputPortGroup;
34 class DtStringInputPort;
35 class DtBooleanInputPort;
36 class DtIntegerInputPort;
38 class DtInterruptFlag;
39 
54 {
55 private:
58 
61  orig);
62 
64  const DtObjectSensor & operator=(const
65  DtObjectSensor & orig);
66 
67 public:
68 
70  {
71  DetectionLost = 0,
72  DetectionContinued = 1,
73  DetectionMissed = 2,
74  };
75 
78  {
81  {
82  psrContactListItem = nullptr;
83  changesMade = false;
84  isComplete = false;
85  }
88  DtListItem* psrContactListItem;
89  DtBoost::shared_ptr<DtLocalizedManagedObjectList> currentlyDetectableObjectList;
92  typedef std::set<DtUUID> TargetSet;
94  bool isComplete;
95 
96  };
97 
99 
102  DtObjectSensor(const DtString& name,
103  DtLocalObject* owner,
104  DtSimulationServices* simManager,
105  DtComponentDescriptor* desc = 0,
106  DtReaderWriterRegistry* parentRegistry = 0);
107 
109  virtual ~DtObjectSensor();
110 
115  virtual bool init();
116 
121  virtual bool postAddComponentsInit();
122 
125  virtual void preFirstTickInit();
126 
129  virtual const char* type() const;
130 
139  virtual void tick();
140 
145  virtual bool tickWhileDestroyed() const;
146 
150  virtual int sensorType() const;
151 
156  virtual void enable();
157  virtual void disable();
158  virtual void setIsEnabled(bool yesNo);
160 
166  virtual void setTypesToDetectForTask(const DtRwObjectTypeList& objectTypes);
167 
169  virtual void clearTypesToDetectForTask();
170 
172  virtual const DtRwObjectTypeList& typesToDetectForTask() const;
174 
183  static bool setTypesToDetectAttribute(void* ctrlr, DtReaderWriter* val);
184  virtual bool setTypesToDetectAttribute(DtReaderWriter* val);
186 
190  static bool clearTypesToDetect(void* ctrlr, DtReaderWriter* val);
191  virtual bool clearTypesToDetect(DtReaderWriter* val);
194 
201  static DtReaderWriter* getSensorPositionAttribute(void* ctrlr);
202  virtual DtReaderWriter* getSensorPositionAttribute();
203 
205  virtual void setSensorEnabled(bool enabled);
206 
208  virtual bool sensorEnabled() const;
209 
213  static DtSimComponent * creator(const DtString& name,
214  DtLocalObject* owner,
215  DtSimulationServices* simManager,
216  DtComponentDescriptor* desc = 0,
217  DtReaderWriterRegistry* parentRegistry = 0);
218 
219 protected:
220 
222  virtual bool createPortGroups();
223 
225  virtual bool createPorts();
226 
232  virtual DtObjectSensorPSR* createPSR();
233 
237  virtual const char* defaultPSRType() const;
238 
242  virtual void initSensorRangeRing();
243 
250  virtual void updateDetectableObjectsList();
251 
256 
257  DtCompositePredicate objectTypeForcePredicate(const DtObjectType&,
259  const DtNLengthIntegerVector& forceTypes);
261  DtCompositePredicate objectTypeForcePredicate(const DtObjectType&,
262  const std::list<DtU8>& forceTypes);
264 
268  virtual bool initSensorGeometry();
269 
273  virtual void setupGeometryForDetection();
274 
278  virtual DtVector localSensorPosition() const;
279 
283  virtual DtVector bodySensorPosition() const;
284 
288  virtual DtTaitBryan localSensorOrientation() const;
289 
293  virtual DtTaitBryan bodySensorOrientation() const;
294 
297  virtual DtUUID targetObject() const;
298 
301  virtual DtVector targetLocation() const;
302 
305  virtual DtSensorTrackingMode trackingMode() const;
306 
313  virtual void processObjects();
314 
315 
316  virtual void processObjectsSlice(const DtInterruptFlag& timer);
317 
326  virtual bool detectObject(DtSimObjectReference object,
327  DtRwSensorContactInfo* contactInfo);
328 
339  virtual ContinueDetectingResult continueDetectingObject(DtSimObjectReference object,
340  DtRwSensorContactInfo* contactInfo, bool& contactInfoModified);
341 
345  virtual bool objectWithinSensorGeometry(const DtSimObject* object) const;
346 
351  virtual bool sensorGeometryExtent(DtExtent& extent) const;
352 
355  virtual double rangeSquaredToObject(const DtSimObject* object) const;
356 
359  virtual double rangeToObject(const DtSimObject* object) const;
360 
362  virtual void clearObjectRangeCache() const;
363 
365  virtual void printTargets() const;
366 
369  virtual void updateDetectedObjectListPort();
370 
372  virtual bool createAndInitSensorMonitor();
373 
375  virtual bool objectInDetectableList(const DtSimObject*) const;
376 
379  static void hostilitiesChangedCallback(DtU8 force, void* usr);
380  virtual void processHostilitiesChanged(DtU8 force);
381 
386  virtual DtTaitBryan worldOrientationOfObject(const DtSimObject* object) const;
387 
390  virtual bool canDetectForceOfObject(const DtSimObject*);
391 
394  static void setSensorEnabledRequestCallback(DtSimMessage *msg, void * usrData);
395 
398  virtual void processSetSensorEnabledRequestMessage(DtSimMessage *msg);
399 
402  virtual void notifyContactsChanged();
403 
404 protected:
405 
407 
408  DtSensorContactListOutputPort * myDetectedObjectListPort;
415 
425 
426 
427 
432 
440 
450 
458 
466 
474 
482 
484 
487 
491 
496 
498  DtForceType myForceType;
499 
510 
513 
516 
517  DtBoost::shared_ptr<DtProcessObjectsState> myProcessObjectsState;
518 };
519 
double myMutableObjectRangeSquaredCache
The current range squared to the cached object, if calculated.
Definition: objectSensor.h:509
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
DtOrientationInputPort * myOrientationInputPort
Input Port Name: orientation Input Port Description: Specifies the orientation of the sensor relative...
Definition: objectSensor.h:439
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual bool postAddComponentsInit()
Called after all components have been created, initialized and added to the component manager...
Definition: simComponent.h:107
Contains the DtCompositePredicate class declaration.
Definition: compositePredicate.h:23
DtInputPortGroup * mySensorOffsetInputPortGroup
Input Port Group Name: sensor-offset Input Port Group Description: Allows an external controller to p...
Definition: objectSensor.h:431
bool myMutableObjectRangeCalculated
Keeps track of whether the range has been calculated for the current cached object.
Definition: objectSensor.h:503
Description: DtNLengthIntegerVector is a named, readable/writable vector of integers of arbitrary len...
Definition: nLengthIntegerVector.h:28
bool changesMade
Definition: objectSensor.h:91
DtStringInputPort * myTargetObjectInputPort
Input Port Name: target-object Input Port Description: Specifies the name of the object be targeted b...
Definition: objectSensor.h:457
virtual void setIsEnabled(bool yesNo)
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 void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
Definition: sensorContactListIOPort.h:71
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Filters the contents of a DtManagedObjectList using a spatial organization to generate a list of only...
Definition: localizedManagedObjectList.h:23
Contains class declarations for DtStringInputPort, DtStringOutputPort, and DtStringPortData.
Definition: stringIOPort.h:27
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
DtBoost::shared_ptr< DtProcessObjectsState > myProcessObjectsState
Definition: objectSensor.h:517
DtObjectSensorDescriptor; descriptor for the DtObjectSensor component.
Definition: objectSensorDescriptor.h:27
bool myMutableObjectRangeSquaredCalculated
Keeps track of whether the range squared has been calculated for the current cached object...
Definition: objectSensor.h:507
Definition: readerWriterRegistry.h:39
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:68
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).
Contains class declarations for DtIntegerInputPort, DtIntegerOutputPort, and DtIntegerPortData.
Definition: integerIOPort.h:25
DtManagedObjectList::const_iterator nextDetectableObject
Definition: objectSensor.h:90
virtual bool init()
Calls createPorts and createPortGroups Initializes myLastTickSimTime.
Definition: objectType.h:27
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Definition: objectSensor.h:515
Holds the interal state for the processObjectsSlice()
Definition: objectSensor.h:77
DtObjectTypesListMultiInputPort * myObjectsToDetectInputPort
Inputs: DtObjectTypesListMultiInputPort : object-types-to-detect Input Port Name: object-types-to-...
Definition: objectSensor.h:424
DtObjectSensor is a base level sensor component.
Definition: objectSensor.h:53
DtManagedObjectListConstPtr myDetectableObjectList
Definition: objectSensor.h:485
Interface for a customizable interrupt flag that can be passed into a function to allow the calling c...
Definition: interruptFlag.h:9
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).
File: simMsg.h.
Definition: simMessage.h:35
class DtRwObjectTypeList:
Definition: rwObjectTypeList.h:30
DtSensorTrackingMode
Definition: sensorFieldOfViewEnums.h:9
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
An abstract base class for all evaluators of spatial filters. The evaluation of spatial filters is sp...
Definition: spatialFilterEvaluator.h:30
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...
DtListItem * psrContactListItem
The next item in the PSR contact info list to be processed for continueDectectingObject().
Definition: objectSensor.h:88
DtForceType myForceType
The force type the last time the detectable object list was updated.
Definition: objectSensor.h:498
DtSimComponent & operator=(const DtSimComponent &orig)
assignment operator, not implemented
DtSpatialFilterEvaluator * mySensorGeometryEvaluator
Definition: objectSensor.h:495
DtVectorInputPort * myTargetLocationInputPort
Input Port Name: target-location Input Port Description: Specifies the location to be targeted by thi...
Definition: objectSensor.h:465
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
DtObjectSensorPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: objectSensor.h:490
ContinueDetectingResult
Definition: objectSensor.h:69
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:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
std::set< DtSimObjectReference >::const_iterator const_iterator
Definition: managedObjectList.h:98
DtProcessObjectsState()
Make sure new instances of state have variables initialized.
Definition: objectSensor.h:80
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
A multi-connection input port whose data members are entity lists.
Definition: objectTypesListMultiInputPort.h:19
double myMutableObjectRangeCache
The current range to the cached object, if calculated.
Definition: objectSensor.h:505
DtBooleanInputPort * myTargetAcquiredInputPort
Input Port Name: target-acquired Input Port Description: Specifies whether the sensor was able to acq...
Definition: objectSensor.h:481
Contains the DtSimComponent class declaration.
const DtObjectSensorDescriptor * myObjectSensorDescriptor
Definition: objectSensor.h:486
Input and output ports containing a DtTaitBryan.
Definition: orientationIOPort.h:26
std::set< DtUUID > TargetSet
Definition: objectSensor.h:92
DtVectorInputPort * myPositionInputPort
Input Port Name: position Input Port Description: Specifies the position of the sensor in body coordi...
Definition: objectSensor.h:449
DtInputPortGroup is a data port group of a data consumer. It may contain any number of DtInputPorts a...
Definition: inputPortGroup.h:35
Class which manages the sending of sensor contact information to the GUI from one particular sensor o...
Definition: objectSensorMonitor.h:26
DtBoost::shared_ptr< const DtManagedObjectList > DtManagedObjectListConstPtr
Typedef for a shared pointer to a const DtOrgViewManagedObjectList. These lists are used within VR-Fo...
Definition: managedObjectList.h:35
bool myPrep_invokeNewContactCallbacks
Definition: objectSensor.h:514
bool myGeometrySetup
Whether setupGeometryForDetection() has been called yet.
Definition: objectSensor.h:512
const DtSimObject * myMutableObjectCached
The VrfObject whose range is currently cached.
Definition: objectSensor.h:501
TargetSet checkedTargets
Definition: objectSensor.h:93
DtIntegerInputPort * myTrackingModeInputPort
Input Port Name: tracking-mode Input Port Description: Specifies the tracking mode of the sensor...
Definition: objectSensor.h:473
DtObjectSensorMonitor * myMonitor
Sends out sensor contact information to the GUI if the GUI or other application has requested the inf...
Definition: objectSensor.h:494
bool isComplete
Definition: objectSensor.h:94
virtual const char * type() const =0
Returns a string identifies the class type of component. Type values are defined in compTypes...
Definition: objectSensorPSR.h:23
DtBoost::shared_ptr< DtLocalizedManagedObjectList > currentlyDetectableObjectList
Definition: objectSensor.h:89
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)