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

Public Member Functions | |
| DtGroundCollisionAvoidanceController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtGroundCollisionAvoidanceController () |
| 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 void | avoidCollision (const DtCollision &potentialCollision) |
| Activates all automotive ports/groups and provides the necessary steering, brake, and throttle 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 | |
| DtGroundCollisionAvoidanceController () | |
| Default constructor; should not be called. | |
| DtGroundCollisionAvoidanceController (const DtGroundCollisionAvoidanceController &orig) | |
| copy constructor | |
| const DtGroundCollisionAvoidanceController & | operator= (const DtGroundCollisionAvoidanceController &orig) |
| assignment operator | |
| 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 (DtAutoTransmissionGear currentGear) |
| 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. | |
| bool | followingObstruction (const DtEntityIdentifier &entityID) const |
| Checks to see if the entity is currently tasked to follow the specified entity. | |
| 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. | |
| 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 () |
| Overridden to create myAutomotiveControlPortGroup. | |
| bool | createPorts () |
| Overridden to create the automotive ports. | |
Protected Attributes | |
| double | myClearingDistance |
| This is only used when clearing. | |
| bool | myAvoidingCollision |
| Dt3dBoundingVolume * | myCollisionBV |
| DtEntityIdentifier | myObjectId |
| bool | myHavePortGroup |
| DtString | myFollowEntityName |
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. | |
| DtInputPortGroup * | myCollisionAvoidancePortGroup |
| Input Port Group Name: collision-avoidance-control Input Port Group Description: | |
| DtStringInputPort * | myFollowEntityInputPort |
| Input Port Name: follow-entity-name Input Port Description: Check this port to see if any possible collision is with the entity we're suppose to follow Input Port Range: Input Port Default Value: . | |
| DtBooleanOutputPort * | myCollisionPort |
| Output Port Name: collision Output Port Description: Specifies if there's a collision occuring Output Port Range: Output Group Parent: . | |
DtGroundCollisionAvoidanceController is a controller that helps entities to avoid running into other entities and/or feature obstructions.
Uses Descriptor Type: DtGroundCollisionAvoidanceDescriptor
| DtGroundCollisionAvoidanceController::DtGroundCollisionAvoidanceController | ( | 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 DtGroundCollisionAvoidanceController::~DtGroundCollisionAvoidanceController | ( | ) | [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.
| DtGroundCollisionAvoidanceController::DtGroundCollisionAvoidanceController | ( | const DtGroundCollisionAvoidanceController & | orig | ) | [protected] |
copy constructor
| virtual bool DtGroundCollisionAvoidanceController::init | ( | ) | [virtual] |
Initializes the follow controller name, the object ID, and the collisionBV (bounding volume)
Reimplemented from DtGroundAutoControllerComponent.
| virtual void DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController::distanceSquaredToDestination | ( | DtVector | offsetVector | ) | [virtual] |
Calculates the distance squared from the current location (in local coords) to the destination, minus the specified offset vector.
| virtual void DtGroundCollisionAvoidanceController::avoidCollision | ( | const DtCollision & | potentialCollision | ) | [virtual] |
Activates all automotive ports/groups and provides the necessary steering, brake, and throttle values.
| obstruction | A pointer to a DtVrfObject to avoid. Assumed to be non-NULL. |
| virtual void DtGroundCollisionAvoidanceController::clearCollision | ( | ) | [virtual] |
This just cleans up some state variables when it's determined that an entity is no longer potentially colliding.
| virtual void DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController::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.
Reimplemented from DtGroundAutoControllerComponent.
| static DtSimComponent* DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController& DtGroundCollisionAvoidanceController::operator= | ( | const DtGroundCollisionAvoidanceController & | orig | ) | [protected] |
assignment operator
| bool DtGroundCollisionAvoidanceController::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.
| bool DtGroundCollisionAvoidanceController::setDefaultPortValuesForAvoidance | ( | DtAutoTransmissionGear | currentGear | ) | [protected] |
Sets the ports to appropriate default values.
| currentGear | The current gear of the entity. |
| bool DtGroundCollisionAvoidanceController::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. |
| bool DtGroundCollisionAvoidanceController::followingObstruction | ( | const DtEntityIdentifier & | entityID | ) | const [protected] |
Checks to see if the entity is currently tasked to follow the specified entity.
| void DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController::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.
| void DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController::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 DtGroundCollisionAvoidanceController::createPortGroups | ( | ) | [protected, virtual] |
Overridden to create myAutomotiveControlPortGroup.
Reimplemented from DtGroundAutoControllerComponent.
| bool DtGroundCollisionAvoidanceController::createPorts | ( | ) | [protected, virtual] |
Overridden to create the automotive ports.
Reimplemented from DtGroundAutoControllerComponent.
double DtGroundCollisionAvoidanceController::myClearingDistance [protected] |
This is only used when clearing.
Dt3dBoundingVolume* DtGroundCollisionAvoidanceController::myCollisionBV [protected] |
DtEntityIdentifier DtGroundCollisionAvoidanceController::myObjectId [protected] |
Input Port Name: potential-collision-info
Input Port Description:
Input Port Range:
Input Port Default Value:
Input Group Parent: collision-avoidance-control.
Input Port Group Name: collision-avoidance-control
Input Port Group Description:
Input Port Name: follow-entity-name
Input Port Description: Check this port to see if any possible collision is with the entity we're suppose to follow
Input Port Range:
Input Port Default Value:
.
Output Port Name: collision
Output Port Description: Specifies if there's a collision occuring Output Port Range:
Output Group Parent:
.