![]() |
VR-Forces 4.0.4 Class Documentation
|
DtGroundMoveToDestinationControllerComponent is a controller that provides a kinematics-based model of an automotive system that converts throttle, brake, and steering into orientation, acceleration, velocity, and position. More...

Public Member Functions | |
| DtGroundMoveToDestinationControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtGroundMoveToDestinationControllerComponent () |
| destructor | |
| virtual bool | init () |
| Initializes modifyVrfObjectCallback. | |
| virtual void | setComponentDescriptor (DtComponentDescriptor *componentDescriptor) |
| Overridden to cast and set our local pointer to the descriptor. | |
| virtual void | tick () |
| Looks at the value on myCollisionAvoidancePort, and if there is a value and the destination point is within the bounding volume of the collision object, setDestinationIsInsideObstruction(true) is called. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | processSetLocation (DtSimMessage *msg) |
| Resets the destination vector when the location of the entity to which this controller is attached is changed through a set location request. | |
| virtual void | processModifyVrfObject (DtSimMessage *msg) |
| Resets the destination vector when the location of the entity to which this controller is attached is changed through a DtIfModifyVrfObject message (i.e. | |
| virtual void | processSetStayInLane (DtSimMessage *msg) |
| Sets the stayInLane member of the PSR based on the contents of the message. | |
| virtual void | registerTaskMsgCallbacks () |
| Overridden to register interest in move to and set location commands. | |
| virtual bool | getDestination (DtVector &destination) |
| getDestination() | |
| virtual const DtVector & | destinationVector () const |
| Returns the current destination vector for the entity. | |
| virtual double | findDesiredSpeed () |
| Determines how fast we should go. | |
| virtual double | findDesiredHeading () |
| Determines the desired heading in the following manner: If the myNearDestination member variable is true (set by nearDestination()), the desired heading is in the opposite direction as the destination vector (described in setupDestinationVector()). | |
| virtual DtAutoTransmissionGearEnum | determineGearSetting () |
| Sets myProcessState->myCurrentGear to DtAutoGearReverse or DtAutoGearForward based on sign of orderedSpeed(). | |
| virtual bool | nearDestination () |
| Determines if the entity is close enough to the destination that it should start slowing down (see findDesiredSpeed()). | |
| virtual bool | atDestination () |
| Are we within the at-distance parameter to the destination? If the myDistanceSquared member calculated in tick() is less than or equal to the square of the value provided in the at-distance parameter of the DtGroundMoveToDescriptor, atDestination() sets myAtDestination to true. | |
| virtual bool | passedDestination () |
| Determines if the entity will pass the destination to which it is moving this frame if it continues at its current velocity and acceleration. | |
| virtual void | stop () |
| Set port values for stopping, and mark the task complete. | |
| virtual bool | findUsableRoad (double targetHeading) |
| Searches the vector network for nearby road vectors in the approximate direction of targetHeading. | |
| virtual double | calculateSteeringForRoad (double currentHeading) |
| Calculates the steering value needed to drive along the road currently specified in the PSR roadStartPoint and roadEndPoint. | |
| virtual void | doMoving () |
| Calls determineGearSetting(), findDesiredSpeed() and findDesiredHeading() and then sets port values based on those results. | |
Static Public Member Functions | |
| static void | setLocationCallback (DtSimMessage *msg, void *usr) |
| Calls processSetLocation. | |
| static void | modifyVrfObjectCallback (DtSimMessage *msg, void *usr) |
| Calls processModifyVrfObject. | |
| static void | setStayInLaneCallback (DtSimMessage *msg, void *usr) |
| Calls processSetStayInLane. | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual bool | setupDestination () |
| This function ensures that the destination stored in the process state matches the member function. | |
| virtual void | setupDestinationVector () const |
| Sets up a vector from the current destination location to the entity's location to use in determining when/if the entity has passed its destination location. | |
| virtual void | invalidateDestinationVector () const |
| Tells the component that any cached destination vector should be recalculated. | |
| virtual double | desiredHeadingFromDestination (const DtDcm &localToTopoDcm) |
| Given the destination, calculate the heading needed to reach that point. | |
| virtual void | moveToDestination () |
| Attempts to move to the destination location. Override to provide movement functionality. | |
| virtual double | distanceToDestination () const |
| virtual void | setupRoadMetric () |
| Creates a new DtRangeAndDirectionNetworkSegmentMetric and sets it up with parameters that will be used to search for roads if the entity is using roads. | |
| virtual bool | stayInLaneEnabled () |
| Retuns true if use of roads is allowed by this entity. | |
| virtual bool | decideToGiveUpTask () const |
| Checks to see if destination is inside an obstruction. | |
| virtual bool | createPortGroups () |
| Overridden to create myAutomotiveControlPortGroup. | |
| virtual bool | createPorts () |
| Overridden to create the automotive ports. | |
| virtual void | setDestinationIsInsideObstruction (bool yesNo) |
| Set whether or not current destination is inside an obstruction. | |
| virtual bool | destinationIsInsideObstruction () const |
| Returns whether or not current destination is inside an obstruction. | |
| virtual double | sideOfRoad () |
Protected Attributes | |
| double | myDistanceSquared |
| DtVector | myLocalDestination |
| DtVector | myWorldDestination |
| DtVector | myDestinationVector |
| bool | myDestinationVectorIsValid |
| double | myDesiredSpeed |
| double | myCurrentSpeed |
| bool | myAtDestination |
| bool | myNearDestination |
| bool | myPassedDestination |
| const DtGroundMoveToDescriptor * | myMoveToDescriptor |
| DtRangeAndDirectionNetworkSegmentMetric * | myRoadMetric |
| Metric used by findUsableRoad to search vector network. | |
| bool | myDestinationIsInsideObstruction |
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: | |
Private Member Functions | |
| DtGroundMoveToDestinationControllerComponent () | |
| Default constructor; should not be called. | |
| DtGroundMoveToDestinationControllerComponent (const DtGroundMoveToDestinationControllerComponent &orig) | |
| copy constructor; shallow; does not copy the ports. | |
| const DtGroundMoveToDestinationControllerComponent & | operator= (const DtGroundMoveToDestinationControllerComponent &orig) |
| assignment operator; see comments on copy constructor! | |
DtGroundMoveToDestinationControllerComponent is a controller that provides a kinematics-based model of an automotive system that converts throttle, brake, and steering into orientation, acceleration, velocity, and position.
End User Description: It moves the entity of which it is a part towards a user-specified (or other controller specified) destination. Additionally, if use-roads in enabled (either through a set-use-roads message or through the descriptor, this controller provides steering values to drive the vehicle along any road (as specified by vector features in the terrain) that falls on or very near its direct path to the destination, including maintaining a specified distance from the centerline of the road.
Uses Descriptor Type: DtGroundMoveToDescriptor
| DtGroundMoveToDestinationControllerComponent::DtGroundMoveToDestinationControllerComponent | ( | 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 DtGroundMoveToDestinationControllerComponent::~DtGroundMoveToDestinationControllerComponent | ( | ) | [virtual] |
destructor
| DtGroundMoveToDestinationControllerComponent::DtGroundMoveToDestinationControllerComponent | ( | ) | [private] |
Default constructor; should not be called.
Here because the compiler will generate an unprotected one otherwise.
| DtGroundMoveToDestinationControllerComponent::DtGroundMoveToDestinationControllerComponent | ( | const DtGroundMoveToDestinationControllerComponent & | orig | ) | [private] |
copy constructor; shallow; does not copy the ports.
| virtual bool DtGroundMoveToDestinationControllerComponent::init | ( | ) | [virtual] |
Initializes modifyVrfObjectCallback.
Reimplemented from DtGroundAutoControllerComponent.
| virtual void DtGroundMoveToDestinationControllerComponent::setComponentDescriptor | ( | DtComponentDescriptor * | componentDescriptor | ) | [virtual] |
Overridden to cast and set our local pointer to the descriptor.
Reimplemented from DtSimComponent.
| virtual void DtGroundMoveToDestinationControllerComponent::tick | ( | ) | [virtual] |
Looks at the value on myCollisionAvoidancePort, and if there is a value and the destination point is within the bounding volume of the collision object, setDestinationIsInsideObstruction(true) is called.
If setupDestination() returns true, then moveToDestination() is called, otherwise an error is printed.
Reimplemented from DtSimComponent.
Reimplemented in DtGroundMoveAlongControllerComponent.
| virtual DtString DtGroundMoveToDestinationControllerComponent::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.
Reimplemented in DtGroundMoveToControllerComponent, DtGroundPatrolRouteController, DtGroundFollowEntityController, DtGroundInterceptAndDestroyController, DtGroundPatrolBetweenController, DtGroundMoveToLocationControllerComponent, and DtGroundMoveAlongControllerComponent.
| static void DtGroundMoveToDestinationControllerComponent::setLocationCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Calls processSetLocation.
| virtual void DtGroundMoveToDestinationControllerComponent::processSetLocation | ( | DtSimMessage * | msg | ) | [virtual] |
Resets the destination vector when the location of the entity to which this controller is attached is changed through a set location request.
| static void DtGroundMoveToDestinationControllerComponent::modifyVrfObjectCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Calls processModifyVrfObject.
| virtual void DtGroundMoveToDestinationControllerComponent::processModifyVrfObject | ( | DtSimMessage * | msg | ) | [virtual] |
Resets the destination vector when the location of the entity to which this controller is attached is changed through a DtIfModifyVrfObject message (i.e.
a drag & drop in the front-end).
| static void DtGroundMoveToDestinationControllerComponent::setStayInLaneCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Calls processSetStayInLane.
| virtual void DtGroundMoveToDestinationControllerComponent::processSetStayInLane | ( | DtSimMessage * | msg | ) | [virtual] |
Sets the stayInLane member of the PSR based on the contents of the message.
If stayInLane is true, the entity will take advantage of roads along its movement path.
| static DtSimComponent* DtGroundMoveToDestinationControllerComponent::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). |
Reimplemented in DtGroundFollowEntityController, DtGroundMoveToControllerComponent, DtGroundPatrolBetweenController, DtGroundInterceptAndDestroyController, DtGroundMoveAlongControllerComponent, DtGroundPatrolRouteController, DerivedMoveToController, and DtGroundMoveToLocationControllerComponent.
| virtual void DtGroundMoveToDestinationControllerComponent::registerTaskMsgCallbacks | ( | ) | [virtual] |
Overridden to register interest in move to and set location commands.
Reimplemented from DtTaskControllerComponent.
Reimplemented in DtGroundFollowEntityController, DtGroundMoveToControllerComponent, DtGroundPatrolBetweenController, DtGroundInterceptAndDestroyController, DtGroundPatrolRouteController, DtGroundMoveToLocationControllerComponent, and DtGroundMoveAlongControllerComponent.
| virtual bool DtGroundMoveToDestinationControllerComponent::getDestination | ( | DtVector & | destination | ) | [virtual] |
| destination | the position this object is trying to drive to in local coordinates. |
| virtual const DtVector& DtGroundMoveToDestinationControllerComponent::destinationVector | ( | ) | const [virtual] |
Returns the current destination vector for the entity.
| virtual double DtGroundMoveToDestinationControllerComponent::findDesiredSpeed | ( | ) | [virtual] |
Determines how fast we should go.
If the myNearDestination member variable is true (set by nearDestination()), the desired speed is the value of the approachSpeed parameter in the DtGroundMoveToDescriptor. If the entity is in reverse gear, then that approach speed is negated. If myNearDestination is false, then the entity�s ordered speed is returned.
Reimplemented in DtGroundMoveAlongControllerComponent, DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual double DtGroundMoveToDestinationControllerComponent::findDesiredHeading | ( | ) | [virtual] |
Determines the desired heading in the following manner: If the myNearDestination member variable is true (set by nearDestination()), the desired heading is in the opposite direction as the destination vector (described in setupDestinationVector()).
If the myNearDestination member variable is false, it calls headingAngleTo() to find the heading from the entity to the destination. In either case, if the current gear is DtAutoGearReverse, PI is added to heading before it is returned.
Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual DtAutoTransmissionGearEnum DtGroundMoveToDestinationControllerComponent::determineGearSetting | ( | ) | [virtual] |
Sets myProcessState->myCurrentGear to DtAutoGearReverse or DtAutoGearForward based on sign of orderedSpeed().
If ordered speed is negative, DtAutoGearReverse is returned. If ordered speed is positive, DtAutoGearForward is returned. In either case, the member variable myProcessState->myCurrentGear is set to the appropriate value.
Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual bool DtGroundMoveToDestinationControllerComponent::nearDestination | ( | ) | [virtual] |
Determines if the entity is close enough to the destination that it should start slowing down (see findDesiredSpeed()).
nearDestination() calls calculateCurrentBrakingDistance(). If the myDistanceSquared member calculated in tick() is less than or equal to the square of the value provided in the near-distance parameter of the DtGroundMoveToDescriptor, or if it is less than the square of the current braking distance, nearDestination() sets myNearDestination to true. If the above is not true, nearDestination() sets myNearDestination to false. myNearDestination is returned to the calling function.
Reimplemented in DtGroundInterceptAndDestroyController.
| virtual bool DtGroundMoveToDestinationControllerComponent::atDestination | ( | ) | [virtual] |
Are we within the at-distance parameter to the destination? If the myDistanceSquared member calculated in tick() is less than or equal to the square of the value provided in the at-distance parameter of the DtGroundMoveToDescriptor, atDestination() sets myAtDestination to true.
If the myDistanceSquared !<= at-distance, atDestination() sets myAtDestination to false. myAtDestination is returned to the calling function.
Reimplemented in DtGroundInterceptAndDestroyController.
| virtual bool DtGroundMoveToDestinationControllerComponent::passedDestination | ( | ) | [virtual] |
Determines if the entity will pass the destination to which it is moving this frame if it continues at its current velocity and acceleration.
It dead-reckons its position. It calculates the vector that points from the entity to the destination It finds the dot product between this vector and destination vector, If that dot product is greater than 0.0, the entity will pass the destinationthis tick if it does not stop. myPassedDestination is set, and the value is returned to the calling function.
Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual void DtGroundMoveToDestinationControllerComponent::stop | ( | ) | [virtual] |
Set port values for stopping, and mark the task complete.
Reimplemented in DtGroundInterceptAndDestroyController, DtGroundFollowEntityController, DtGroundMoveAlongControllerComponent, DtGroundPatrolBetweenController, and DtGroundPatrolRouteController.
| virtual bool DtGroundMoveToDestinationControllerComponent::findUsableRoad | ( | double | targetHeading | ) | [virtual] |
Searches the vector network for nearby road vectors in the approximate direction of targetHeading.
If found, returns true and sets roadStartPoint and roadEndPoint in the PSR.
| virtual double DtGroundMoveToDestinationControllerComponent::calculateSteeringForRoad | ( | double | currentHeading | ) | [virtual] |
Calculates the steering value needed to drive along the road currently specified in the PSR roadStartPoint and roadEndPoint.
| virtual void DtGroundMoveToDestinationControllerComponent::doMoving | ( | ) | [virtual] |
Calls determineGearSetting(), findDesiredSpeed() and findDesiredHeading() and then sets port values based on those results.
| virtual bool DtGroundMoveToDestinationControllerComponent::setupDestination | ( | ) | [protected, virtual] |
This function ensures that the destination stored in the process state matches the member function.
Also calculates the destination in local coordinates from the world coordinates.
Reimplemented in DtGroundFollowEntityController, DtGroundMoveAlongControllerComponent, DtGroundMoveToControllerComponent, and DtGroundInterceptAndDestroyController.
| virtual void DtGroundMoveToDestinationControllerComponent::setupDestinationVector | ( | ) | const [protected, virtual] |
Sets up a vector from the current destination location to the entity's location to use in determining when/if the entity has passed its destination location.
This is done by subtracting the DtVector representing the destination's position from the one representing the entity�s position.
Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual void DtGroundMoveToDestinationControllerComponent::invalidateDestinationVector | ( | ) | const [protected, virtual] |
Tells the component that any cached destination vector should be recalculated.
| virtual double DtGroundMoveToDestinationControllerComponent::desiredHeadingFromDestination | ( | const DtDcm & | localToTopoDcm | ) | [protected, virtual] |
Given the destination, calculate the heading needed to reach that point.
| virtual void DtGroundMoveToDestinationControllerComponent::moveToDestination | ( | ) | [protected, virtual] |
Attempts to move to the destination location. Override to provide movement functionality.
Reimplemented in DtGroundInterceptAndDestroyController.
| virtual double DtGroundMoveToDestinationControllerComponent::distanceToDestination | ( | ) | const [protected, virtual] |
| virtual void DtGroundMoveToDestinationControllerComponent::setupRoadMetric | ( | ) | [protected, virtual] |
Creates a new DtRangeAndDirectionNetworkSegmentMetric and sets it up with parameters that will be used to search for roads if the entity is using roads.
| virtual bool DtGroundMoveToDestinationControllerComponent::stayInLaneEnabled | ( | ) | [protected, virtual] |
Retuns true if use of roads is allowed by this entity.
Checks the PSR for use-roads. If that is not specified, checks the descriptor, and reutrns that value.
| virtual bool DtGroundMoveToDestinationControllerComponent::decideToGiveUpTask | ( | ) | const [protected, virtual] |
Checks to see if destination is inside an obstruction.
If it is, returns true. Otherwise it returns the value of DtGroundAutoControllerComponent::decideToGiveUpTask()
Reimplemented from DtGroundAutoControllerComponent.
Reimplemented in DtGroundMoveAlongControllerComponent, and DerivedMoveToController.
| virtual bool DtGroundMoveToDestinationControllerComponent::createPortGroups | ( | ) | [protected, virtual] |
Overridden to create myAutomotiveControlPortGroup.
Reimplemented from DtGroundAutoControllerComponent.
| virtual bool DtGroundMoveToDestinationControllerComponent::createPorts | ( | ) | [protected, virtual] |
Overridden to create the automotive ports.
Reimplemented from DtGroundAutoControllerComponent.
Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.
| virtual void DtGroundMoveToDestinationControllerComponent::setDestinationIsInsideObstruction | ( | bool | yesNo | ) | [protected, virtual] |
Set whether or not current destination is inside an obstruction.
This should be reevaluated each tick.
| virtual bool DtGroundMoveToDestinationControllerComponent::destinationIsInsideObstruction | ( | ) | const [protected, virtual] |
Returns whether or not current destination is inside an obstruction.
| virtual double DtGroundMoveToDestinationControllerComponent::sideOfRoad | ( | ) | [protected, virtual] |
| const DtGroundMoveToDestinationControllerComponent& DtGroundMoveToDestinationControllerComponent::operator= | ( | const DtGroundMoveToDestinationControllerComponent & | orig | ) | [private] |
assignment operator; see comments on copy constructor!
Reimplemented in DtGroundMoveToLocationControllerComponent.
double DtGroundMoveToDestinationControllerComponent::myDistanceSquared [protected] |
DtVector DtGroundMoveToDestinationControllerComponent::myDestinationVector [mutable, protected] |
bool DtGroundMoveToDestinationControllerComponent::myDestinationVectorIsValid [mutable, protected] |
double DtGroundMoveToDestinationControllerComponent::myDesiredSpeed [protected] |
double DtGroundMoveToDestinationControllerComponent::myCurrentSpeed [protected] |
const DtGroundMoveToDescriptor* DtGroundMoveToDestinationControllerComponent::myMoveToDescriptor [protected] |
DtRangeAndDirectionNetworkSegmentMetric* DtGroundMoveToDestinationControllerComponent::myRoadMetric [protected] |
Metric used by findUsableRoad to search vector network.
DtCollisionInputPort* DtGroundMoveToDestinationControllerComponent::myCollisionAvoidancePort [protected] |
Input Port Name: potential-collision-info
Input Port Description:
Input Port Range:
Input Port Default Value:
Input Group Parent: collision-avoidance-control.
DtInputPortGroup* DtGroundMoveToDestinationControllerComponent::myCollisionAvoidancePortGroup [protected] |
Input Port Group Name: collision-avoidance-control
Input Port Group Description: