![]() |
VR-Forces 4.0.4 Class Documentation
|
DtHumanCollisionAvoidanceController is a controller that helps entities to avoid running into other entities and/or feature obstructions. More...

Public Member Functions | |
| DtHumanCollisionAvoidanceController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtHumanCollisionAvoidanceController () |
| Destructor. | |
| virtual bool | init () |
| Initializes the follow controller name, the object ID, and the collisionBV (bounding volume) | |
| virtual void | tick () |
| Calculate new control values based on potential collisions. | |
| virtual double | distanceSquaredToDestination (DtVector offsetVector) |
| Calculates the distance squared from the current location (in local coords) to the destination, minus the specified offset vector. | |
| virtual bool | isInsideObstruction (const DtCollision *potentialCollision, double &clearingDistance) |
| Determine if the entity is inside the potential obstruction. | |
| virtual void | avoidCollision (const DtCollision &potentialCollision) |
| Activates all control ports/groups and provides the necessary speed, direction, and heading values. | |
| virtual void | clearCollision () |
| This just cleans up some state variables when it's determined that an entity is no longer potentially colliding. | |
| virtual void | clearingCollision () |
| Moves the vehicle in a straight line for the defined clearingDistance after it is no longer at risk of colliding with the obstruction. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| DtHumanCollisionAvoidanceController () | |
| Default constructor; should not be called. | |
| DtHumanCollisionAvoidanceController (const DtHumanCollisionAvoidanceController &orig) | |
| copy constructor | |
| const DtHumanCollisionAvoidanceController & | operator= (const DtHumanCollisionAvoidanceController &orig) |
| assignment operator | |
| virtual void | registerTaskMsgCallbacks () |
| Override for interest in task complete messages, we care about stopMoving tasks. | |
| virtual void | processTaskComplete (DtSimMessage *msg) |
| bool | isAppreciablyMoving (DtVector velocity, double velocityTolerance) const |
| If the magnitude of any component of the velocity is greater than the velocity tolerance, then the entity is considered appreciably moving. | |
| bool | setDefaultPortValuesForAvoidance () |
| Sets the ports to appropriate default values. | |
| bool | determineObstructionMovementDirection (DtDcm obstructionLocalOrientationMatrix, const DtVector &obstructionVelocity, int &obstructionDirectionSign) const |
| Determines if the obstruction is moving forward or in reverse. | |
| void | avoidMovingObstruction (const DtCollision &potentialCollision) |
| Calculates and sets control values for avoiding a moving obstruction based on obstruction's relative movement (head-on, in front of, etc.) If the obstruction is moving in roughly the same direction, and the entity is in front, it does nothing. | |
| void | avoidNonMovingObstruction (const DtCollision &potentialCollision) |
| Calculates control values for avoiding a non-moving obstruction. | |
| virtual void | calculateAvoidanceByVertices (const DtVector &vertex1, const DtVector &vertex2, double entityBoundingVolumeRadius, DtVector &localVectorToDestination, DtVector &localVectorToObstruciton) |
| Calculates control values for avoiding using the vertices that define the obstruction. | |
| virtual void | calculateAvoidanceUsingExtent (DtExtent &extent, double entityBoundingVolumeRadius, DtVector &localVectorToDestination, DtVector &localVectorToObstruciton) |
| Calculates control values for avoiding using the extent of the obstruction-- Useful for point vector features. | |
| virtual void | calculateAvoidanceUsingBoundingVolume (const DtCollision &potentialCollision, double entityBoundingVolumeRadius, DtVector &localVectorToDestination, DtVector &localVectorToObstruciton) |
| Calculates very rough control values for avoiding using the bounding volume. | |
| void | startClearingCollision (double clearingDistance) |
| Sets state as appropriate for clearing a collision and then starts clearing the collision. | |
| bool | calculateCollisionBV () |
| Calculates a bounding volume representing the potential collision volume occupied by the entity. | |
| bool | createPortGroups () |
| Called by init. | |
| bool | createPorts () |
| Called by init. | |
| virtual bool | createPSR () |
| Creates myProcessState data member, and adds it to our process state repository manager. | |
| virtual void | computeClearingHeading (const DtVector &localVertex1, const DtVector &localVertex2, const DtVector &localObstaclePos, double &clearingHeading) const |
| virtual void | getObstructionFootprint (const DtCollision &collision, DtLocalVertexList &localObstructionFootprint) const |
Static Protected Member Functions | |
| static void | taskCompleteReportCallback (DtSimMessage *msg, void *usr) |
| Monitor taskReportComplete callback to see when entity stops moving during an embarkation task so we can stop collision avoiding. | |
Protected Attributes | |
| double | myClearingDistance |
| This is only used when clearing. | |
| bool | myAvoidingCollision |
| Dt3dBoundingVolume * | myCollisionBV |
| DtEntityIdentifier | myObjectId |
| bool | myHavePortGroup |
| DtHumanStateRepository * | myLifeformState |
| DtHumanCollisionAvoidancePSR * | myProcessState |
| Container for state data associated with this component. | |
| double | myTimeToCollide |
| The minimum time before a collision (in seconds) which the collision avoidance controller compares to its own estimate of the time before a rear end collision to determine when to apply the brakes. | |
| double | myLateralClearance |
| The width (in meters) added to the length of the bounding volume which is checked for potential collisions. | |
| double | myStoppingDistanceFactor |
| The factor by which the collision avoidance controller multiplies the current stopping distance to determine the length of the bounding volume which is checked for potential collisions. | |
| DtVector | myNonMvObstructionLocation |
Ports and Port Groups | |
| DtCollisionInputPort * | myCollisionAvoidancePort |
| Input Port Name: potential-collision-info Input Port Description: Input Port Range: Input Port Default Value: Input Group Parent: collision-avoidance-control. | |
| DtVectorInputPort * | myDestinationInputPort |
| Output Port Name: destination Output Port Description: Specifies the current destination of the entity in geocentric coordiantes. | |
| DtInputPortGroup * | myCollisionAvoidancePortGroup |
| Input Port Group Name: collision-avoidance-control Input Port Group Description: | |
| DtHumanMovementControlOutputPortGroup * | myHumanMovementControlOutputPortGroup |
| Output Group Name: movement-control . | |
| DtBooleanOutputPort * | myCollisionPort |
| Output Port Name: collision Output Port Description: Specifies if there's a collision occuring Output Port Range: Output Group Parent: . | |
DtHumanCollisionAvoidanceController is a controller that helps entities to avoid running into other entities and/or feature obstructions.
Uses Descriptor Type: DtComponentDescriptor
| DtHumanCollisionAvoidanceController::DtHumanCollisionAvoidanceController | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtHumanCollisionAvoidanceController::~DtHumanCollisionAvoidanceController | ( | ) | [virtual] |
Destructor.
Cleans up any allocated ports/port groups, and bounding volumes.
Default constructor; should not be called.
Here because the compiler will generate an unprotected one otherwise.
| DtHumanCollisionAvoidanceController::DtHumanCollisionAvoidanceController | ( | const DtHumanCollisionAvoidanceController & | orig | ) | [protected] |
copy constructor
| virtual bool DtHumanCollisionAvoidanceController::init | ( | ) | [virtual] |
Initializes the follow controller name, the object ID, and the collisionBV (bounding volume)
Reimplemented from DtControllerComponent.
| virtual void DtHumanCollisionAvoidanceController::tick | ( | ) | [virtual] |
Calculate new control values based on potential collisions.
If the controller has received potential collision data, then it acts to avoid a collision. If it does not receive collision data, but has on the previous tick, then the controller starts clearing the collision.
Reimplemented from DtSimComponent.
| virtual double DtHumanCollisionAvoidanceController::distanceSquaredToDestination | ( | DtVector | offsetVector | ) | [virtual] |
Calculates the distance squared from the current location (in local coords) to the destination, minus the specified offset vector.
| virtual bool DtHumanCollisionAvoidanceController::isInsideObstruction | ( | const DtCollision * | potentialCollision, |
| double & | clearingDistance | ||
| ) | [virtual] |
Determine if the entity is inside the potential obstruction.
Returns the necessary clearing distance if we are inside the obstruction.
| virtual void DtHumanCollisionAvoidanceController::avoidCollision | ( | const DtCollision & | potentialCollision | ) | [virtual] |
Activates all control ports/groups and provides the necessary speed, direction, and heading values.
| obstruction | A pointer to a DtVrfObject to avoid. Assumed to be non-NULL. |
| virtual void DtHumanCollisionAvoidanceController::clearCollision | ( | ) | [virtual] |
This just cleans up some state variables when it's determined that an entity is no longer potentially colliding.
| virtual void DtHumanCollisionAvoidanceController::clearingCollision | ( | ) | [virtual] |
Moves the vehicle in a straight line for the defined clearingDistance after it is no longer at risk of colliding with the obstruction.
This is done to keep the vehicle from turning back to the goal too soon, which would cause a jitter as the vehicle went in and out of the collision state.
| virtual DtString DtHumanCollisionAvoidanceController::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.
Implements DtTaskControllerComponent.
| static DtSimComponent* DtHumanCollisionAvoidanceController::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| const DtHumanCollisionAvoidanceController& DtHumanCollisionAvoidanceController::operator= | ( | const DtHumanCollisionAvoidanceController & | orig | ) | [protected] |
assignment operator
| virtual void DtHumanCollisionAvoidanceController::registerTaskMsgCallbacks | ( | ) | [protected, virtual] |
Override for interest in task complete messages, we care about stopMoving tasks.
Reimplemented from DtTaskControllerComponent.
| static void DtHumanCollisionAvoidanceController::taskCompleteReportCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static, protected] |
Monitor taskReportComplete callback to see when entity stops moving during an embarkation task so we can stop collision avoiding.
| virtual void DtHumanCollisionAvoidanceController::processTaskComplete | ( | DtSimMessage * | msg | ) | [protected, virtual] |
| bool DtHumanCollisionAvoidanceController::isAppreciablyMoving | ( | DtVector | velocity, |
| double | velocityTolerance | ||
| ) | const [protected] |
If the magnitude of any component of the velocity is greater than the velocity tolerance, then the entity is considered appreciably moving.
Sets the ports to appropriate default values.
| bool DtHumanCollisionAvoidanceController::determineObstructionMovementDirection | ( | DtDcm | obstructionLocalOrientationMatrix, |
| const DtVector & | obstructionVelocity, | ||
| int & | obstructionDirectionSign | ||
| ) | const [protected] |
Determines if the obstruction is moving forward or in reverse.
| obstructionDirectionSign | A reference to an integer representing the direction of movement: 1 for forward, -1 for reverse. |
| void DtHumanCollisionAvoidanceController::avoidMovingObstruction | ( | const DtCollision & | potentialCollision | ) | [protected] |
Calculates and sets control values for avoiding a moving obstruction based on obstruction's relative movement (head-on, in front of, etc.) If the obstruction is moving in roughly the same direction, and the entity is in front, it does nothing.
If it is behind, and following the entity, then it lets the follow entity controller take over. If not following the entity, then it slows down to avoid a collision.
If the obstruction is coming head on, then the entity attempts to turn out of the way as if the obstruction was a non-moving entity.
| void DtHumanCollisionAvoidanceController::avoidNonMovingObstruction | ( | const DtCollision & | potentialCollision | ) | [protected] |
Calculates control values for avoiding a non-moving obstruction.
If the entity is not following the obstruction, and the entity can turn, it turns to the opposite direction of the obstruction's location to the entity. (i.e. if the obstruction is on the right, the entity turns to the left.) Otherwise, the entity stops, since either the leader has stopped or it is unable to turn.
| virtual void DtHumanCollisionAvoidanceController::calculateAvoidanceByVertices | ( | const DtVector & | vertex1, |
| const DtVector & | vertex2, | ||
| double | entityBoundingVolumeRadius, | ||
| DtVector & | localVectorToDestination, | ||
| DtVector & | localVectorToObstruciton | ||
| ) | [protected, virtual] |
Calculates control values for avoiding using the vertices that define the obstruction.
This is used with objects that have at least 2 vertices
| virtual void DtHumanCollisionAvoidanceController::calculateAvoidanceUsingExtent | ( | DtExtent & | extent, |
| double | entityBoundingVolumeRadius, | ||
| DtVector & | localVectorToDestination, | ||
| DtVector & | localVectorToObstruciton | ||
| ) | [protected, virtual] |
Calculates control values for avoiding using the extent of the obstruction-- Useful for point vector features.
| virtual void DtHumanCollisionAvoidanceController::calculateAvoidanceUsingBoundingVolume | ( | const DtCollision & | potentialCollision, |
| double | entityBoundingVolumeRadius, | ||
| DtVector & | localVectorToDestination, | ||
| DtVector & | localVectorToObstruciton | ||
| ) | [protected, virtual] |
Calculates very rough control values for avoiding using the bounding volume.
| void DtHumanCollisionAvoidanceController::startClearingCollision | ( | double | clearingDistance | ) | [protected] |
Sets state as appropriate for clearing a collision and then starts clearing the collision.
| clearingDistance | The distance the entity will move before it considers itself of having fully avoided the collision. This is to prevent entities from immediately turning back into the path of the potential collision once initially avoided it. |
| bool DtHumanCollisionAvoidanceController::calculateCollisionBV | ( | ) | [protected] |
Calculates a 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.
| bool DtHumanCollisionAvoidanceController::createPortGroups | ( | ) | [protected, virtual] |
Called by init.
Derived classes should override this method to create all their input/output port groups.
Reimplemented from DtSimComponent.
| bool DtHumanCollisionAvoidanceController::createPorts | ( | ) | [protected, virtual] |
Called by init.
Derived classes should override this method to create all their input/output ports and port groups.
Reimplemented from DtSimComponent.
| virtual bool DtHumanCollisionAvoidanceController::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 void DtHumanCollisionAvoidanceController::computeClearingHeading | ( | const DtVector & | localVertex1, |
| const DtVector & | localVertex2, | ||
| const DtVector & | localObstaclePos, | ||
| double & | clearingHeading | ||
| ) | const [protected, virtual] |
| virtual void DtHumanCollisionAvoidanceController::getObstructionFootprint | ( | const DtCollision & | collision, |
| DtLocalVertexList & | localObstructionFootprint | ||
| ) | const [protected, virtual] |
double DtHumanCollisionAvoidanceController::myClearingDistance [protected] |
This is only used when clearing.
Dt3dBoundingVolume* DtHumanCollisionAvoidanceController::myCollisionBV [protected] |
DtEntityIdentifier DtHumanCollisionAvoidanceController::myObjectId [protected] |
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).
Input Port Name: potential-collision-info
Input Port Description:
Input Port Range:
Input Port Default Value:
Input Group Parent: collision-avoidance-control.
Output Port Name: destination
Output Port Description: Specifies the current destination of the entity in geocentric coordiantes.
Output Port Range:
Output Group Parent:
Input Port Group Name: collision-avoidance-control
Input Port Group Description:
DtHumanMovementControlOutputPortGroup* DtHumanCollisionAvoidanceController::myHumanMovementControlOutputPortGroup [protected] |
Output Group Name: movement-control
.
Output Port Name: collision
Output Port Description: Specifies if there's a collision occuring Output Port Range:
Output Group Parent:
.
double DtHumanCollisionAvoidanceController::myTimeToCollide [protected] |
The minimum time before a collision (in seconds) which the collision avoidance controller compares to its own estimate of the time before a rear end collision to determine when to apply the brakes.
Parameter Default Value: 0.0
Parameter Units: seconds
double DtHumanCollisionAvoidanceController::myLateralClearance [protected] |
The width (in meters) added to the length of the bounding volume which is checked for potential collisions.
Parameter Default Value: 0.25
Parameter Units: meters
double DtHumanCollisionAvoidanceController::myStoppingDistanceFactor [protected] |
The factor by which the collision avoidance controller multiplies the current stopping distance to determine the length of the bounding volume which is checked for potential collisions.
Parameter Default Value: 1.0