![]() |
VR-Forces 4.0.4 Class Documentation
|
DtPathMovementController is a controller that models movement along a generated path for an entity. More...

Public Member Functions | |
| DtPathMovementController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=NULL, DtReaderWriterRegistry *parentRegistry=NULL) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtPathMovementController () |
| virtual bool | init () |
| Initial setup of component after creation. | |
| virtual bool | createPSR () |
| Creates myProcessState data member, and adds it to our process state repository manager. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | registerTaskMsgCallbacks () |
| Overridden to register interest in move to messages. | |
| virtual void | processPlannedMoveToTask (DtSimMessage *msg) |
| virtual void | processTaskCompleteReport (DtSimMessage *msg) |
| virtual void | processDestinationChanged () |
| Ensures that the destination stored in the ProcessStateRepository is consistent with the location of the destination control point. | |
| virtual void | processSetLocation (DtSimMessage *msg) |
| Aborts any running path planning thread, or stops any move along subtask that has been started. | |
| virtual void | tick () |
| Main processing for component. | |
Static Public Member Functions | |
| static void | plannedMoveToCallback (DtSimMessage *msg, void *usr) |
| static void | taskCompleteReportCallback (DtSimMessage *msg, void *usr) |
| static void | destinationChangedCallback (DtVrfObject *obj, void *usrData) |
| static void | setLocationCallback (DtSimMessage *msg, void *usr) |
| Calls processSetLocation. | |
| 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 | startPlannedMoveTo (const DtString &objectName) |
| Starts a planned move to task with the specified object as the target position. | |
| virtual void | startPlannedMoveTo (const DtVector &localDestination) |
| Starts a planned move to task to the specified coordinates. | |
| virtual void | registerDestinationChangedCallback () |
| Registers a vertices changed callback with the destination object named in the PSR. | |
| virtual void | unregisterDestinationChangedCallback () |
| Unregisters a vertices changed callback from the destination object named in the PSR. | |
| void | abort () |
| Call this method from outside the spawned thread to tell the spawned process to abort the path planning process and exit. | |
| virtual bool | pathDone () |
| Call this from outside the spawned thread. | |
| virtual DtVrfObject * | publishPath () |
| Creates a new VRF Object corresponding to the path generated by the path planner. | |
| virtual void | removePublishedPath () |
| Removes the VrfObject corresponding to the path that was published and whose name is stored in myPathName. | |
| virtual bool | makePath (const DtVector &start, const DtVector &end) |
| uses the DtPathPlanner to calculate a path from start to end. | |
| virtual void | clearTask () |
| Overridden from DtTaskControllerComponent to clean up the path calculating thread, remove any generated path objects, and stop any subtasks if the current task is aborted. | |
| virtual void | threadMain () |
| Actual main method for the spawned thread. | |
| virtual DtPathMetric * | createPathMetric () |
| Just for testing -- creates and returns our path metric. | |
Static Protected Member Functions | |
| static void * | staticThreadMain (void *data) |
| Main function for the spawned thread. | |
Protected Attributes | |
| DtPathPlanner * | myPathPlanner |
| DtPathMovementControllerPSR * | myProcessState |
| Container for state data associated with this component. | |
| const DtPathMovementControllerDescriptor * | myPathDescriptor |
| bool | myDestinationChangedCallbackRegistered |
| bool | myDone |
| Bookkeeping for callback registration. | |
| volatile bool | myProcessing |
| Needs to be volatile since one thread checks this value while the other sets it. | |
| pthread_t | myThread |
| DtVector | myStartPoint |
| DtVector | myEndPoint |
| DtPathMetric * | myPathMetric |
| double | myLastMessageTime |
| Message information members. | |
| double | myTotalElapsedTime |
Private Member Functions | |
| DtPathMovementController () | |
| Not Implemented. | |
| DtPathMovementController (const DtPathMovementController &orig) | |
| Not Implemented. | |
| DtPathMovementController & | operator= (const DtPathMovementController &orig) |
| Not Implemented. | |
| virtual void | processObjectAboutToBeRemoved (DtVrfObject *obj) |
| If the object being removed is the current destination, then the task is abandoned. | |
| static void | objectAboutToBeRemovedCallback (DtVrfObject *obj, void *usr) |
| If the object being removed is the current destination, then the task is abandoned. | |
DtPathMovementController is a controller that models movement along a generated path for an entity.
End User Description: This task controller component responds to path movement tasks by spawning a thread in which a DtPathPlanner calculates the best path from the current position to the destination. Once the path is calculated, it is published as a VRF control object and a move along route subtask is issued within the same entity to carry out the movement. Once the subtask completes, or if the task is aborted, the route object that was published will be removed. If a task was planned to a named object, and that object changes location during the run of this task, the original path will be removed, and a new path will be planned.
This component responds to DtPlanAndMoveToTask and DtPlanAndMoveToLocationTask task types.
This component can be configured though its descriptor, the DtPathMovementControllerDescriptor. See this class for information on altering the path planning parameters in the OPE file.
This component maintains its internal state in a DtPathMovementControllerPSR.
The path planning that is done by this component is done using the DtPathPlanner class. Check this class for information on customizing the path planning algorithm.
Uses Descriptor Type: DtPathMovementControllerDescriptor
| DtPathMovementController::DtPathMovementController | ( | ) | [private] |
Not Implemented.
| DtPathMovementController::DtPathMovementController | ( | const DtPathMovementController & | orig | ) | [private] |
Not Implemented.
| DtPathMovementController::DtPathMovementController | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = NULL, |
||
| DtReaderWriterRegistry * | parentRegistry = NULL |
||
| ) |
(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 DtPathMovementController::~DtPathMovementController | ( | ) | [virtual] |
| DtPathMovementController& DtPathMovementController::operator= | ( | const DtPathMovementController & | orig | ) | [private] |
Not Implemented.
| virtual bool DtPathMovementController::init | ( | ) | [virtual] |
Initial setup of component after creation.
Reimplemented from DtControllerComponent.
| virtual bool DtPathMovementController::createPSR | ( | ) | [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 DtString DtPathMovementController::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 void DtPathMovementController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Overridden to register interest in move to messages.
Reimplemented from DtTaskControllerComponent.
| static void DtPathMovementController::plannedMoveToCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
| virtual void DtPathMovementController::processPlannedMoveToTask | ( | DtSimMessage * | msg | ) | [virtual] |
| static void DtPathMovementController::taskCompleteReportCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
| virtual void DtPathMovementController::processTaskCompleteReport | ( | DtSimMessage * | msg | ) | [virtual] |
| static void DtPathMovementController::destinationChangedCallback | ( | DtVrfObject * | obj, |
| void * | usrData | ||
| ) | [static] |
| virtual void DtPathMovementController::processDestinationChanged | ( | ) | [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.
| static void DtPathMovementController::objectAboutToBeRemovedCallback | ( | DtVrfObject * | obj, |
| void * | usr | ||
| ) | [static] |
If the object being removed is the current destination, then the task is abandoned.
| virtual void DtPathMovementController::processObjectAboutToBeRemoved | ( | DtVrfObject * | obj | ) | [virtual] |
If the object being removed is the current destination, then the task is abandoned.
| static void DtPathMovementController::setLocationCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Calls processSetLocation.
| virtual void DtPathMovementController::processSetLocation | ( | DtSimMessage * | msg | ) | [virtual] |
Aborts any running path planning thread, or stops any move along subtask that has been started.
Next call to tick() will start a new path planning thread from the entities new position.
| virtual void DtPathMovementController::tick | ( | ) | [virtual] |
Main processing for component.
Reimplemented from DtSimComponent.
| virtual void DtPathMovementController::startPlannedMoveTo | ( | const DtString & | objectName | ) | [protected, virtual] |
Starts a planned move to task with the specified object as the target position.
| virtual void DtPathMovementController::startPlannedMoveTo | ( | const DtVector & | localDestination | ) | [protected, virtual] |
Starts a planned move to task to the specified coordinates.
Calls to makePath() to kick off the path planning thread.
| virtual void DtPathMovementController::registerDestinationChangedCallback | ( | ) | [protected, virtual] |
Registers a vertices changed callback with the destination object named in the PSR.
Registers for a setLocation message.
| virtual void DtPathMovementController::unregisterDestinationChangedCallback | ( | ) | [protected, virtual] |
Unregisters a vertices changed callback from the destination object named in the PSR.
| void DtPathMovementController::abort | ( | ) | [protected] |
Call this method from outside the spawned thread to tell the spawned process to abort the path planning process and exit.
| virtual bool DtPathMovementController::pathDone | ( | ) | [protected, virtual] |
Call this from outside the spawned thread.
Returns true if the path planning thread has completed and exited.
| virtual DtVrfObject* DtPathMovementController::publishPath | ( | ) | [protected, virtual] |
Creates a new VRF Object corresponding to the path generated by the path planner.
Returns the VrfObject pointer to the new route object.
| virtual void DtPathMovementController::removePublishedPath | ( | ) | [protected, virtual] |
Removes the VrfObject corresponding to the path that was published and whose name is stored in myPathName.
| virtual bool DtPathMovementController::makePath | ( | const DtVector & | start, |
| const DtVector & | end | ||
| ) | [protected, virtual] |
uses the DtPathPlanner to calculate a path from start to end.
| virtual void DtPathMovementController::clearTask | ( | ) | [protected, virtual] |
Overridden from DtTaskControllerComponent to clean up the path calculating thread, remove any generated path objects, and stop any subtasks if the current task is aborted.
Reimplemented from DtSingleTaskControllerComponent.
| static void* DtPathMovementController::staticThreadMain | ( | void * | data | ) | [static, protected] |
Main function for the spawned thread.
Simply casts data to a DtGroupPathMovementController and calls threadMain().
| virtual void DtPathMovementController::threadMain | ( | ) | [protected, virtual] |
Actual main method for the spawned thread.
| virtual DtPathMetric* DtPathMovementController::createPathMetric | ( | ) | [protected, virtual] |
Just for testing -- creates and returns our path metric.
| static DtSimComponent* DtPathMovementController::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). |
DtPathPlanner* DtPathMovementController::myPathPlanner [protected] |
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).
const DtPathMovementControllerDescriptor* DtPathMovementController::myPathDescriptor [protected] |
bool DtPathMovementController::myDone [protected] |
Bookkeeping for callback registration.
volatile bool DtPathMovementController::myProcessing [protected] |
Needs to be volatile since one thread checks this value while the other sets it.
pthread_t DtPathMovementController::myThread [protected] |
DtVector DtPathMovementController::myStartPoint [protected] |
DtVector DtPathMovementController::myEndPoint [protected] |
DtPathMetric* DtPathMovementController::myPathMetric [protected] |
double DtPathMovementController::myLastMessageTime [protected] |
Message information members.
double DtPathMovementController::myTotalElapsedTime [protected] |