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

DtRailPathController is a controller that models movement along a generated path for an entity making use of any feature data or routes of the type specified in the path metric. More...

Inheritance diagram for DtRailPathController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtRailPathController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=NULL, DtReaderWriterRegistry *parentRegistry=NULL)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtRailPathController ()
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, or stops any move along subtask that has been started.
virtual void tick ()
 Main processing for component.

Static Public Member Functions

static void settingConsumerCallback (const DtSettingsObject *settingsObject, void *usr)
 Callback for changing which side of the road entity is driving on. Calls processSetting.
static void plannedMoveToCallback (DtSimMessage *msg, void *usr)
static void taskCompleteReportCallback (DtSimMessage *msg, void *usr)
 Comes in when a subtask has been completed and determines next subtask or if the overall task is complete.
static void destinationChangedCallback (DtVrfObject *obj, void *usrData)
static void setLocationCallback (DtSimMessage *msg, void *usr)
 Calls processSetLocation.
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual void processSetting (const DtBoolSetting *setting)
 Sets myDrivingOnLeftEnabled with value in setting.
virtual bool drivingOnLeftEnabled () const
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 moveToRailEntry (DtRailSegmentList *rails, const DtVector &entryPt)
virtual void directMove ()
 If the entity can't find a path, just send it directly.
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.
virtual DtVrfObjectpublishDebugPath ()
 Creates a new VRF Object corresponding to the path generated by the path planner.
virtual void removeDebugPath ()
 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 DtRailPathPlanner to calculate a path from start to end.
virtual bool destinationValid (DtVector &localDest)
 looks to see if we have a valid destination.
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 DtPathMetriccreatePathMetric ()
 Just for testing -- creates and returns our path metric.

Protected Attributes

DtRailPathPlannermyPathPlanner
 Genereates a path from our entry point onto the network to the exit point off the network if one exists.
DtRailPathControllerPSRmyProcessState
 Container for state data associated with this component.
int mySubTaskId
const
DtRailPathControllerDescriptor
myPathDescriptor
bool myDestinationChangedCallbackRegistered
DtVector myStartPoint
 Bookkeeping for callback registration.
DtVector myEndPoint
 Entity's goal location.
DtRailPathMetricmyPathMetric
bool myDrivingOnLeftEnabled
bool myFirstTick

Private Member Functions

 DtRailPathController ()
 Not Implemented.
 DtRailPathController (const DtRailPathController &orig)
 Not Implemented.
DtRailPathControlleroperator= (const DtRailPathController &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.

Detailed Description

DtRailPathController is a controller that models movement along a generated path for an entity making use of any feature data or routes of the type specified in the path metric.

End User Description: This task controller component responds to path movement tasks by calculating the best path from the current position to the destination using it's rail path planner. It first determines if using feature data or routes is worth the effort or if the entity should just take the direct route. If the former, it finds the entry point and exit point onto and off of the network of feature data/routes and the calculates the most efficent route on the network between the entry point and exit point.

Once the path is calculated, a move location task is issued to the entity to move it using it's normal movement system to the entry point onto the network. Once on the network this controller will deactivate the entity's normal movment system and activate it's rail movement system. Then a rail move along subtask is issued to the DtRailMovementController to allow the entity to efficently move along the generated rail path without the weaving motion symtopmatic of the default move controllers. Once the subtask completes, this controller deactivates the rail system and reactivates the default movement system. 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.

Note:
The entity will remain in place while it is planning a path. If the terrain is complex, the distance to the destination is large, or there is not much available processor this may be a lengthy process. This component responds to DtPlanAndMoveToTask and DtPlanAndMoveToLocationTask task types.

This component can be configured though its descriptor, the DtRailPathControllerDescriptor. See this class for information on altering the path planning parameters in the OPE file.

This component maintains its internal state in a DtRailPathControllerPSR.

The path planning that is done by this component is done using the DtRailPathPlanner class. Check this class for information on customizing the path planning algorithm.

Uses Descriptor Type: DtRailPathControllerDescriptor


Constructor & Destructor Documentation

Not Implemented.

Not Implemented.

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

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


Member Function Documentation

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

Not Implemented.

virtual bool DtRailPathController::init ( ) [virtual]

Initial setup of component after creation.

Reimplemented from DtControllerComponent.

virtual bool DtRailPathController::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 DtRailPathController::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:
DtRailPathControllerType

Implements DtTaskControllerComponent.

Overridden to register interest in move to messages.

Reimplemented from DtTaskControllerComponent.

static void DtRailPathController::settingConsumerCallback ( const DtSettingsObject settingsObject,
void *  usr 
) [static]

Callback for changing which side of the road entity is driving on. Calls processSetting.

static void DtRailPathController::plannedMoveToCallback ( DtSimMessage msg,
void *  usr 
) [static]
static void DtRailPathController::taskCompleteReportCallback ( DtSimMessage msg,
void *  usr 
) [static]

Comes in when a subtask has been completed and determines next subtask or if the overall task is complete.

static void DtRailPathController::destinationChangedCallback ( DtVrfObject obj,
void *  usrData 
) [static]

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.
static void DtRailPathController::objectAboutToBeRemovedCallback ( DtVrfObject obj,
void *  usr 
) [static]

If the object being removed is the current destination, then the task is abandoned.

If the object being removed is the current destination, then the task is abandoned.

static void DtRailPathController::setLocationCallback ( DtSimMessage msg,
void *  usr 
) [static]

Calls processSetLocation.

virtual void DtRailPathController::processSetLocation ( DtSimMessage msg) [virtual]

Aborts any running path planning, or stops any move along subtask that has been started.

Next call to tick() will restart path planning from the entities new position.

virtual void DtRailPathController::tick ( ) [virtual]

Main processing for component.

Reimplemented from DtSimComponent.

virtual void DtRailPathController::processSetting ( const DtBoolSetting setting) [protected, virtual]

Sets myDrivingOnLeftEnabled with value in setting.

virtual bool DtRailPathController::drivingOnLeftEnabled ( ) const [protected, virtual]
virtual void DtRailPathController::startPlannedMoveTo ( const DtString objectName) [protected, virtual]

Starts a planned move to task with the specified object as the target position.

virtual void DtRailPathController::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 DtRailPathController::moveToRailEntry ( DtRailSegmentList rails,
const DtVector entryPt 
) [protected, virtual]
virtual void DtRailPathController::directMove ( ) [protected, virtual]

If the entity can't find a path, just send it directly.

virtual void DtRailPathController::registerDestinationChangedCallback ( ) [protected, virtual]

Registers a vertices changed callback with the destination object named in the PSR.

Registers for a setLocation message.

virtual void DtRailPathController::unregisterDestinationChangedCallback ( ) [protected, virtual]

Unregisters a vertices changed callback from the destination object named in the PSR.

virtual DtVrfObject* DtRailPathController::publishDebugPath ( ) [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. Used to visualize the generated path.

virtual void DtRailPathController::removeDebugPath ( ) [protected, virtual]

Removes the VrfObject corresponding to the path that was published and whose name is stored in myPathName.

virtual bool DtRailPathController::makePath ( const DtVector start,
const DtVector end 
) [protected, virtual]

uses the DtRailPathPlanner to calculate a path from start to end.

virtual bool DtRailPathController::destinationValid ( DtVector localDest) [protected, virtual]

looks to see if we have a valid destination.

If so puts it in localDest. This value is in database coordinates

virtual void DtRailPathController::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.

virtual DtPathMetric* DtRailPathController::createPathMetric ( ) [protected, virtual]

Just for testing -- creates and returns our path metric.

static DtSimComponent* DtRailPathController::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.

Member Data Documentation

Genereates a path from our entry point onto the network to the exit point off the network if one exists.

Constructs a path using DtRailSegment segments.

Container for state data associated with this component.

This state is saved and restored as part of a scenario (or checkpoint).

Bookkeeping for callback registration.

Entity's current location

Entity's goal location.


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)