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

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...

Inheritance diagram for DtGroundMoveToDestinationControllerComponent:
Inheritance graph
[legend]

List of all members.

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 DtVectordestinationVector () 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 DtSimComponentcreator (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 DtGroundMoveToDescriptormyMoveToDescriptor
DtRangeAndDirectionNetworkSegmentMetricmyRoadMetric
 Metric used by findUsableRoad to search vector network.
bool myDestinationIsInsideObstruction
Ports and Port Groups
DtCollisionInputPortmyCollisionAvoidancePort
 Input Port Name: potential-collision-info
Input Port Description:
Input Port Range:
Input Port Default Value:
Input Group Parent: collision-avoidance-control.
DtInputPortGroupmyCollisionAvoidancePortGroup
 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!

Detailed Description

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


Constructor & Destructor Documentation

(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

Default constructor; should not be called.

Here because the compiler will generate an unprotected one otherwise.

copy constructor; shallow; does not copy the ports.


Member Function Documentation

Initializes modifyVrfObjectCallback.

Reimplemented from DtGroundAutoControllerComponent.

Overridden to cast and set our local pointer to the descriptor.

Reimplemented from DtSimComponent.

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.

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:
DtGroundAutoMoveToDestinationType

Reimplemented from DtGroundAutoControllerComponent.

Reimplemented in DtGroundMoveToControllerComponent, DtGroundPatrolRouteController, DtGroundFollowEntityController, DtGroundInterceptAndDestroyController, DtGroundPatrolBetweenController, DtGroundMoveToLocationControllerComponent, and DtGroundMoveAlongControllerComponent.

static void DtGroundMoveToDestinationControllerComponent::setLocationCallback ( DtSimMessage msg,
void *  usr 
) [static]

Calls processSetLocation.

Resets the destination vector when the location of the entity to which this controller is attached is changed through a set location request.

Calls processModifyVrfObject.

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).

Calls processSetStayInLane.

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*,

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 DtGroundFollowEntityController, DtGroundMoveToControllerComponent, DtGroundPatrolBetweenController, DtGroundInterceptAndDestroyController, DtGroundMoveAlongControllerComponent, DtGroundPatrolRouteController, DerivedMoveToController, and DtGroundMoveToLocationControllerComponent.

getDestination()

Parameters:
destinationthe position this object is trying to drive to in local coordinates.
Returns:
true if it has a valid destination () or false if it is unable to determine it's destination.
Note:
Used by other areas of the simulation to determine where this object is going. (Information)

Returns the current destination vector for the entity.

Note:
if the destination vector is currently invalidated, it recalculates it and sets it to valid.
See also:
setupDestinationVector

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.

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.

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.

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.

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.

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 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.

Calls determineGearSetting(), findDesiredSpeed() and findDesiredHeading() and then sets port values based on those results.

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.

Note:
Users should not use this function directly,and should instead use the invalidateDestinationVector and destinationVector functions. Should be a protected or even private function, but was left public to maintain the interface.

Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.

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.

Attempts to move to the destination location. Override to provide movement functionality.

Reimplemented in DtGroundInterceptAndDestroyController.

virtual double DtGroundMoveToDestinationControllerComponent::distanceToDestination ( ) const [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.

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.

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.

Overridden to create myAutomotiveControlPortGroup.

Reimplemented from DtGroundAutoControllerComponent.

Overridden to create the automotive ports.

Reimplemented from DtGroundAutoControllerComponent.

Reimplemented in DtGroundInterceptAndDestroyController, and DtGroundFollowEntityController.

Set whether or not current destination is inside an obstruction.

This should be reevaluated each tick.

Returns whether or not current destination is inside an obstruction.

Returns:
myDestinationIsInsideObstruction
virtual double DtGroundMoveToDestinationControllerComponent::sideOfRoad ( ) [protected, virtual]
const DtGroundMoveToDestinationControllerComponent& DtGroundMoveToDestinationControllerComponent::operator= ( const DtGroundMoveToDestinationControllerComponent orig) [private]

assignment operator; see comments on copy constructor!

Reimplemented in DtGroundMoveToLocationControllerComponent.


Member Data Documentation

Metric used by findUsableRoad to search vector network.

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:


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)