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

Public Types | |
| enum | DtPatrolAlongState { DtMovingAlongRoute = 0, DtReversingDirection = 1 } |
Public Member Functions | |
| DtAggregatedPatrolController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtAggregatedPatrolController () |
| 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. | |
| DtSimTaskStatePtr | currentTaskState () const |
Static Public Member Functions | |
| static void | patrolTwoPointsTaskCallback (DtSimMessage *msg, void *usr, DtSimTaskStatePtr taskStatePtr) |
| Callback function for handling incoming turn to move to task message. | |
| static void | patrolAlongTaskCallback (DtSimMessage *msg, void *usr, DtSimTaskStatePtr taskStatePtr) |
| 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, DtSimTaskStatePtr taskStatePtr) |
| 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, DtSimTaskStatePtr taskStatePtr) |
| 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 | |
| DtAggregatedPatrolPSR * | myProcessState |
| Container for state data associated with this component. | |
Private Member Functions | |
| DtAggregatedPatrolController (const DtAggregatedPatrolController &orig) | |
| copy constructor - not implemented | |
| DtAggregatedPatrolController & | operator= (const DtAggregatedPatrolController &orig) |
| assignment operator - not implemented | |
DtAggregatedPatrolController is a task controller responsible for executing DtPatrolAlongTasks in aggregate entities.
End User Description: DtAggregatedPatrolController 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
| DtAggregatedPatrolController::DtAggregatedPatrolController | ( | 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 DtAggregatedPatrolController::~DtAggregatedPatrolController | ( | ) | [virtual] |
destructor
| DtAggregatedPatrolController::DtAggregatedPatrolController | ( | const DtAggregatedPatrolController & | orig | ) | [private] |
copy constructor - not implemented
| virtual DtString DtAggregatedPatrolController::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 DtAggregatedPatrolController::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 DtAggregatedPatrolController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Registers patrolAlongTaskCallback callback for DtPatrolRouteTasks.
Reimplemented from DtTaskControllerComponent.
| DtSimTaskStatePtr DtAggregatedPatrolController::currentTaskState | ( | ) | const [virtual] |
Reimplemented from DtSingleTaskControllerComponent.
| static void DtAggregatedPatrolController::patrolTwoPointsTaskCallback | ( | DtSimMessage * | msg, |
| void * | usr, | ||
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [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 DtAggregatedPatrolController::patrolAlongTaskCallback | ( | DtSimMessage * | msg, |
| void * | usr, | ||
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [static] |
Called upon reciept of DtPatrolRotueTasks.
Calls processPatrolAlongTask().
| msg | Message containing a DtPatrolRouteTask. |
| usr | Pointer to an instance of this class. |
| static void DtAggregatedPatrolController::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* DtAggregatedPatrolController::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 DtAggregatedPatrolController::onPatrolTwoPointsTask | ( | DtSimMessage * | msg, |
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [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 DtAggregatedPatrolController::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 DtAggregatedPatrolController::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 DtAggregatedPatrolController::processPatrolAlongTask | ( | DtSimMessage * | msg, |
| DtSimTaskStatePtr | taskStatePtr | ||
| ) | [protected, virtual] |
Unpacks the incoming DtPatrolRouteTask and calls myMoveAlongController->moveAlong(), sets myReverseDirection to true, and calls startTask().
| msg | Message containing a DtPatrolAlongTask. |
| virtual bool DtAggregatedPatrolController::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 DtAggregatedPatrolController::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 DtAggregatedPatrolController::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). |
| DtAggregatedPatrolController& DtAggregatedPatrolController::operator= | ( | const DtAggregatedPatrolController & | orig | ) | [private] |
assignment operator - not implemented
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).