VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtObstructionSensor Class Reference

DtObstructionSensor models a sensor able to detect potential collisions with other entities and/or terrain vector data. More...

Inheritance diagram for DtObstructionSensor:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtObstructionSensor (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtObstructionSensor ()
 destructor
virtual bool init ()
 Initializes the Obstruction sensor for use.
virtual void tick ()
 Determines if the entity is currently colliding with any of the specified potential Obstructions.
virtual DtString type () const
 Returns a string identifies the class type of component.

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual bool createPSR ()
 Creates myProcessState data member, and adds it to our process state repository manager.
virtual bool createCollisionDetector ()
 Creates the collision detector.
virtual bool setObstructionIDsInCollisionDetector ()
 Sets the obstruction IDs in the collision detector based on the descriptor and the PSR.
virtual bool initializeCollisionBV ()
 Initializes the collision bounding volume.
virtual bool calculateStoppingDistance (const DtObstructionSensorDescriptor &obstructionSensorDesc, double &stoppingDistance)
 Calculates the current stopping distance of the entity.
virtual bool calculateCollisionBV ()
 Calculates the bounding volume representing the potential collision volume occupied by the entity.
virtual void registerMessageCallbacks ()
 Registers for DtSetCollisionAvoidTypes messages.
virtual void processCollisionAvoidTypes (DtSimMessage *msg)
 Modifies the current obstruction detection types based on the contents of the message.
virtual bool addVectorObstructionType (const DtRwVectorObstructionType &obsId)
 Adds the specified obstruction type to the PSR's vector obstruction list unless this type of obstruction is already being checked for.
virtual bool removeVectorObstructionType (const DtRwVectorObstructionType &obsId)
 Removes the specified obstruction type from the PSR's vector obstruction list unless this type of obstruction if it is currently being checked for.
virtual DtRwVectorObstructionType buildingVectorObstructionType () const
 Returns the vector obstruction type that will be added/removed when a DtSetCollisionAvoidTypes message arrives that adds/removes building avoidance.
virtual DtRwVectorObstructionType treeVectorObstructionType () const
 Returns the vector obstruction type that will be added/removed when a DtSetCollisionAvoidTypes message arrives that adds/removes trees avoidance.
virtual double decelerationSoilFactor () const
virtual bool createPorts ()
 Creates, initializes, and adds to the port group, all the ports for this component.
virtual bool createPortGroups ()
 Creates and adds all port groups for this component.

Static Protected Member Functions

static void setCollisionAvoidTypesCallback (DtSimMessage *msg, void *usr)
 Calls processCollisionAvoidTypes().

Protected Attributes

Dt3dBoundingVolume * myCollisionBV
DtCollisionDetectormyCollisionDetector
DtCollisionDetector::DtObjectObstructionIDContainer myObjectObstructionIDs
DtCollisionDetector::DtVectorObstructionIDContainer myVectorObstructionIDs
const
DtObstructionSensorDescriptor
myObstructionSensorDesc
DtObstructionSensorPSRmyProcessState
 Container for state data associated with this component.
bool myFirstTick
DtCollisionmyPotentialCollision
Ports and Port Groups
DtCollisionOutputPortmyPotentialCollisionInfoPort
 Output Port Name: potential-collision-info
Output Port Description: Information about an impending potential collision with an entity or terrain vector data feature.
DtOutputPortGroupmyObstructionInfoPortGroup
 Output Port Group Name: obstruction-info
Output Port Group Description:

Private Member Functions

 DtObstructionSensor (const DtObstructionSensor &orig)
 copy constructor; not implemented
DtObstructionSensoroperator= (const DtObstructionSensor &orig)
 assignment operator; not implemented

Detailed Description

DtObstructionSensor models a sensor able to detect potential collisions with other entities and/or terrain vector data.

Uses Descriptor Type: DtObstructionSensorDescriptor


Constructor & Destructor Documentation

DtObstructionSensor::DtObstructionSensor ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

copy constructor; not implemented


Member Function Documentation

DtObstructionSensor& DtObstructionSensor::operator= ( const DtObstructionSensor orig) [private]

assignment operator; not implemented

Reimplemented in DtHumanObstructionSensor.

virtual bool DtObstructionSensor::init ( ) [virtual]

Initializes the Obstruction sensor for use.

This involves calculating the initial collision bounding volume.

Returns:
A boolean signifying success or failure.
See also:
initializeCollisionBV()

Reimplemented from DtSimComponent.

virtual void DtObstructionSensor::tick ( ) [virtual]

Determines if the entity is currently colliding with any of the specified potential Obstructions.

If so, it fills the myPotentialCollisionInfoPort with the potential collision data if it can activate the ports. Otherwise, it releases any active ports.

See also:
calculateCollisionBV()
detectCollision()

Reimplemented from DtSimComponent.

virtual DtString DtObstructionSensor::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtObstructionSensorType

Reimplemented from DtSimComponent.

Reimplemented in DtHumanObstructionSensor.

virtual bool DtObstructionSensor::createPSR ( ) [protected, virtual]

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.

virtual bool DtObstructionSensor::createCollisionDetector ( ) [protected, virtual]

Creates the collision detector.

Sets the obstruction IDs in the collision detector based on the descriptor and the PSR.

PSR values take precedence over values in the descriptor.

Returns:
a boolean indicating success or failure.
virtual bool DtObstructionSensor::initializeCollisionBV ( ) [protected, virtual]

Initializes the collision bounding volume.

Returns:
A boolean signifying success or failure.
virtual bool DtObstructionSensor::calculateStoppingDistance ( const DtObstructionSensorDescriptor obstructionSensorDesc,
double &  stoppingDistance 
) [protected, virtual]

Calculates the current stopping distance of the entity.

To get this, it queries the ground auto controller component, if specified, and returns the current braking distance that that component calculates.

Returns:
true if the stopping distance was calculated. false if the distance could not be calculated for any reason. This includes if the ground auto controller component member of the descriptor is not specified or if the component can't be found in the component manager (by name).
Note:
If the function returns false, the stoppingDistance parameter is not modified.
To decouple this from any use of a ground auto controller component derive a child class and override this function.

Reimplemented in DtHumanObstructionSensor.

virtual bool DtObstructionSensor::calculateCollisionBV ( ) [protected, virtual]

Calculates the bounding volume representing the potential collision volume occupied by the entity.

The entities oriented bounding volume is extended in the direction of travel. It represents a prediction of the entity's future movement for some period of time.

Returns:
A boolean signifying success or failure. If the function fails, the bounding volume value is not defined to be correct.
virtual void DtObstructionSensor::registerMessageCallbacks ( ) [protected, virtual]

Registers for DtSetCollisionAvoidTypes messages.

static void DtObstructionSensor::setCollisionAvoidTypesCallback ( DtSimMessage msg,
void *  usr 
) [static, protected]
virtual void DtObstructionSensor::processCollisionAvoidTypes ( DtSimMessage msg) [protected, virtual]

Modifies the current obstruction detection types based on the contents of the message.

virtual bool DtObstructionSensor::addVectorObstructionType ( const DtRwVectorObstructionType obsId) [protected, virtual]

Adds the specified obstruction type to the PSR's vector obstruction list unless this type of obstruction is already being checked for.

Returns:
True if the list was modified.
virtual bool DtObstructionSensor::removeVectorObstructionType ( const DtRwVectorObstructionType obsId) [protected, virtual]

Removes the specified obstruction type from the PSR's vector obstruction list unless this type of obstruction if it is currently being checked for.

Returns:
True if the list was modified.

Returns the vector obstruction type that will be added/removed when a DtSetCollisionAvoidTypes message arrives that adds/removes building avoidance.

By default, returns a spec of layer MAK000.

Returns the vector obstruction type that will be added/removed when a DtSetCollisionAvoidTypes message arrives that adds/removes trees avoidance.

By default, returns a spec of layer MAK040.

virtual double DtObstructionSensor::decelerationSoilFactor ( ) const [protected, virtual]
static DtSimComponent* DtObstructionSensor::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented in DtHumanObstructionSensor.

virtual bool DtObstructionSensor::createPorts ( ) [protected, virtual]

Creates, initializes, and adds to the port group, all the ports for this component.

Returns:
A boolean signifying success or failure.

Reimplemented from DtSimComponent.

virtual bool DtObstructionSensor::createPortGroups ( ) [protected, virtual]

Creates and adds all port groups for this component.

Returns:
A boolean signifying success or failure.

Reimplemented from DtSimComponent.


Member Data Documentation

Output Port Name: potential-collision-info
Output Port Description: Information about an impending potential collision with an entity or terrain vector data feature.


Output Port Range:
Output Port Default Value:
Output Group Parent: obstruction-info

Output Port Group Name: obstruction-info
Output Port Group Description:

Dt3dBoundingVolume* DtObstructionSensor::myCollisionBV [protected]

Container for state data associated with this component.

This state is saved and restored as part of a scenario (or checkpoint).


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)