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

DtHumanPatrolController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities. More...

Inheritance diagram for DtHumanPatrolController:
Inheritance graph
[legend]

List of all members.

Public Types

enum  DtPatrolAlongState { DtMovingAlongRoute = 0, DtReversingDirection = 1 }

Public Member Functions

 DtHumanPatrolController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtHumanPatrolController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual bool init ()
 Override to cache a pointer to our DtFormationState and register formationStateChangedCallback to be invoked when formation state changes.
virtual void registerTaskMsgCallbacks ()
 Registers patrolAlongTaskCallback callback for DtPatrolRouteTasks.

Static Public Member Functions

static void patrolTwoPointsTaskCallback (DtSimMessage *msg, void *usr)
 Callback function for handling incoming turn to move to task message.
static void patrolAlongTaskCallback (DtSimMessage *msg, void *usr)
 Called upon reciept of DtPatrolRotueTasks.
static void taskCompleteReportCallback (DtSimMessage *msg, void *usr)
 Called upon receipt of a DtTaskCompleteReport.
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual void onPatrolTwoPointsTask (DtSimMessage *msg)
 Unpacks incoming DtPatrolTwoPointsTask, caches names of waypoints in the task, calls moveTo() with the name of the first waypoint, sets myReverseDirection to true and calls startTask().
virtual void onTaskComplete (DtSimMessage *msg)
 If tasked() is true and report is for a DtMoveIntoFormationTask type, calls moveTo() (with the other waypoint).
virtual bool moveTo (const DtString &controlPointName)
 Looks up given control point name.
virtual void processPatrolAlongTask (DtSimMessage *msg)
 Unpacks the incoming DtPatrolRouteTask and calls myMoveAlongController->moveAlong(), sets myReverseDirection to true, and calls startTask().
virtual bool createPSR ()
 Creates myProcessState data member, and adds it to our process state repository manager.
virtual DtIteratorDirection initialTraversalDirection (const DtString &routeName, const DtVector &initialWorldPosition) const
 Determines initial traversal direction for patrol task.
virtual void sendMoveAlongToSelf (const DtString &routeName, enum DtIteratorDirection traversalDirection, bool startAtClosestPoint)
 Send move along task as subtask to ourself.

Protected Attributes

DtHumanPatrolPSRmyProcessState
 Container for state data associated with this component.

Private Member Functions

 DtHumanPatrolController (const DtHumanPatrolController &orig)
 copy constructor - not implemented
DtHumanPatrolControlleroperator= (const DtHumanPatrolController &orig)
 assignment operator - not implemented

Detailed Description

DtHumanPatrolController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities.

End User Description: DtHumanPatrolController models an human's patrol-between <waypoints> and patrol-along <route> behavior. The behavior is implemented by issuing move-along subtasks to itself, alternating between forward and reverse directions. The task executes indefinitely (unless stopped by an external event, such as receipt of a skip task message).

Uses Descriptor Type: DtComponentDescriptor


Member Enumeration Documentation

Enumerator:
DtMovingAlongRoute 
DtReversingDirection 

Constructor & Destructor Documentation

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

(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

copy constructor - not implemented


Member Function Documentation

virtual DtString DtHumanPatrolController::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.

Returns:
DtHumanPatrolControllerType

Implements DtTaskControllerComponent.

virtual bool DtHumanPatrolController::init ( ) [virtual]

Override to cache a pointer to our DtFormationState and register formationStateChangedCallback to be invoked when formation state changes.

Reimplemented from DtControllerComponent.

Registers patrolAlongTaskCallback callback for DtPatrolRouteTasks.

Reimplemented from DtTaskControllerComponent.

static void DtHumanPatrolController::patrolTwoPointsTaskCallback ( DtSimMessage msg,
void *  usr 
) [static]

Callback function for handling incoming turn to move to task message.

Calls onMoveToTask to actually handle the message.

Parameters:
msgMessage containing a DtPatrolTwoPointsTask.
usrPointer to instance of this class.
static void DtHumanPatrolController::patrolAlongTaskCallback ( DtSimMessage msg,
void *  usr 
) [static]

Called upon reciept of DtPatrolRotueTasks.

Calls processPatrolAlongTask().

Parameters:
msgMessage containing a DtPatrolRouteTask.
usrPointer to an instance of this class.
static void DtHumanPatrolController::taskCompleteReportCallback ( DtSimMessage msg,
void *  usr 
) [static]

Called upon receipt of a DtTaskCompleteReport.

Calls onTaskComplete to process the message.

Parameters:
msgMessage containing a DtTaskCompleteReport.
usrPointer to an instance of this class.
static DtSimComponent* DtHumanPatrolController::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.
virtual void DtHumanPatrolController::onPatrolTwoPointsTask ( DtSimMessage msg) [protected, virtual]

Unpacks incoming DtPatrolTwoPointsTask, caches names of waypoints in the task, calls moveTo() with the name of the first waypoint, sets myReverseDirection to true and calls startTask().

Parameters:
msgMessage containing a DtPatrolTwoPointsTask.
virtual void DtHumanPatrolController::onTaskComplete ( DtSimMessage msg) [protected, virtual]

If tasked() is true and report is for a DtMoveIntoFormationTask type, calls moveTo() (with the other waypoint).

Parameters:
msgMessage containing a DtTaskCompleteReport. If tasked() is true and report is for a DtMoveAlongTask type, send set heading request to reverse direction and sends new move along task to ourself to start moving in opposite direction along route.
msgMessage containing a DtTaskCompleteReport.
virtual bool DtHumanPatrolController::moveTo ( const DtString controlPointName) [protected, virtual]

Looks up given control point name.

If it exists, calculates heading to the waypoint from current aggregate location. Sends a move into formation subtask to ourself with the following parameters: location of waypoint heading from ourself to waypoint formation type of DtKeepExistingFormation, apply formation to subordinate is false

virtual void DtHumanPatrolController::processPatrolAlongTask ( DtSimMessage msg) [protected, virtual]

Unpacks the incoming DtPatrolRouteTask and calls myMoveAlongController->moveAlong(), sets myReverseDirection to true, and calls startTask().

Parameters:
msgMessage containing a DtPatrolAlongTask.
virtual bool DtHumanPatrolController::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 DtIteratorDirection DtHumanPatrolController::initialTraversalDirection ( const DtString routeName,
const DtVector initialWorldPosition 
) const [protected, virtual]

Determines initial traversal direction for patrol task.

Returns traversal in forward direction, unless closest vertex is the last vertex. If closest vertex is the last vertex, checks to see if aggregate is beyond the end of the route. If so, returns a traversal direction of reverse, otherwise returns traversal direction of forward.

Parameters:
routeNameObject name of the route we are following.
worldPositionInitial position in geocentric coordinates.
virtual void DtHumanPatrolController::sendMoveAlongToSelf ( const DtString routeName,
enum DtIteratorDirection  traversalDirection,
bool  startAtClosestPoint 
) [protected, virtual]

Send move along task as subtask to ourself.

Parameters:
routeNameObject name of the route we are following.
traversalDirectionDirection to move along route. Increasing vertex index corresponds to forward direction, decreasing vertex index corresponds to reverse direction.
startAtClosestPointIf true, starts at nearest vertex, otherwise starts at logical beginning of route (which may be at the 'end', if the traversal direction is reverse).
DtHumanPatrolController& DtHumanPatrolController::operator= ( const DtHumanPatrolController orig) [private]

assignment operator - not implemented


Member Data Documentation

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)