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

DtHumanMoveAlongController is a controller that models movement to a <location> or <waypoint> for individual human entities. More...

Inheritance diagram for DtHumanMoveToController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtHumanMoveToController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 Constructor.
virtual ~DtHumanMoveToController ()
 Destructor.
virtual bool init ()
 Init. Call immediately after construction.
virtual DtString type () const
virtual void tick ()
 This components simulation tick.

Static Public Member Functions

static void moveToCallback (DtSimMessage *msg, void *usr)
 Callback function that handles DtMoveToType tasks.
static void setLocationCallback (DtSimMessage *msg, void *usr)
 Callback function that handles DtSetLocationRequest set data requests.
static void moveToLocationCallback (DtSimMessage *msg, void *usr)
 Callback function that handles DtMoveToLocation tasks.
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 Static creator function for factory registration.
static void modifyVrfObjectCallback (DtSimMessage *msg, void *usr)
 Calls processModifyVrfObject.

Protected Member Functions

virtual void processMoveToTask (DtSimMessage *msg)
 Sets world destination from the task.
virtual void processMoveToLocationTask (DtSimMessage *msg)
virtual void processDestinationChanged ()
 Ensures that the destination stored in the ProcessStateRepository is consistent with the location of the destination control point.
virtual bool setupDestination ()
 Look up the control point by name and set the myControlPoint member to point to it.
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 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 void doMoving ()
 Calls findDesiredHeading() and then sets port values based on those results.
virtual double findDesiredHeading ()
 Determines the desired heading.
virtual void moveToDestination ()
 Attempts to move to the destination location. Override to provide movement functionality.
virtual void stop ()
 Set port values for stopping, and mark the task complete.
virtual void registerTaskMsgCallbacks ()
 Overridden to register interest in move to messages.
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 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 bool createPortGroups ()
 Creates and initializes port groups.
virtual bool createPorts ()
 Creates myDestinationOutputPort.
virtual bool createPSR ()
 Creates myProcessState data member, and adds it to our process state repository manager.
virtual double distanceToDestination () const
virtual void clearTask ()
 Override to deactivate myHumanMovementControlOutputPortGroup.
virtual bool destinationIsInsideObstruction (const DtVector &localDestination) const
 Returns whether or not current destination is inside an obstruction.
virtual bool decideToGiveUpTask () const
 Checks to see if destination is inside an obstruction.
virtual double atDistance () const
 Maximum distance at which entity is considered to be 'at' goal.

Protected Attributes

DtVrfObjectmyControlPoint
 This is looked up once per tick - assumed unchanging while we have control.
DtVector myLocalDestination
DtVector myWorldDestination
DtVector myDestinationVector
bool myDestinationVectorIsValid
bool myAtDestination
double myDistanceSquared
DtHumanStateRepositorymyHumanStateRepository
DtHumanMoveToPSRmyProcessState
 Container for state data associated with this component.
DtHumanMoveToControllerDescriptormyHumanMoveToControllerDescriptor
Ports and Port Groups
DtCollisionInputPortmyCollisionAvoidancePort
 Input Port Name: potential-collision-info
Input Port Description: information about an impending potential collision with an entity or terrain vector data feature.
DtInputPortGroupmyCollisionAvoidancePortGroup
 Input Port Group Name: collision-avoidance-control
Input Port Group Description:
DtHumanMovementControlOutputPortGroupmyHumanMovementControlOutputPortGroup
 Output Group Name: movement-control
.
DtVectorOutputPortmyDestinationOutputPort
 Output Port Name: destination
Output Port Description: Specifies the current destination of the entity in geocentric coordiantes.

Private Member Functions

 DtHumanMoveToController ()
 Not Implemented.
 DtHumanMoveToController (const DtHumanMoveToController &orig)
 Not Implemented.
DtHumanMoveToControlleroperator= (const DtHumanMoveToController &orig)
 Not Implemented.

Detailed Description

DtHumanMoveAlongController is a controller that models movement to a <location> or <waypoint> for individual human entities.

Developer Description: DtHumanMoveToController models move-to behavior for individual humans. It generates speed and heading controls that direct the entity to to its destination at the entity's current ordered speed. It responds to DtMoveToType and DtMoveToLocationTaskType tasks. Component OPD Name: "human-move-to-controller"

Uses Descriptor Type: DtHumanMoveToControllerDescriptor


Constructor & Destructor Documentation

Not Implemented.

Not Implemented.

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

Constructor.

Destructor.


Member Function Documentation

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

Not Implemented.

virtual bool DtHumanMoveToController::init ( ) [virtual]

Init. Call immediately after construction.

Reimplemented from DtControllerComponent.

virtual DtString DtHumanMoveToController::type ( ) const [virtual]
Returns:
DtHumanMoveToControllerType

Implements DtTaskControllerComponent.

virtual void DtHumanMoveToController::tick ( ) [virtual]

This components simulation tick.

Reimplemented from DtSimComponent.

static void DtHumanMoveToController::moveToCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callback function that handles DtMoveToType tasks.

Calls processMoveToTask().

Parameters:
msgMessage containing DtMoveToTask.
usrPointer to an instance of this class.
static void DtHumanMoveToController::setLocationCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callback function that handles DtSetLocationRequest set data requests.

Calls processSetLocation().

Parameters:
msgMessage containing DtSetLocationRequest.
usrPointer to an instance of this class.
static void DtHumanMoveToController::moveToLocationCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callback function that handles DtMoveToLocation tasks.

Calls processMoveToLocationTask().

Parameters:
msgMessage containing DtMoveToLocationTask.
usrPointer to an instance of this class.
static DtSimComponent* DtHumanMoveToController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

Static creator function for factory registration.

static void DtHumanMoveToController::modifyVrfObjectCallback ( DtSimMessage msg,
void *  usr 
) [static]

Calls processModifyVrfObject.

virtual void DtHumanMoveToController::processMoveToTask ( DtSimMessage msg) [protected, virtual]

Sets world destination from the task.

Parameters:
msgMessage containing a DtMoveToTask.
virtual void DtHumanMoveToController::processMoveToLocationTask ( DtSimMessage msg) [protected, virtual]
virtual void DtHumanMoveToController::processDestinationChanged ( ) [protected, virtual]

Ensures that the destination stored in the ProcessStateRepository is consistent with the location of the destination control point.

Intended to be called only when the position of the control point has changed.

Note:
Also invalidates the destination vector as the world position has changed.
virtual bool DtHumanMoveToController::setupDestination ( ) [protected, virtual]

Look up the control point by name and set the myControlPoint member to point to it.

Detects changes in the target point using myControlPointLastLocation and calls processWaypointChanged().

virtual void DtHumanMoveToController::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.
virtual void DtHumanMoveToController::invalidateDestinationVector ( ) const [protected, virtual]

Tells the component that any cached destination vector should be recalculated.

virtual bool DtHumanMoveToController::atDestination ( ) [protected, 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.

virtual void DtHumanMoveToController::doMoving ( ) [protected, virtual]

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

virtual double DtHumanMoveToController::findDesiredHeading ( ) [protected, virtual]

Determines the desired heading.

virtual void DtHumanMoveToController::moveToDestination ( ) [protected, virtual]

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

virtual void DtHumanMoveToController::stop ( ) [protected, virtual]

Set port values for stopping, and mark the task complete.

virtual void DtHumanMoveToController::registerTaskMsgCallbacks ( ) [protected, virtual]

Overridden to register interest in move to messages.

Reimplemented from DtTaskControllerComponent.

virtual void DtHumanMoveToController::processModifyVrfObject ( DtSimMessage msg) [protected, 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).

virtual void DtHumanMoveToController::processSetLocation ( DtSimMessage msg) [protected, virtual]

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

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

Creates and initializes port groups.

Reimplemented from DtSimComponent.

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

Creates myDestinationOutputPort.

Reimplemented from DtSimComponent.

virtual bool DtHumanMoveToController::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 double DtHumanMoveToController::distanceToDestination ( ) const [protected, virtual]
virtual void DtHumanMoveToController::clearTask ( ) [protected, virtual]

Override to deactivate myHumanMovementControlOutputPortGroup.

Reimplemented from DtSingleTaskControllerComponent.

virtual bool DtHumanMoveToController::destinationIsInsideObstruction ( const DtVector localDestination) const [protected, virtual]

Returns whether or not current destination is inside an obstruction.

virtual bool DtHumanMoveToController::decideToGiveUpTask ( ) const [protected, virtual]

Checks to see if destination is inside an obstruction.

If it is, returns true. Returns false otheriwise.

Reimplemented from DtSingleTaskControllerComponent.

virtual double DtHumanMoveToController::atDistance ( ) const [protected, virtual]

Maximum distance at which entity is considered to be 'at' goal.

Returns value stored in descriptor (if it exists), otherwise returns 0.5.

Returns:
Returns maximum distance in meters from goal location that entity is considered to be 'at' the goal.

Member Data Documentation

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


Input Port Range:
Input Port Default Value:
Input Group Parent: collision-avoidance-control

Input Port Group Name: collision-avoidance-control
Input Port Group Description:

Output Group Name: movement-control
.

Output Port Name: destination
Output Port Description: Specifies the current destination of the entity in geocentric coordiantes.

Output Port Range:
Output Group Parent:

This is looked up once per tick - assumed unchanging while we have control.

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)