VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtSurfaceEntityMoveAlongController Class Reference

DtSurfaceEntityMoveAlongController is a controller that models movement of a ship along a route. More...

Inheritance diagram for DtSurfaceEntityMoveAlongController:
Inheritance graph
[legend]

Public Member Functions

 DtSurfaceEntityMoveAlongController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtSurfaceEntityMoveAlongController ()
 Destructor.
virtual const chartype () const
 Returns a string identifies the class type of component.
virtual bool init ()
 Calls the parent init, then registers the attribute provider functions.
virtual void clearTask ()
 Calls down to the base class and then calls allowDeactivation() on mySurfaceControlPortGroup.
virtual void processMoveAlongTask (DtSimMessage *msg)
 Retrieves the route name from the task message.
virtual void processRouteChanged (DtVrfObject *obj)
 Handles changes to the verticies in the route.
virtual bool atGoal ()
 Overridden to head to the next vertex in the route every time a vertex is reached until the end of the route is reached.
virtual bool passedGoal ()
 Overridden to head to the next vertex in the route every time a vertex is reached until the end of the route is reached.
virtual bool targetNextVertex ()
 virtual void doMoving(double desiredSpeed);
- Public Member Functions inherited from DtSurfaceEntityMoveToLocationController
 DtSurfaceEntityMoveToLocationController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtSurfaceEntityMoveToLocationController ()
 destructor
virtual void processMoveToLocationTask (DtSimMessage *msg)
 Retrieves the move to location from the task message.
virtual void initializeLocals (const DtVector &globalTarget)
 Initialize local variables and PSR data with the parameters of the task.
virtual void tick ()
 Overridden to check for valid myProcessState pointer.
- Public Member Functions inherited from DtSurfaceEntityPilotController
 DtSurfaceEntityPilotController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtSurfaceEntityPilotController ()
 Destructor.
virtual bool createSurfaceControlPortGroup ()
 Creates the surface control output port group.
- 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 void suspendTask ()
 This method is called when the currently running task is being suspended.
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 bool isSubtasked () const
 Returns true if this controller is currently subtasked.
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 DtSuspendedTaskInfosuspendTaskById (int taskId)
virtual std::list
< DtTaskMessage * > 
currentTaskMessages () const
 
virtual DtTaskWithTaskStateListPtr topLevelTasks () const
 
virtual DtPointTaskVisualizationPtr pointTaskVisualization (const DtString &name)
 Finds an existing or creates a new point task visualization with the given name.
virtual DtLineTaskVisualizationPtr lineTaskVisualization (const DtString &name)
 Finds an existing or creates a new line task visualization with the given name.
virtual DtAreaTaskVisualizationPtr areaTaskVisualization (const DtString &name)
 Finds an existing or creates a new area task visualization with the given name.
virtual DtTextTaskVisualizationPtr textTaskVisualization (const DtString &name)
 Finds an existing or creates a new text task visualization with the given name.
virtual void destroyTaskVisualization (const DtString &name)
 Destroys an existing task visualization.
- 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 (DtSimRadio *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.
DtTaskVisualizationMaptaskVisualizations ()
 Returns the list of task visualizations for this controller.
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 DtSimRadioradio ()
 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 void registerAttributeFunctions ()
 Called to register functions that provide system attribute values.
virtual void preFirstTickInit ()
 This function can be overridden to initialize a component before it is ticked for the first time.
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 DtReaderWriter::SearchPaths &searchPaths, 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
virtual bool tickWhileDestroyed () const
 If the component returns true here, it will be ticked regardless of the destroyed state of the host entity.
DtVrfProcessStateRepositoryManagerpsrManager ()
virtual DtString componentFullName () const
virtual DtPhysicalWorldphysicalWorld ()
 Gets the physical world that this component's entity exists in.
virtual const DtPhysicalWorldphysicalWorld () const
virtual DtAttachedTerrainterrainAttachedTo ()
 Gets the terrain that this component's entity is attached to, if any.
virtual const DtAttachedTerrainterrainAttachedTo () const
virtual DtVrfObjectentity ()
 Gets the entity.
virtual const DtVrfObjectentity () const
virtual DtSimManagersimManager ()
 Gets the sim manager.
virtual const DtSimManagersimManager () const
virtual const Coordinate_SystemcoordinateSystem () const
 Gets the coordinate system, as it should always exist if the physical world is in a valid state!
virtual Coordinate_SystemcoordinateSystem ()
virtual
DtVrfObjectStateRepository
localStateRepository ()
 Gets the local state repository.
virtual const
DtVrfObjectStateRepository
localStateRepository () 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 DtString &channel="") const
virtual DtOutputStream & objectConsoleVerbose (const DtString &channel="") const
virtual DtOutputStream & objectConsoleInfo (const DtString &channel="") const
virtual DtOutputStream & objectConsoleWarn (const DtString &channel="") const
virtual DtOutputStream & objectConsoleError (const DtString &channel="") 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)
 pseudo-copy constructor
 DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 DtReaderWriter (const DtReaderWriter &, DtReaderWriterRegistry *parentRegistry=NULL)
 copy constructor
const DtReaderWriteroperator= (const DtReaderWriter &orig)
 assignment operator
bool operator== (const DtReaderWriter &) const
 Equivalence operator.
bool operator!= (const DtReaderWriter &rhs)
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 postPutSelf ()
 Called after either version of put self (file or environment). Default is no-op.
virtual void prePutSelf ()
 Called before either version of put self (file or environment). Default is no-op.
virtual void getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 Top level to read itself from an input stream.
virtual void postGetSelf ()
 Called after either version of getSelf (mtl or environment). Default is no-op.
virtual void preGetSelf ()
 Called before either version of get self (file or environment). Default is no-op.
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 void addAlias (const DtString &alias)
virtual bool hasAlias (const DtSymbolString &alias)
virtual const aliasContaineraliases () const
virtual void setReadonly (bool flag)
 Set read-only flag.
virtual bool isReadonly () const
virtual void reset ()
 For those reader/writer items that support it, resets the reader/writer value to iriginal state Default is no-op.
virtual int alignment () const
 For those items that are sent over the network via HLA, this will give the network alignment.
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 charreaderWriterType () const
 Used to supply a string type that this reader writer type is.
virtual const charxmlType () const
virtual DtString prettyPrint () const
 Routine to return a human readable form of the reader/writer variable.
std::string debugText () const
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 bool hasVariableReference () const
 Returns true if this item or any item in the registry (recursive) is a variable reference.
virtual void bindLocalVariables (const DtVariableBindingsList &variableBindings)
 Checks to see if this RW object is a variable reference that can be bound using the provided bindings.
virtual void recordUpdateTime () const
 Can be implemented in subclasses to stamp the time when updated.
virtual bool wasUpdatedSince (DtTime t) const
 Can be implemented in subclasses to return true if an update occurred after the specified time.
virtual DtlObjPtr getData (DtlObjPtr args, const SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
 Deriving class overrides these to get/put class specific data.
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 void clearAllVariableReferenceFlags ()
 Clears out all variable reference flags from all readerwriter items in registry recursively.
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.
virtual const DtReaderWriterdefaultRWValue () const
 The default value to use if the reader/writer object is a variable and that variable is not specified.
virtual DtReaderWriterdefaultRWValue ()
 The default value to use if the reader/writer object is a variable and that variable is not specified.
virtual void setDefaultRWValue (DtReaderWriter *)
 Previous default value, if exists, will be removed and replaced with a clone of the supplied variable.
virtual bool checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 Give the stream, if the stream contains a default value then set it here.
const DtReaderWriterRegistryregistry () const
 Collection of child DtReaderWriter nodes owned by this object.
DtReaderWriterRegistryregistry ()
 Collection of child DtReaderWriter nodes owned by this object.
virtual DtPropertyInterfaceproperty ()
virtual const DtPropertyInterfaceproperty () const
virtual DtString toXml () const
virtual bool toXml (const DtFilename &) const
 Writes contents of xml result to the given filename.
virtual bool fromXml (const DtString &)
 Restores object from given xml string. Returns true if valid.
virtual bool fromXmlFile (const DtFilename &)
 Restires object from given xml file.
virtual void putSelf (DtEnvironmentSP, DtEnvValueSP parent) const
virtual void putData (DtEnvironmentSP, DtEnvValueSP value) const
 Override to add attributes of actual data.
virtual void putVariableReference (DtEnvironmentSP, DtEnvValueSP value) const
 Called when the item is a variable reference.
virtual void getSelf (const DtEnvironmentSP, const DtEnvValueSP root, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
virtual void getData (const DtEnvironmentSP, const DtEnvValueSP, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
 Gets data from the environment value.
virtual void unrecognizedItem (const DtEnvironmentSP env, const DtEnvValueSP root, const SearchPaths &searchPaths, const DtVariableBindingsList &varBindings)
 Called when the xml reader tries to parse an unknown reader/writer item. Default is a no-op.
virtual void getVariableReference (DtEnvironmentSP, DtEnvValueSP value)
 Called when the item is a variable reference.

Static Public Member Functions

static void moveAlongCallback (DtSimMessage *msg, void *usr)
 Called when a move along message is received.
static void routeChangedCallback (DtVrfObject *obj, void *user)
 Calls processRouteChanged().
static void objectAboutToBeRemovedCallback (DtVrfObject *obj, void *usr)
static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
static DtReaderWriterprovideCurrentMinTurnRadius (void *controller)
 Attribute access functions.
static DtReaderWriterprovideTurnRadiusForOrderedSpeed (void *controller)
 Provides the turn-radius-for-ordered-speed attribute for the surface entity movement system.
static DtReaderWriterprovideNextRoutePointIndex (void *controller)
 Provides the index of the route point the entity is moving towards.
- Static Public Member Functions inherited from DtSurfaceEntityMoveToLocationController
static void moveToLocationCallback (DtSimMessage *msg, void *usr)
 Called when a move to location message is received.
- Static Public Member Functions inherited from DtSurfaceEntityPilotController
static DtReaderWriterprovideOrderedSpeed (void *controller)
 Attribute access functions.

Protected Member Functions

 DtSurfaceEntityMoveAlongController ()
 default constructor; not implemented
 DtSurfaceEntityMoveAlongController (const DtSurfaceEntityMoveAlongController &orig)
 copy constructor; not implemented
const
DtSurfaceEntityMoveAlongController
operator= (const DtSurfaceEntityMoveAlongController &orig)
 assignment operator; not implemented
virtual bool getNextRoutePoint (int &index, DtVector *&point)
 Determines the next point along the route to use.
virtual DtVector previousRoutePoint ()
 Gets the previous route point, before the current aim point; used for computing the route direction to the aim point.
virtual void setStateForCurrentPoint ()
 Set up Process State for current route point.
virtual bool setupControlPoint ()
 Makes sure the route state is valid (in case this is the first tick since a scenario load).
virtual void controlMovement ()
 Executes the control function for the task, to produce control port outputs.
virtual void moveToMiddleOrFinalPoint ()
 Checks the PSR routeState to see if the current target point is the last in the route or not, and then calls MoveToWithFinalSpeed either with the orderedSpeed or 0.0 as the final speed.
virtual bool shouldMoveToRouteSegment (double &distanceToSegment)
 Tests the current position and orientation of the entity with respect to the current route segment (i.e., the direct line between the last route point and the current target route point) to determine if the entity should make some special maneuvers to move onto the route segment rather than just heading toward the target route point.
virtual void controlMovementToRouteSegment (double distanceToSegment)
 Controls the entity to move it toward the current route segment.
virtual DtReal computeStartTurnDistance2 ()
 Computes how far before the next control point the ship has to start turning toward the following route point to keep the ship close to the route without overshooting the control point.
virtual DtReal minTurnRadiusForSpeed (double speed) const
 Compute the minimum turn radius based on given speed, normal lateral acceleration, and minimum turn radius parameter.
virtual
DtVrfMovingObjectStateRepository
getSR ()
 Gets the entity state repository for purposes of providing attributes.
virtual DtSurfaceMovementPSRgetPSR ()
 Gets the process state repository for purposes of providing attributes.
virtual const
DtSurfaceEntityParameters
getParams ()
 Gets the entity parameters for the purposes of providing attributes.
virtual void registerTaskMsgCallbacks ()
 Registers interest in move along tasks by calling addTaskProcessorCallback with moveAlongCallback as the function pointer and the 'this' pointer as the user data.
virtual void emptyVertexList ()
 Removes and deletes vertices from the vertex list in process state repository (calls process state repository's emptyRouteVertices()).
virtual void processObjectAboutToBeRemoved (DtVrfObject *obj)
 Ends the task if the route object is removed.

Protected Attributes

double myMinManeuverDistance2
 Caches a threshold distance inside of which the entity will not consider moving to the route line, vs.
- Protected Attributes inherited from DtSurfaceEntityMoveToLocationController
DtLocation3D myEntityPoint
 These data are computed each tick and used later in the same tick.
DtBoolean myPassedGoal
DtBoolean myAtGoal
DtVector2D myCurrentGoalToEntity2DVector
DtVector2D myCurrentEntityToGoal2DVector
DtLocation3D myAimingPoint
 Note: in general, this is not.
- Protected Attributes inherited from DtSurfaceEntityPilotController
DtVrfMovingObjectStateRepositorymyEntityState
DtSurfaceEntityPilotControllerDescriptormyDescriptor
const DtSurfaceEntityParametersmyParameters
 Cache a pointer to the entity parameters.
DtSurfaceMovementPSRmyProcessState
 Pointer to a process state repository used to store state data associated with this component.
double myDistanceSquared
 A controller-global value that several functions test.
DtAnalogOutputPortmyAccelerationPort
 The goal speed; used by the actuator to prevent accelerating past the desired speed if dT is much longer than expected.
DtAnalogOutputPortmyClampSpeedPort
 The goal speed; used by the actuator to prevent accelerating past the desired speed if dT is much longer than expected.
DtAnalogOutputPortmyTurnRatePort
 Rotation rate in radians/sec. Positive is to the right.
DtAnalogOutputPortmyFinalHeadingPort
 A clamp heading, similar to clamp speed.
DtOutputPortGroupmySurfaceControlPortGroup
 Output Port Group Name: surface-control
Output Port Group Description: acceleration, clamp speed, turn rate, and final heading ports.

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::vector< DtFilename > SearchPaths
typedef std::pair
< DtSymbolString, DtString
DtVariableNameType
typedef DtReaderWriterFactory *(* DtReaderWriterFactoryCreatorFcn )()
- 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

DtSurfaceEntityMoveAlongController is a controller that models movement of a ship along a route.

End User Description: DtSurfaceEntityMoveAlongController (surfEntMvAlgCtl.h) is derived from DtSurfaceEntityMoveToLocationController.
It overrides DtTaskControllerComponent::registerTaskMsgCallbacks() and registers the callback function moveAlongCallback() for DtMoveAlongType. When a message is received, the callback invokes processMoveAlongTask(), which looks up the route in the object manager and stores a pointer to it in myRoute.
Uses Descriptor Type: DtSurfaceEntityPilotControllerDescriptor

Constructor & Destructor Documentation

DtSurfaceEntityMoveAlongController::DtSurfaceEntityMoveAlongController ( 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 DtSurfaceEntityMoveAlongController::~DtSurfaceEntityMoveAlongController ( )
virtual

Destructor.

Removes any remaining vertices changed callback added by processMoveAlongTask. Deletes myControlPoint. Calls emptyVertexList().

DtSurfaceEntityMoveAlongController::DtSurfaceEntityMoveAlongController ( )
protected

default constructor; not implemented

DtSurfaceEntityMoveAlongController::DtSurfaceEntityMoveAlongController ( const DtSurfaceEntityMoveAlongController orig)
protected

copy constructor; not implemented

Member Function Documentation

virtual const char* DtSurfaceEntityMoveAlongController::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. Warning: this function should always return the same pointer and it should be valid forever. This means the data should be static.

Returns
DtSurfaceEntityMoveAlongType

Reimplemented from DtSurfaceEntityMoveToLocationController.

Reimplemented in DtSurfaceEntityPatrolRouteController.

virtual bool DtSurfaceEntityMoveAlongController::init ( )
virtual

Calls the parent init, then registers the attribute provider functions.

Reimplemented from DtSurfaceEntityPilotController.

virtual void DtSurfaceEntityMoveAlongController::clearTask ( )
virtual

Calls down to the base class and then calls allowDeactivation() on mySurfaceControlPortGroup.

Reimplemented from DtSurfaceEntityPilotController.

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

Called when a move along message is received.

Instances of this component will register this callback (with their own 'this' pointer as user data) by calling addTaskProcessorCallback in order to request for notification of move-along tasks. When this callback is activated, the user data pointer is cast to an instance of this class upon which processMoveAlongTask is called with the move along message.

virtual void DtSurfaceEntityMoveAlongController::processMoveAlongTask ( DtSimMessage msg)
virtual

Retrieves the route name from the task message.

Called by moveAlongCallback to lookup the route stored in the move to message and store a pointer to it in myRoute. The name of the route and the reverse flag are saved in the process state repository. A verticies changed callback is registered on the route with routeChangedCallback as the function pointer. The myRouteHasChanged flag is then set to false. Start at closest point is checked, and setCurrentVertexToClosestInDirectionOfTraversal() is used to set the current route point. Finally, setupControlPoint() is called.

static void DtSurfaceEntityMoveAlongController::routeChangedCallback ( DtVrfObject obj,
void *  user 
)
static

Calls processRouteChanged().

Casts the user data pointer to an instance of this class upon which it calls processRouteChanged() with the object pointer.

static DtReaderWriter* DtSurfaceEntityMoveAlongController::provideCurrentMinTurnRadius ( void *  controller)
static

Attribute access functions.

These functions are registered with the parent system in init().

Provides the current-min-turn-radius attribute for the surface entity movement system. This is computed from current speed and maximum lateral acceleration. It also considers the entity's minimum turn radius parameter.

static DtReaderWriter* DtSurfaceEntityMoveAlongController::provideTurnRadiusForOrderedSpeed ( void *  controller)
static

Provides the turn-radius-for-ordered-speed attribute for the surface entity movement system.

Depends on maximum lateral acceleration; it also considers the entity's minimum turn radius and maximum speed parameters. This attribute is useful when planning a route that will be followed at the ordered speed, regardless of what the current entity speed is now.

static DtReaderWriter* DtSurfaceEntityMoveAlongController::provideNextRoutePointIndex ( void *  controller)
static

Provides the index of the route point the entity is moving towards.

virtual void DtSurfaceEntityMoveAlongController::processRouteChanged ( DtVrfObject obj)
virtual

Handles changes to the verticies in the route.

Checks to make sure that the route is not null, that it's name matches the name stored in the process state repository, and that the controller is tasked. Iterates over the vertices in the route and compares them to the route vertices stored in the process state repository. If one of the verticies differs, myRouteHasChanged is set to true.

virtual bool DtSurfaceEntityMoveAlongController::atGoal ( )
virtual

Overridden to head to the next vertex in the route every time a vertex is reached until the end of the route is reached.

Calls down to DtSurfaceEntityMoveToController::atGoal() to determine if the current vertex has been reached. If not, false is returned. If the base class returns true, targetNextVertex is called to advance the target waypoint. If this call returns false, it indicates that the last vertex in the route has been reached and atGoal will return true.

Reimplemented from DtSurfaceEntityMoveToLocationController.

virtual bool DtSurfaceEntityMoveAlongController::passedGoal ( )
virtual

Overridden to head to the next vertex in the route every time a vertex is reached until the end of the route is reached.

Calls down to DtSurfaceEntityMoveToController::passedGoal() to determine if the current vertex has been passed. If not, false is returned. If the base class returns true, targetNextVertex is called to advance the target waypoint. If this call returns false, it indicates that the last vertex in the route has been passed and passedGoal will return true.

Reimplemented from DtSurfaceEntityMoveToLocationController.

virtual bool DtSurfaceEntityMoveAlongController::targetNextVertex ( )
virtual

virtual void doMoving(double desiredSpeed);

Advance to the next vertex in the route state.

Checks to see if the current vertex stored in the route state of the process state repository is the last vertex in the route. If so, false is returned. If not, the route state is advanced and setupControlPoint() is called. If successful, doMoving is called with findDesiredSpeed. If not, false is returned.

Reimplemented in DtSurfaceEntityPatrolRouteController.

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

Reimplemented from DtSurfaceEntityMoveToLocationController.

Reimplemented in DtSurfaceEntityPatrolRouteController.

const DtSurfaceEntityMoveAlongController& DtSurfaceEntityMoveAlongController::operator= ( const DtSurfaceEntityMoveAlongController orig)
protected

assignment operator; not implemented

virtual bool DtSurfaceEntityMoveAlongController::getNextRoutePoint ( int &  index,
DtVector *&  point 
)
protectedvirtual

Determines the next point along the route to use.

Starting from the current route point, the function walks down the route points until a threshold distance is reached. The last point before this threshold is taken as the next point. This procedure is necessary to let the entity look ahead some when the route points are very close together. Ideally the move-along controller would plan a fine-motion path between closely spaced downstream points so as to best stay on the route; skipping ahead some distance is a rough substitute for such planning. The gotcha is the waypoint just beyond this threshold where the path may make a sharp turn.
Uses the current turn radius as a threshold.
Provides the index of the next point, and the next point that are more than the threshold beyond the current point, and returns true in the normal case. If the current point is the last point in the route, then the index and point will be the same as the current point, and the function returns false. If there are more points in the route beyond the current point, but the route ends before the threshold distance, then the index and point for the last point in the route are provided, and the function returns false.

virtual DtVector DtSurfaceEntityMoveAlongController::previousRoutePoint ( )
protectedvirtual

Gets the previous route point, before the current aim point; used for computing the route direction to the aim point.

Uses the PSR prevRouteIndex.

virtual void DtSurfaceEntityMoveAlongController::setStateForCurrentPoint ( )
protectedvirtual

Set up Process State for current route point.

Sets the localAimPoint, startTurnDistance2, and goalVector in the process state repository for the current point in the routeState. This is called when a new route task is processed, when the route is changed, and when the entity arrives at a point and sets up the next point.

virtual bool DtSurfaceEntityMoveAlongController::setupControlPoint ( )
protectedvirtual

Makes sure the route state is valid (in case this is the first tick since a scenario load).

Reimplemented from DtSurfaceEntityMoveToLocationController.

virtual void DtSurfaceEntityMoveAlongController::controlMovement ( )
protectedvirtual

Executes the control function for the task, to produce control port outputs.

Executes the control function for the task for normal movement along a route; i.e. it moves directly toward the next route point. For the move-along-route controller, this function calls shouldMoveToRouteSegment() and possibly controlMovementToRouteSegment(); otherwise calls moveToMiddleOrFinalPoint().

Reimplemented from DtSurfaceEntityMoveToLocationController.

virtual void DtSurfaceEntityMoveAlongController::moveToMiddleOrFinalPoint ( )
protectedvirtual

Checks the PSR routeState to see if the current target point is the last in the route or not, and then calls MoveToWithFinalSpeed either with the orderedSpeed or 0.0 as the final speed.

Reimplemented in DtSurfaceEntityPatrolRouteController.

virtual bool DtSurfaceEntityMoveAlongController::shouldMoveToRouteSegment ( double &  distanceToSegment)
protectedvirtual

Tests the current position and orientation of the entity with respect to the current route segment (i.e., the direct line between the last route point and the current target route point) to determine if the entity should make some special maneuvers to move onto the route segment rather than just heading toward the target route point.


Returns
True if the entity is in a condition in which it should move toward the route segment line; false if the entity should just move toward the next route point.
Parameters
distanceToSegmentis the distance from the entity to the current segment of the route that the entity is following; it is computed in this function, and passed back for use by the calling code. This output parameter is undefined if the function returns false.
virtual void DtSurfaceEntityMoveAlongController::controlMovementToRouteSegment ( double  distanceToSegment)
protectedvirtual

Controls the entity to move it toward the current route segment.

Parameters
distanceToSegmentis the distance of the entity from the route segment it is currently following.
virtual DtReal DtSurfaceEntityMoveAlongController::computeStartTurnDistance2 ( )
protectedvirtual

Computes how far before the next control point the ship has to start turning toward the following route point to keep the ship close to the route without overshooting the control point.

Returns the square of this distance. Looks at the heading change required to the following point, estimates the turning radius the ship will take based on its speed and lateral acceleration limit, and determines where the circular turn path will start.

virtual DtReal DtSurfaceEntityMoveAlongController::minTurnRadiusForSpeed ( double  speed) const
protectedvirtual

Compute the minimum turn radius based on given speed, normal lateral acceleration, and minimum turn radius parameter.

virtual DtVrfMovingObjectStateRepository* DtSurfaceEntityMoveAlongController::getSR ( )
inlineprotectedvirtual

Gets the entity state repository for purposes of providing attributes.

Reimplemented from DtSurfaceEntityPilotController.

References DtSurfaceEntityPilotController::myEntityState.

virtual DtSurfaceMovementPSR* DtSurfaceEntityMoveAlongController::getPSR ( )
inlineprotectedvirtual

Gets the process state repository for purposes of providing attributes.

References DtSurfaceEntityPilotController::myProcessState.

virtual const DtSurfaceEntityParameters* DtSurfaceEntityMoveAlongController::getParams ( )
inlineprotectedvirtual

Gets the entity parameters for the purposes of providing attributes.

References DtSurfaceEntityPilotController::myParameters.

virtual void DtSurfaceEntityMoveAlongController::registerTaskMsgCallbacks ( )
protectedvirtual

Registers interest in move along tasks by calling addTaskProcessorCallback with moveAlongCallback as the function pointer and the 'this' pointer as the user data.

Reimplemented from DtSurfaceEntityMoveToLocationController.

Reimplemented in DtSurfaceEntityPatrolRouteController.

virtual void DtSurfaceEntityMoveAlongController::emptyVertexList ( )
protectedvirtual

Removes and deletes vertices from the vertex list in process state repository (calls process state repository's emptyRouteVertices()).

virtual void DtSurfaceEntityMoveAlongController::processObjectAboutToBeRemoved ( DtVrfObject obj)
protectedvirtual

Ends the task if the route object is removed.

Member Data Documentation

double DtSurfaceEntityMoveAlongController::myMinManeuverDistance2
protected

Caches a threshold distance inside of which the entity will not consider moving to the route line, vs.

heading directly to the route point.


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

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)