VR-Forces 4.8 Class Documentation
 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 
19 
23 class DtObjectSensorPSR;
28 class DtObjectType;
31 class DtVectorInputPort;
32 class DtInputPortGroup;
33 class DtStringInputPort;
34 class DtBooleanInputPort;
35 class DtIntegerInputPort;
36 
51 {
52 private:
55 
58  orig);
59 
61  const DtObjectSensor & operator=(const
62  DtObjectSensor & orig);
63 
64 public:
65 
67  {
68  DetectionLost = 0,
69  DetectionContinued = 1,
70  DetectionMissed = 2,
71  };
72 
74 
77  DtObjectSensor(const DtString& name,
78  DtVrfObject* owner,
79  DtSimManager* simManager,
80  DtComponentDescriptor* desc = 0,
81  DtReaderWriterRegistry* parentRegistry = 0);
82 
84  virtual ~DtObjectSensor();
85 
90  virtual bool init();
91 
96  virtual bool postAddComponentsInit();
97 
100  virtual void preFirstTickInit();
101 
104  virtual const char* type() const;
105 
114  virtual void tick();
115 
120  virtual bool tickWhileDestroyed() const;
121 
125  virtual int sensorType() const;
126 
131  virtual void enable();
132  virtual void disable();
133  virtual void setIsEnabled(bool yesNo);
135 
141  virtual void setTypesToDetectForTask(const DtRwObjectTypeList& objectTypes);
142 
144  virtual void clearTypesToDetectForTask();
145 
147  virtual const DtRwObjectTypeList& typesToDetectForTask() const;
149 
158  static bool setTypesToDetectAttribute(void* ctrlr, DtReaderWriter* val);
159  virtual bool setTypesToDetectAttribute(DtReaderWriter* val);
161 
165  static bool clearTypesToDetect(void* ctrlr, DtReaderWriter* val);
166  virtual bool clearTypesToDetect(DtReaderWriter* val);
169 
171  virtual void setSensorEnabled(bool enabled);
172 
174  virtual bool sensorEnabled() const;
175 
179  static DtSimComponent * creator(const DtString& name,
180  DtVrfObject* owner,
181  DtSimManager* simManager,
182  DtComponentDescriptor* desc = 0,
183  DtReaderWriterRegistry* parentRegistry = 0);
184 
185 protected:
186 
188  virtual bool createPortGroups();
189 
191  virtual bool createPorts();
192 
198  virtual DtObjectSensorPSR* createPSR();
199 
203  virtual const char* defaultPSRType() const;
204 
208  virtual void initSensorRangeRing();
209 
216  virtual void updateDetectableObjectsList();
217 
222 
223  DtCompositePredicate objectTypeForcePredicate(const DtObjectType&,
225  const DtNLengthIntegerVector& forceTypes);
227  DtCompositePredicate objectTypeForcePredicate(const DtObjectType&,
228  const std::list<DtU8>& forceTypes);
230 
234  virtual bool initSensorGeometry();
235 
239  virtual void setupGeometryForDetection();
240 
244  virtual DtVector localSensorPosition() const;
245 
249  virtual DtVector bodySensorPosition() const;
250 
254  virtual DtTaitBryan localSensorOrientation() const;
255 
259  virtual DtTaitBryan bodySensorOrientation() const;
260 
263  virtual DtUUID targetObject() const;
264 
267  virtual DtVector targetLocation() const;
268 
271  virtual DtSensorTrackingMode trackingMode() const;
272 
279  virtual bool processObjects();
280 
289  virtual bool detectObject(const DtVrfObject* object,
290  DtRwSensorContactInfo* contactInfo);
291 
302  virtual ContinueDetectingResult continueDetectingObject(const DtVrfObject* object,
303  DtRwSensorContactInfo* contactInfo, bool& contactInfoModified);
304 
308  virtual bool objectWithinSensorGeometry(const DtVrfObject* object) const;
309 
312  virtual double rangeSquaredToObject(const DtVrfObject* object) const;
313 
316  virtual double rangeToObject(const DtVrfObject* object) const;
317 
319  virtual void clearObjectRangeCache() const;
320 
322  virtual void printTargets() const;
323 
326  virtual void updateDetectedObjectListPort();
327 
329  virtual bool createAndInitSensorMonitor();
330 
332  virtual bool objectInDetectableList(const DtVrfObject*) const;
333 
336  static void hostilitiesChangedCallback(DtU8 force, void* usr);
337  virtual void processHostilitiesChanged(DtU8 force);
338 
343  virtual DtTaitBryan worldOrientationOfObject(const DtVrfObject* object) const;
344 
347  virtual bool canDetectForceOfObject(const DtVrfObject*);
348 
351  static void setSensorEnabledRequestCallback(DtSimMessage *msg, void * usrData);
352 
355  virtual void processSetSensorEnabledRequestMessage(DtSimMessage *msg);
356 
357 protected:
358 
360 
361  DtSensorContactListOutputPort * myDetectedObjectListPort;
368 
378 
379 
380 
385 
393 
403 
411 
419 
427 
435 
437 
440 
444 
449 
451  DtForceType myForceType;
452 
463 
466 
468 };
469 
double myMutableObjectRangeSquaredCache
The current range squared to the cached object, if calculated.
Definition: objectSensor.h:462
UUID is a unique ID wrapper class.
Definition: rwUUID.h:222
DtOrientationInputPort * myOrientationInputPort
Input Port Name: orientation Input Port Description: Specifies the orientation of the sensor relative...
Definition: objectSensor.h:392
#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:144
Contains the DtCompositePredicate class declaration.
Definition: compositePredicate.h:26
DtInputPortGroup * mySensorOffsetInputPortGroup
Input Port Group Name: sensor-offset Input Port Group Description: Allows an external controller to p...
Definition: objectSensor.h:384
bool myMutableObjectRangeCalculated
Keeps track of whether the range has been calculated for the current cached object.
Definition: objectSensor.h:456
Description: DtNLengthIntegerVector is a named, readable/writable vector of integers of arbitrary len...
Definition: nLengthIntegerVector.h:28
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
DtStringInputPort * myTargetObjectInputPort
Input Port Name: target-object Input Port Description: Specifies the name of the object be targeted b...
Definition: objectSensor.h:410
virtual void setIsEnabled(bool yesNo)
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
Definition: sensorContactListIOPort.h:71
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:42
DtObjectSensorDescriptor; descriptor for the DtObjectSensor component.
Definition: objectSensorDescriptor.h:26
bool myMutableObjectRangeSquaredCalculated
Keeps track of whether the range squared has been calculated for the current cached object...
Definition: objectSensor.h:460
Definition: readerWriterRegistry.h:39
This class represents the data gathered by a sensor about a particular single sensor contact...
Definition: rwSensorContactInfo.h:67
virtual void disable()
Contains class declarations for DtIntegerInputPort, DtIntegerOutputPort, and DtIntegerPortData.
Definition: integerIOPort.h:25
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
DtObjectTypesListMultiInputPort * myObjectsToDetectInputPort
Inputs: DtObjectTypesListMultiInputPort : object-types-to-detect Input Port Name: object-types-to-det...
Definition: objectSensor.h:377
DtObjectSensor is a base level sensor component.
Definition: objectSensor.h:50
DtManagedObjectListConstPtr myDetectableObjectList
Definition: objectSensor.h:438
virtual void enable()
Is this component enabled or not.
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.
An abstract base class for all evaluators of spatial filters.
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...
DtForceType myForceType
The force type the last time the detectable object list was updated.
Definition: objectSensor.h:451
DtSimComponent & operator=(const DtSimComponent &orig)
assignment operator, not implemented
DtSpatialFilterEvaluator * mySensorGeometryEvaluator
Definition: objectSensor.h:448
DtVectorInputPort * myTargetLocationInputPort
Input Port Name: target-location Input Port Description: Specifies the location to be targeted by thi...
Definition: objectSensor.h:418
virtual bool createPorts()
Called by init.
DtObjectSensorPSR * myProcessState
Container for state data associated with this component.
Definition: objectSensor.h:443
ContinueDetectingResult
Definition: objectSensor.h:66
virtual bool createPortGroups()
Called by init.
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
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:458
DtBooleanInputPort * myTargetAcquiredInputPort
Input Port Name: target-acquired Input Port Description: Specifies whether the sensor was able to acq...
Definition: objectSensor.h:434
const DtObjectSensorDescriptor * myObjectSensorDescriptor
Definition: objectSensor.h:439
Input and output ports containing a DtTaitBryan.
Definition: orientationIOPort.h:26
DtVectorInputPort * myPositionInputPort
Input Port Name: position Input Port Description: Specifies the position of the sensor in body coordi...
Definition: objectSensor.h:402
DtInputPortGroup is a data port group of a data consumer.
Definition: inputPortGroup.h:32
Class which manages the sending of sensor contact information to the GUI from one particular sensor o...
Definition: objectSensorMonitor.h:25
DtBoost::shared_ptr< const DtManagedObjectList > DtManagedObjectListConstPtr
Typedef for a shared pointer to a const DtOrgViewManagedObjectList.
Definition: managedObjectList.h:31
bool myPrep_invokeNewContactCallbacks
Definition: objectSensor.h:467
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
bool myGeometrySetup
Whether setupGeometryForDetection() has been called yet.
Definition: objectSensor.h:465
const DtVrfObject * myMutableObjectCached
The VrfObject whose range is currently cached.
Definition: objectSensor.h:454
DtIntegerInputPort * myTrackingModeInputPort
Input Port Name: tracking-mode Input Port Description: Specifies the tracking mode of the sensor...
Definition: objectSensor.h:426
DtObjectSensorMonitor * myMonitor
Sends out sensor contact information to the GUI if the GUI or other application has requested the inf...
Definition: objectSensor.h:447
virtual const char * type() const =0
Returns a string identifies the class type of component.
Definition: objectSensorPSR.h:30

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)