![]() |
VR-Forces 4.0.4 Class Documentation
|
DtHumanPatrolController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities. More...

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 DtSimComponent * | creator (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 | |
| DtHumanPatrolPSR * | myProcessState |
| Container for state data associated with this component. | |
Private Member Functions | |
| DtHumanPatrolController (const DtHumanPatrolController &orig) | |
| copy constructor - not implemented | |
| DtHumanPatrolController & | operator= (const DtHumanPatrolController &orig) |
| assignment operator - not implemented | |
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
| DtHumanPatrolController::DtHumanPatrolController | ( | 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 DtHumanPatrolController::~DtHumanPatrolController | ( | ) | [virtual] |
destructor
| DtHumanPatrolController::DtHumanPatrolController | ( | const DtHumanPatrolController & | orig | ) | [private] |
copy constructor - not implemented
| 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.
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.
| virtual void DtHumanPatrolController::registerTaskMsgCallbacks | ( | ) | [virtual] |
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.
| msg | Message containing a DtPatrolTwoPointsTask. |
| usr | Pointer to instance of this class. |
| static void DtHumanPatrolController::patrolAlongTaskCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Called upon reciept of DtPatrolRotueTasks.
Calls processPatrolAlongTask().
| msg | Message containing a DtPatrolRouteTask. |
| usr | Pointer 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.
| msg | Message containing a DtTaskCompleteReport. |
| usr | Pointer 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*,
| 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 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().
| msg | Message 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).
| msg | Message 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. |
| msg | Message 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().
| msg | Message 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.
| routeName | Object name of the route we are following. |
| worldPosition | Initial 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.
| routeName | Object name of the route we are following. |
| traversalDirection | Direction to move along route. Increasing vertex index corresponds to forward direction, decreasing vertex index corresponds to reverse direction. |
| startAtClosestPoint | If 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
DtHumanPatrolPSR* DtHumanPatrolController::myProcessState [protected] |
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).