VR-Forces 4.1 Class Documentation
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtRailMovementController Class Reference

DtRailMovementController is a controller that models movement of an entity along a provided path as if it were locked on rails along each segment. More...

Inheritance diagram for DtRailMovementController:
Inheritance graph
[legend]

Public Member Functions

 DtRailMovementController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtRailMovementController ()
 destructor
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual bool init ()
 Create and initialize our movement driver and updater.
virtual void preFirstTickInit ()
 Calls initializeCurrentState from the currentTaskMessage.
virtual void tick ()
 Determines how the entity moves along the given path.Checks if entity has completed it's task.
virtual void clear ()
virtual bool tickWhileDestroyed () const
 If the component returns true here, it will be ticked regardless of the destroyed state of the host entity.
virtual void processMoveAlongTask (DtSimMessage *msg)
 Handle messages to move along a generated path.
virtual void registerTaskMsgCallbacks ()
 Overrides this so it can register it's interest in RailMoveAlong commands.
virtual void setCurrentMovementState (DtRailMovementState state)
virtual DtRailMovementState currentMovementState () const
virtual DtRailSegmentnextSegment ()
 Returns next segment in list.
virtual DtRailSegmentpeekNextSegment () const
 Returns the next segment in the rail path list.
virtual bool drivingOnLeftEnabled () const
virtual const int turnDirection () const
 Returns the direction we're turning.
virtual void setTurnDirection (const int turn)
virtual bool turning () const
virtual void setTurning (bool turn)
virtual const int currentLane () const
 Set/get current lane position.
virtual void setCurrentLane (const int lane)
virtual const int passingLane () const
 Set/get passing lane, the lane an entity will move into when passing.
virtual void setPassingLane (const int lane)
virtual void setFollowThreshold (const double)
 The maximum follow threshold.
virtual const double followThreshold () const
virtual const double followSpeedFactor () const
 The factor by which we should multiple our speed if we are outside the follow threshold to catch up or slow down back into the threshold.
virtual DtRailSegmentListpathList ()
 Returns a pointer to our path list.
virtual const DtRailSegmentListpathList () const
virtual bool setUpDestination (DtRailSegment *seg, bool incrementSegmentIndex=true, bool useCurrentPos=false, DtVector pos=DtVector::zero())
 Sets myCurrentSeg to seg, this is the segment the entity is currently going to be moving along.
double getDistanceSqAlongSeg (const DtRailSegment *seg, const DtVector &point)
 Finds the distance squared the point is along the given segment.
double getDistanceBehindConvoyTarget (DtVrfObject *convoyTgt)
 Finds the distance along the rail between this entity and the entity it is following if it is following.
virtual double travelDistanceSq ()
 This is the minimum distance squared the enity will comfortably follow another entity in the same lane This is twice the bounding radius of the entity plus if using accleration includes the braking distance.
virtual bool ifDrawDebugRoutes () const
 Whether or not to publish debugging turn route.
virtual void drawDebugSplineTurnRoute (const DtVector &ee, const DtVector &md, const DtVector &ex)
virtual void drawDebugSplineTurnRoute (DtRailSplineCalculator &spline)
virtual DtVrfObjectgetObjectFromObstruction (DtRailObstructionPtr &obs)
- Public Member Functions inherited from DtSingleTaskControllerComponent
 DtSingleTaskControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *compDesc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString& name,
virtual ~DtSingleTaskControllerComponent ()
 destructor
virtual void postTick ()
 Override to check if we're tasked and we want to give up (only performs the check if we're in play mode (dT() > 0)).
virtual bool beginProcessingTask (const DtTaskMessage &task, DtSimTaskStatePtr taskState)
 Called by the task manager when this controller should start executing the specified task.
virtual void taskNotify (const DtSimTask &task)
 This is called to let us know when some other component receives a task In the case of this component, we don't care what the task actually is.
virtual void taskComplete (bool success=true)
 If we are currently tasked, this will cause us to notify the entity that we're done and delete the task.
virtual int sendSubtask (DtSimTask &task)
 Sends subtask to ourself.
virtual void clearSubtask (int subtaskId)
 Clears subtask with the given subtaskId (subtaskId is returned sendSubtask()).
virtual void addPendingSubtaskId (int subtaskId)
 Adds given subtask Id to list of pending subtasks.
virtual bool findPendingSubtaskId (int subtaskId)
 Checks to see if given subtaskId exists in our list of pending subtasks.
virtual void removePendingSubtaskId (int subtaskId)
 Removes pending subtask from list of subtasks for this component.
virtual void removeAllPendingSubtaskIds ()
 Clear all pending subtasks from our list of subtasks.
virtual std::vector< int > currentPendingSubstaskIds () const
 Returns the list of all currently pending subtask ids for this controller.
virtual void clearCurrentTaskMessage ()
 Returns the current subtask with the specified id.
virtual DtTaskMessagecurrentTaskMessage () const
 Get a pointer to the message that was used to task this entity.
virtual DtSimTaskStatePtr currentTaskState () const
virtual void giveUpTask ()
 Called when controller is tasked and decideToGiveUp() returns true.
virtual bool taskActive (int taskId) const
 
virtual bool clearTopLevelTasks ()
 If this controller has any top level tasks (not subtasks), they are cleared.
virtual void clearConflictingTopLevelTasks (const DtSimTaskMessageType &conflictType)
 Clears any top level tasks on this controller that conflict with the conflict task type.
virtual void clearTasksByType (const DtSimTaskMessageType &taskType)
 Clears any tasks of the specified type running in this controller.
virtual void clearTaskById (int taskId)
 Clears any task of the specified ID running in this controller.
virtual std::list
< DtTaskMessage * > 
currentTaskMessages () const
 
virtual DtTaskWithTaskStateListPtr topLevelTasks () const
 
- Public Member Functions inherited from DtTaskControllerComponent
 DtTaskControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *compDesc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString& name,
virtual ~DtTaskControllerComponent ()
 destructor
virtual bool showCurrentTaskInGui () const
virtual void setRadio (DtSimBaseRadio *radio)
 Calls registerTaskMsgCallbacks.
virtual void addTaskProcessorCallback (const DtSimTaskMessageType &taskType, DtTaskMessageCallbackFcn fcn, void *usr)
 Adds a new function for processing the specified task type.
virtual void addTaskProcessorCallback (const DtSimTaskMessageType &taskType, DtMessageCallbackFcn fcn, void *usr)
 Deprecated form of addTaskProcessorCallback.
virtual void removeTaskProcessorCallback (const DtSimTaskMessageType &taskType, DtMessageCallbackFcn fcn, void *usr)
 Undoes anything done by addTaskProcessorCallback().
virtual void removeTaskProcessorCallback (const DtSimTaskMessageType &taskType, DtTaskMessageCallbackFcn fcn, void *usr)
 Deprecated form of removeTaskProcessorCallback.
virtual void enable ()
 Overridden to call registerTaskMsgCallbacks().
virtual void disable ()
 Overridden to 1) remove any task message callbacks registered by this controller 2) call clear task.
virtual void sendTaskCanceled (DtTaskMessage *taskMsg)
 Sends the task canceled report for the specified message.
virtual void setTasked (bool tasked)
 The current tasked state of this controller.
virtual bool tasked () const
 The current tasked state of this controller.
- Public Member Functions inherited from DtControllerComponent
 DtControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString& name,
virtual ~DtControllerComponent ()
 destructor
virtual DtSimBaseRadioradio ()
 The radio this component is listening to.
- Public Member Functions inherited from DtSimComponent
 DtSimComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
virtual ~DtSimComponent ()
 destructor
void setParentSystem (DtComponentSystem *system)
 Sets the parent system of this component.
virtual bool postAddComponentsInit ()
 Called after all components have been created, initialized and added to the component manager.
virtual void timedTick ()
 This version of tick checks to see if the time to tick has arrived.
virtual void setMinTickPeriod (double minTickPeriod)
 specifies a minimum tick period (which can also be thought of as
virtual double minTickPeriod () const
 access the minimum tick period
virtual void setMinTickPeriodVariance (double minTickPeriodVariance)
 set the variance in the minimum tick time
virtual double minTickPeriodVariance () const
 access the variance in the minimum tick period
virtual void setNextTickTime (double nextTickTime)
 The next tick time is normally calculated internally.
virtual double nextTickTime () const
 access the next tick time
virtual double calculateNextTickTime () const
 The next tick time is equal to mySimManager->exerciseClock()-> approximateElapsedRealTime() + myMinTickPeriod + a random # between -myMinTickPeriodVariance/2.
virtual double calculateFirstTickTime () const
 Returns the first time value that the component should tick at.
virtual void setEntity (DtVrfObject *entity)
 The entity's state repository is the place that actuator components make updates and other components look to see our current state.
virtual DtSimComponentnextComponent ()
 List management functions.
virtual DtSimComponentprevComponent ()
virtual void setListItem (DtListItem *item)
 Used by DtComponentList.
virtual DtListItem * listItem ()
virtual void putData (FILE *fp, int indentLevel=0)
 putData writes our type, which is provided by the virtual type accessor of the deriving class.
virtual DtlObjPtr getData (DtlObjPtr args, const DtFilename &searchPath, const DtVariableBindingsList &variableBindings)
 getData is just used to get us past the type in the data stream, since it's not actual stored.
virtual void addInputPort (DtInputPort *port)
 Adds this input port to the components input port list so that other components can look it up and attach to it.
virtual void removeInputPort (DtInputPort *port)
virtual DtInputPortlookupInputPort (const DtString &portName)
 Returns a pointer to the input port registered on this component with the specified name.
virtual DtList inputPortList () const
 Returns the list of DtInputPorts registered on this component.
virtual void addOutputPort (DtOutputPort *port)
 Adds this output port to the components output port list so that other components can look it up and attach to it.
virtual void removeOutputPort (DtOutputPort *port)
virtual DtOutputPortlookupOutputPort (const DtString &portName)
 Returns a pointer to the output port registered on this component with the specified name.
virtual DtList outputPortList () const
 Returns the list of DtOutputPorts registered on this component.
virtual void addInputPortGroup (DtInputPortGroup *group)
 Adds this input port to the components input port list so that other components can look it up and attach to it.
virtual void removeInputPortGroup (DtInputPortGroup *group)
virtual DtInputPortGrouplookupInputPortGroup (const DtString &groupName)
 Returns a pointer the input port group registered on this component with the specified name.
virtual DtList inputPortGroupList () const
 Returns the list of DtInputPortGroups registered on this component.
virtual void addOutputPortGroup (DtOutputPortGroup *group)
 Adds this output port group to the components output port group list so that other components can look it up and attach to it.
virtual void removeOutputPortGroup (DtOutputPortGroup *group)
virtual DtOutputPortGrouplookupOutputPortGroup (const DtString &groupName)
 Returns a pointer the output port group registered on this component with the specified name.
virtual DtList outputPortGroupList () const
 Returns the list of DtOutputPortGroups registered on this component.
virtual int priority () const
 Return the current connection priority for this component.
virtual void setPriority (int priority)
 Sets a new connection priority for this component, and changes all current outgoing connections from this component to the new value.
double dT () const
 This is the delta-t for this component, which may or may not be the same as the exerciseClock dT.
virtual void setDT (double deltaT)
 Note that while dT is calculated internally, this makes it possible to 'lie' to the component about dT if necessary.
virtual void setComponentDescriptor (DtComponentDescriptor *componentDescriptor)
 The component descriptor specified in the order of battle file or parameter file that was used to create this component.
virtual const
DtComponentDescriptor
componentDescriptor () const
DtVrfProcessStateRepositoryManagerpsrManager ()
virtual DtString componentFullName () const
virtual bool isEnabled ()
 Is this component enabled or not.
virtual void setIsEnabled (bool yesNo)
 Is this component enabled or not.
virtual DtOutputStream & objectConsoleDebug () const
virtual DtOutputStream & objectConsoleVerbose () const
virtual DtOutputStream & objectConsoleInfo () const
virtual DtOutputStream & objectConsoleWarn () const
virtual DtOutputStream & objectConsoleError () const
virtual DtSimResourceManagerresourceManager ()
virtual const
DtSimResourceManager
resourceManager () const
- Public Member Functions inherited from DtReaderWriter
 DtReaderWriter ()
 default constructor
 DtReaderWriter (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 real constructor Setting the readonly flag prevents object from writing itself to the stream.
 DtReaderWriter (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 DtReaderWriter (const DtString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 copy constructor
 DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
const DtReaderWriteroperator= (const DtReaderWriter &orig)
 assignment operator
virtual ~DtReaderWriter ()
 destructor
virtual void putSelf (FILE *fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 Top level call to write itself to file.
virtual void getSelf (DtlObjPtr args, const DtFilename &searchPath=DtFilename::nullFilename(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 Top level to read itself from an input stream.
virtual void writeSelf (FILE *fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 Called from putSelf, calls myRegistry.putSelf which in turn calls putSelf on each reader/writer in the registry.
virtual DtSymbolString name () const
 Accessor for name of this readable/writable object.
virtual void addAlias (const DtSymbolString &alias)
 Add an alias as an alternative name for this object.
virtual bool hasAlias (const DtSymbolString &alias)
virtual const aliasContaineraliases () const
virtual void setReadonly (bool flag)
 Set read-only flag.
virtual bool isReadonly () const
virtual bool variableIsBound () const
virtual void unbindVariable ()
 Sets the myVariableIsBound flag to false.
virtual void setName (const DtString &)
 Set the name of the object.
virtual const char * readerWriterType () const
 Used to supply a string type that this reader writer type is.
virtual DtString prettyPrint () const
 Routine to return a human readable form of the reader/writer variable.
virtual void bindVariables (DtVariableBindingsList variableBindings)
 Runs a variable binding pass on this reader writer and any of its children.
virtual std::list
< DtVariableNameType
unboundVariables () const
bool invalid () const
virtual bool hasChild (const DtReaderWriter *p) const
 Returns true if this variable has a child p in it's chain.
virtual void setValueSpecified (bool specified, bool recurse=false)
 The specified flags are used for optional values.
virtual bool valueSpecified () const
 The specified flags are used for optional values.
virtual bool isVariableReference () const
 Specifies whether or not this reader writer is really a variable that is specified elsewhere.
virtual void setIsVariableReference (bool value)
virtual DtSymbolString variableName () const
 The variable name, if this object is a variable reference.
virtual void setVariableName (const DtSymbolString variableName)
 The variable name, if this object is a variable reference.
const DtReaderWriterRegistryregistry () const
 Collection of child DtReaderWriter nodes owned by this object.
DtReaderWriterRegistryregistry ()
 Collection of child DtReaderWriter nodes owned by this object.

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 moveAlongCallback (DtSimMessage *msg, void *usr)
 Instances of this component will register this callback with their own 'this' pointer as user data with the msg executive requesting notification of rail-move-along tasks.
static void setConvoyFollowCallback (DtSimMessage *msg, void *usrData)
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

 DtRailMovementController ()
 default constructor - should not be called
 DtRailMovementController (const DtRailMovementController &orig)
 copy constructor
DtRailMovementControlleroperator= (const DtRailMovementController &orig)
 assignment operator
virtual bool createPSR ()
virtual void processSetting (const DtBoolSetting *setting)
 Sets myDrivingOnLeftEnabled with value in setting.
virtual void processSetConvoyFollowCallback (DtSimMessage *msg)
virtual bool initializeCurrentState (DtRailMoveAlongTask *task)
 When loading up from a scenario we need to find out where we were on the route and initialize from our process state repository.
virtual bool setUpRoute (const DtRwTemplatedListPtr< DtRwRailSegment > &path)
 Set up our path from the rail move along task's path.
virtual int entryLanePosition (double heading, unsigned int numLanes)
 Determines which lane we should be starting in.
virtual void checkMovementState (const int passingLane)
virtual void clearTask ()
 Override to clear route name and route state data stored in myProcessState.
virtual bool decideToGiveUpTask () const
 This function is used to determine if the controller should give up trying to execute the current task.
virtual int findObstructionsAndAdjust (DtRailObstructionFinder *obsFinder, const DtRailMovementDriver *railDriver, const DtVrfObject *entity, const DtVrfObject *convoyTgt, const int drivingLane, const int passingLane, double &drivingSpeed)
 Will always return a non-zero value for the lane to switch into.
virtual void testObstructionFinder (const int drivingLane, const double drivingSpeed)
 For debugging purposes.
- Protected Member Functions inherited from DtSingleTaskControllerComponent
virtual void clearPendingSubtasks ()
 Iterates over collection of all pending subtasks for this controller, and calls clearSubtask() for each subtask type.
virtual void clearSubtasksByType (const DtSimTaskMessageType &taskType)
 Clear all subtasks of a given type.

Protected Attributes

DtVector myLocalDestination
DtRailSegmentList myPath
DtRailSegmentListIterator myPathIterator
DtRailMovementControllerPSRmyProcessState
double myTurnDistanceSq
int myTurnDirection
bool myDrivingOnLeft
 Left is -1, right is 1 and 0 is straight.
DtVrfMovingObjectStateRepositorymyMovingStateRep
DtRailSegmentmyCurrentSegment
DtRailSegmentmyNextSegment
DtRailMovementDrivermyRailDriver
 Determines how the entity should move along the given rail path.
DtRailMovementUpdatermyRailUpdater
 Takes speed and lane input from the driver and updates the entity's position and orietation along the rail.
DtVector myPassingPoint
bool myNotInitialized
const DtRailMovementDescriptormyRailMoveDescriptor
DtRailObstructionFindermyObstructionFinder
std::list< DtStringmyTurnBugNameList
 List if debug "turn bug" object names created.

Additional Inherited Members

- Public Types inherited from DtReaderWriter
typedef std::vector
< DtSymbolString
aliasContainer
typedef std::vector
< DtSymbolString >::iterator 
aliasIter
typedef std::vector
< DtSymbolString >
::const_iterator 
aliasConstIter
typedef std::pair
< DtSymbolString, DtString
DtVariableNameType
- Protected Types inherited from DtTaskControllerComponent
typedef std::pair
< DtTaskMessageCallbackFcn,
void * > 
DtTaskCallbackMapPair
 This map stores callbacks that have been registered to processes various tasks.
typedef std::map
< DtSimTaskMessageType,
DtTaskCallbackMapPair
DtTaskCallbackMap
- Static Protected Attributes inherited from DtSimComponent
static DtSimComponentFactorymyFactory

Detailed Description

DtRailMovementController is a controller that models movement of an entity along a provided path as if it were locked on rails along each segment.

The path consists of a list of DtRailSegments. Each segment provides the heading along which the entity should be oriented and the speed which it should travel along the segment. Other attributes can be associated with the rail segment. Registers for interest in DtRailMoveAlongTasks.

Uses Descriptor Type: DtRailMovementDescriptor

Constructor & Destructor Documentation

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

virtual DtRailMovementController::~DtRailMovementController ( )
virtual

destructor

DtRailMovementController::DtRailMovementController ( )
protected

default constructor - should not be called

DtRailMovementController::DtRailMovementController ( const DtRailMovementController orig)
protected

copy constructor

Member Function Documentation

virtual DtString DtRailMovementController::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
DtRailMovementType

Implements DtTaskControllerComponent.

virtual bool DtRailMovementController::init ( )
virtual

Create and initialize our movement driver and updater.

Reimplemented from DtControllerComponent.

virtual void DtRailMovementController::preFirstTickInit ( )
virtual

Calls initializeCurrentState from the currentTaskMessage.

If it's unsuccessfull, calls clear() and taskComplete().

Reimplemented from DtSimComponent.

virtual void DtRailMovementController::tick ( )
virtual

Determines how the entity moves along the given path.Checks if entity has completed it's task.

The DtRailMovementDriver checks for upcoming intersections and determines appropriate behavior. Checks for entities in the way of the path and determines if possible to pass them. Determines the speed and lane position the entity needs and passes this to the DtRailMovementUpdater.Checks if entity has completed it's task.

Reimplemented from DtSimComponent.

virtual void DtRailMovementController::clear ( )
virtual
virtual bool DtRailMovementController::tickWhileDestroyed ( ) const
virtual

If the component returns true here, it will be ticked regardless of the destroyed state of the host entity.

Otherwise, tick will only be called when the entity is alive.

Returns
false.

Reimplemented from DtSimComponent.

static void DtRailMovementController::settingConsumerCallback ( const DtSettingsObject settingsObject,
void *  usr 
)
static

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

static void DtRailMovementController::moveAlongCallback ( DtSimMessage msg,
void *  usr 
)
static

Instances of this component will register this callback with their own 'this' pointer as user data with the msg executive requesting notification of rail-move-along tasks.

virtual void DtRailMovementController::processMoveAlongTask ( DtSimMessage msg)
virtual

Handle messages to move along a generated path.

These paths are generated by the DtRailPathPlanner in the DtMovementSelectorController.

virtual void DtRailMovementController::registerTaskMsgCallbacks ( )
virtual

Overrides this so it can register it's interest in RailMoveAlong commands.

Reimplemented from DtTaskControllerComponent.

static void DtRailMovementController::setConvoyFollowCallback ( DtSimMessage msg,
void *  usrData 
)
static
virtual void DtRailMovementController::setCurrentMovementState ( DtRailMovementState  state)
virtual
virtual DtRailMovementState DtRailMovementController::currentMovementState ( ) const
virtual
virtual DtRailSegment* DtRailMovementController::nextSegment ( )
virtual

Returns next segment in list.

The controller maintains an iterator into the list, and this function has the side effect of incrementing the iterator, and setting the myNextSegment member to *myPathIterator.

virtual DtRailSegment* DtRailMovementController::peekNextSegment ( ) const
virtual

Returns the next segment in the rail path list.

Unlike nextSegment, this function does not have any side effects; it returns *myPathIterator without changing it.

virtual bool DtRailMovementController::drivingOnLeftEnabled ( ) const
virtual
virtual const int DtRailMovementController::turnDirection ( ) const
virtual

Returns the direction we're turning.

virtual void DtRailMovementController::setTurnDirection ( const int  turn)
virtual
virtual bool DtRailMovementController::turning ( ) const
virtual
virtual void DtRailMovementController::setTurning ( bool  turn)
virtual
virtual const int DtRailMovementController::currentLane ( ) const
virtual

Set/get current lane position.

virtual void DtRailMovementController::setCurrentLane ( const int  lane)
virtual
virtual const int DtRailMovementController::passingLane ( ) const
virtual

Set/get passing lane, the lane an entity will move into when passing.

virtual void DtRailMovementController::setPassingLane ( const int  lane)
virtual
virtual void DtRailMovementController::setFollowThreshold ( const double  )
virtual

The maximum follow threshold.

Initialized by the descriptor. Maximum delta off of the follow distance tolerated.

virtual const double DtRailMovementController::followThreshold ( ) const
virtual
virtual const double DtRailMovementController::followSpeedFactor ( ) const
virtual

The factor by which we should multiple our speed if we are outside the follow threshold to catch up or slow down back into the threshold.

virtual DtRailSegmentList* DtRailMovementController::pathList ( )
virtual

Returns a pointer to our path list.

virtual const DtRailSegmentList* DtRailMovementController::pathList ( ) const
virtual
virtual bool DtRailMovementController::setUpDestination ( DtRailSegment seg,
bool  incrementSegmentIndex = true,
bool  useCurrentPos = false,
DtVector  pos = DtVector::zero() 
)
virtual

Sets myCurrentSeg to seg, this is the segment the entity is currently going to be moving along.

Uses this and the next segment to calculate the turn path if using turn smoothing. If the next segment is 0 we are on the last segment so there won't be any turning. incrementSegmentIndex indicates whether we are in fact setting up on a new segment and therefore should let the process state know we have moved to the next segment. This is the default, however if you are on the last segment or are loading up from a scenario this is not the case so pass false in.

double DtRailMovementController::getDistanceSqAlongSeg ( const DtRailSegment seg,
const DtVector point 
)

Finds the distance squared the point is along the given segment.

Return the distance (squared) from the start point of seg to the point projected onto the segment from the given test point. If the projected point is before the start point of the segment, the returned distance will be 0.0. However, if it is beyond the end point, the return value will reflect the distance from the start point to the projection of the test point on the ray containing the segment.

double DtRailMovementController::getDistanceBehindConvoyTarget ( DtVrfObject convoyTgt)

Finds the distance along the rail between this entity and the entity it is following if it is following.

virtual double DtRailMovementController::travelDistanceSq ( )
virtual

This is the minimum distance squared the enity will comfortably follow another entity in the same lane This is twice the bounding radius of the entity plus if using accleration includes the braking distance.

virtual bool DtRailMovementController::ifDrawDebugRoutes ( ) const
virtual

Whether or not to publish debugging turn route.

The first version just draws a polyline composed of the 3 points used to generate the turn spline. The second version draws a polyline with 10 or so points.

virtual void DtRailMovementController::drawDebugSplineTurnRoute ( const DtVector ee,
const DtVector md,
const DtVector ex 
)
virtual
virtual void DtRailMovementController::drawDebugSplineTurnRoute ( DtRailSplineCalculator spline)
virtual
virtual DtVrfObject* DtRailMovementController::getObjectFromObstruction ( DtRailObstructionPtr obs)
virtual
static DtSimComponent* DtRailMovementController::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.
DtRailMovementController& DtRailMovementController::operator= ( const DtRailMovementController orig)
protected

assignment operator

virtual bool DtRailMovementController::createPSR ( )
protectedvirtual
virtual void DtRailMovementController::processSetting ( const DtBoolSetting setting)
protectedvirtual

Sets myDrivingOnLeftEnabled with value in setting.

virtual void DtRailMovementController::processSetConvoyFollowCallback ( DtSimMessage msg)
protectedvirtual
virtual bool DtRailMovementController::initializeCurrentState ( DtRailMoveAlongTask task)
protectedvirtual

When loading up from a scenario we need to find out where we were on the route and initialize from our process state repository.

virtual bool DtRailMovementController::setUpRoute ( const DtRwTemplatedListPtr< DtRwRailSegment > &  path)
protectedvirtual

Set up our path from the rail move along task's path.

virtual int DtRailMovementController::entryLanePosition ( double  heading,
unsigned int  numLanes 
)
protectedvirtual

Determines which lane we should be starting in.

Currently just checks if we're driving on the left( british style) or the right side of the road and puts us in the far lane, the non-passing lanes.

virtual void DtRailMovementController::checkMovementState ( const int  passingLane)
protectedvirtual
virtual void DtRailMovementController::clearTask ( )
protectedvirtual

Override to clear route name and route state data stored in myProcessState.

Reimplemented from DtSingleTaskControllerComponent.

virtual bool DtRailMovementController::decideToGiveUpTask ( ) const
protectedvirtual

This function is used to determine if the controller should give up trying to execute the current task.

Override this function to provide the test for determining if the task controller should give up. For example, a derived move-to-waypoint controller tasked to reach an unreachable waypoint might decide to give up after a certain amount of time, or after circling the point and failing to reach it. This function is called from within tick. If the controller is tasked and this function returns true, it calls giveUp(). The implementation in this class always returns false.

Reimplemented from DtSingleTaskControllerComponent.

virtual int DtRailMovementController::findObstructionsAndAdjust ( DtRailObstructionFinder obsFinder,
const DtRailMovementDriver railDriver,
const DtVrfObject entity,
const DtVrfObject convoyTgt,
const int  drivingLane,
const int  passingLane,
double &  drivingSpeed 
)
protectedvirtual

Will always return a non-zero value for the lane to switch into.

If it's the same lane as the current lane, it does return the current lane.

virtual void DtRailMovementController::testObstructionFinder ( const int  drivingLane,
const double  drivingSpeed 
)
protectedvirtual

For debugging purposes.

Member Data Documentation

DtVector DtRailMovementController::myLocalDestination
protected
DtRailSegmentList DtRailMovementController::myPath
protected
DtRailSegmentListIterator DtRailMovementController::myPathIterator
protected
DtRailMovementControllerPSR* DtRailMovementController::myProcessState
protected
double DtRailMovementController::myTurnDistanceSq
protected
int DtRailMovementController::myTurnDirection
protected
bool DtRailMovementController::myDrivingOnLeft
protected

Left is -1, right is 1 and 0 is straight.

DtVrfMovingObjectStateRepository* DtRailMovementController::myMovingStateRep
protected
DtRailSegment* DtRailMovementController::myCurrentSegment
protected
DtRailSegment* DtRailMovementController::myNextSegment
protected
DtRailMovementDriver* DtRailMovementController::myRailDriver
protected

Determines how the entity should move along the given rail path.

Calculates the desired speed and lane position

DtRailMovementUpdater* DtRailMovementController::myRailUpdater
protected

Takes speed and lane input from the driver and updates the entity's position and orietation along the rail.

DtVector DtRailMovementController::myPassingPoint
protected
bool DtRailMovementController::myNotInitialized
protected
const DtRailMovementDescriptor* DtRailMovementController::myRailMoveDescriptor
protected
DtRailObstructionFinder* DtRailMovementController::myObstructionFinder
protected
std::list<DtString> DtRailMovementController::myTurnBugNameList
protected

List if debug "turn bug" object names created.

These are deleted when the task is complete.


The documentation for this class was generated from the following file:

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)