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

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

Inheritance diagram for DtAggregatedMoveToController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtAggregatedMoveToController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 Constructor.
virtual ~DtAggregatedMoveToController ()
 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 void moveIntoFormationCallback (DtSimMessage *msg, void *usr)
 Callback function that handles DtMoveIntoFormation tasks.
static void turnToHeadingCallback (DtSimMessage *msg, void *usrData)
 Callback function that handles DtTurnToHeading 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 double atDistance () const
 Maximum distance at which entity is considered to be 'at' goal.
virtual void processMoveIntoFormationTask (DtSimMessage *msg)
 Implements turn to heading task by sending a set location and set heading request to ourself.
virtual void processTurnToHeadingTask (DtSimMessage *msg)
 Implements turn to heading task by sending a set heading request to ourself.
virtual void sendRequestToSelf (const DtSetDataRequest &request) const
 Helper function that sends given set data request to ourself.

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
DtVrfAggregateStateRepositorymyAggregateStateRepository
DtAggregatedMoveToPSRmyProcessState
 Container for state data associated with this component.
DtAggregatedMoveToDescriptormyAggregatedMoveToDescriptor
DtSetDataManagermySetDataManager
 Pointer to aggregate's DtSetDataManager, cached in this class for convenience.
Ports and Port Groups
DtAnalogOutputPortmyMovementDirectionOutputPort
 Output Port Name: desired-movement-direction
Output Port Description: Specifies the current movement direction in radians Output Port Range:
Output Group Parent:
.
DtAnalogOutputPortmySpeedOutputPort
 Output Port Name: desired-speed
Output Port Description: Specifies the current speed of the entity in meters/second Output Port Range:
Output Group Parent:
.
DtOutputPortGroupmyOutputPortGroup
 Output Group Name: movement-control
.
DtVectorOutputPortmyDestinationOutputPort
 Output Port Name: destination
Output Port Description: Specifies the current destination of the entity in geocentric coordinates.

Private Member Functions

 DtAggregatedMoveToController ()
 Not Implemented.
 DtAggregatedMoveToController (const DtAggregatedMoveToController &orig)
 Not Implemented.
DtAggregatedMoveToControlleroperator= (const DtAggregatedMoveToController &orig)
 Not Implemented.

Detailed Description

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

It also handles move into formation (at a location) and turn to heading (at the current location) tasks.

Developer Description: DtHumanMoveAlongController 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, DtMoveToLocationTaskType, DtMoveIntoFormationTaskType and DtTurnToHeadingTask tasks. Component OPD Name: "aggregated-move-to-controller"

Uses Descriptor Type: DtAggregatedMoveToControllerDescriptor


Constructor & Destructor Documentation

Not Implemented.

Not Implemented.

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

Constructor.

Destructor.


Member Function Documentation

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

Not Implemented.

Init. Call immediately after construction.

Reimplemented from DtControllerComponent.

virtual DtString DtAggregatedMoveToController::type ( ) const [virtual]
Returns:
DtAggregatedMoveToControllerType

Implements DtTaskControllerComponent.

virtual void DtAggregatedMoveToController::tick ( ) [virtual]

This components simulation tick.

Reimplemented from DtSimComponent.

static void DtAggregatedMoveToController::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 DtAggregatedMoveToController::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 DtAggregatedMoveToController::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 void DtAggregatedMoveToController::moveIntoFormationCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callback function that handles DtMoveIntoFormation tasks.

Calls processMoveIntoFormationTask().

Parameters:
msgMessage containing DtMoveIntoFormationTask.
usrPointer to an instance of this class.
static void DtAggregatedMoveToController::turnToHeadingCallback ( DtSimMessage msg,
void *  usrData 
) [static]

Callback function that handles DtTurnToHeading tasks.

Calls processTurnToHeadingTask().

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

Static creator function for factory registration.

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

Calls processModifyVrfObject.

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

Sets world destination from the task.

Parameters:
msgMessage containing a DtMoveToTask.
virtual void DtAggregatedMoveToController::processMoveToLocationTask ( DtSimMessage msg) [protected, virtual]
virtual void DtAggregatedMoveToController::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 DtAggregatedMoveToController::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 DtAggregatedMoveToController::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 DtAggregatedMoveToController::invalidateDestinationVector ( ) const [protected, virtual]

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

virtual bool DtAggregatedMoveToController::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 DtAggregatedMoveToController::doMoving ( ) [protected, virtual]

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

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

Determines the desired heading.

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

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

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

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

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

Overridden to register interest in move to messages.

Reimplemented from DtTaskControllerComponent.

virtual void DtAggregatedMoveToController::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 DtAggregatedMoveToController::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 DtAggregatedMoveToController::createPortGroups ( ) [protected, virtual]

Creates and initializes port groups.

Reimplemented from DtSimComponent.

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

Creates myDestinationOutputPort.

Reimplemented from DtSimComponent.

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

Override to deactivate myHumanMovementControlOutputPortGroup.

Reimplemented from DtSingleTaskControllerComponent.

virtual double DtAggregatedMoveToController::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 10..

Returns:
Returns maximum distance in meters from goal location that entity is considered to be 'at' the goal.
virtual void DtAggregatedMoveToController::processMoveIntoFormationTask ( DtSimMessage msg) [protected, virtual]

Implements turn to heading task by sending a set location and set heading request to ourself.

Parameters:
msgMessage containing a DtMoveIntoFormationTask.
virtual void DtAggregatedMoveToController::processTurnToHeadingTask ( DtSimMessage msg) [protected, virtual]

Implements turn to heading task by sending a set heading request to ourself.

Parameters:
msgMessage containing a DtTurnToHeadingTask.
virtual void DtAggregatedMoveToController::sendRequestToSelf ( const DtSetDataRequest request) const [protected, virtual]

Helper function that sends given set data request to ourself.


Member Data Documentation

Output Port Name: desired-movement-direction
Output Port Description: Specifies the current movement direction in radians Output Port Range:
Output Group Parent:
.

Output Port Name: desired-speed
Output Port Description: Specifies the current speed of the entity in meters/second Output Port Range:
Output Group Parent:
.

Output Group Name: movement-control
.

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

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

Pointer to aggregate's DtSetDataManager, cached in this class for convenience.


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)