![]() |
VR-Forces 4.0.4 Class Documentation
|
DtGroundMoveAlongControllerComponent is a controller that models movement of a ground entity along a route. More...

Public Member Functions | |
| DtGroundMoveAlongControllerComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtGroundMoveAlongControllerComponent () |
| destructor | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | tick () |
| Override to try and look up route if we start out with a move-along route task. | |
| virtual void | processMoveAlongTask (DtSimMessage *msg) |
| Handle messages to move along a route or assume a move along task from another. | |
| virtual void | processRouteChanged (DtVrfObject *obj) |
| virtual void | registerTaskMsgCallbacks () |
| Overrides this so it can register it's interest in MoveAlong commands. | |
| virtual bool | setupRoute () |
| Look up the route by name, and set myRoute if found. | |
| virtual bool | setupDestination () |
| Sets myControlPoint to the position of the route's current vertex. | |
| virtual double | findDesiredSpeed () |
| Overrides so the entity will slow down when coming to large turns in the route, but not slowdown/stop if the turn is small. | |
| virtual double | findCosTurnAngle () |
| Returns the cos of the angle of the next turn in the route. | |
| virtual void | stop () |
| Overrides to advance to the next vertex rather then actually stop when a vertex is reached. | |
Static Public Member Functions | |
| 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 move-along tasks. | |
| static void | routeChangedCallback (DtVrfObject *obj, void *usr) |
| Handle messages that may indicate the route we're following has changed. | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| static void | objectAddedCb (DtVrfObject *vrfObject, void *usr) |
| Calls processObjectAdded(). | |
Protected Member Functions | |
| DtGroundMoveAlongControllerComponent () | |
| default constructor - should not be called | |
| DtGroundMoveAlongControllerComponent (const DtGroundMoveAlongControllerComponent &orig) | |
| copy constructor | |
| DtGroundMoveAlongControllerComponent & | operator= (const DtGroundMoveAlongControllerComponent &orig) |
| assignment operator | |
| virtual void | buildLocalRoute () |
| builds the local copy of the route by copying myRoute's vertices to my local storage in process state repository: myVertices. | |
| virtual void | emptyVertexList () |
| removes and deletes vertices from the vertex list in process state repository (calls process state repository's emptyRouteVertices()). | |
| virtual void | processObjectAdded (DtVrfObject *vrfObject) |
| Checks given vrfObject against the route we're looking for. | |
| virtual void | clearTask () |
| Override to clear route name and route state data stored in myProcessState. | |
| virtual bool | decideToGiveUpTask () const |
| Checks to see if destination is inside an obstruction. | |
Protected Attributes | |
| DtVrfObject * | myRoute |
| This is looked up once per tick - assumed unchanging while we have control. | |
| bool | myRouteHasChanged |
| This gets set to true when a modifyRoute message for the route we're following is received. | |
| bool | myResetVertex |
| bool | myFirstTick |
| int | myPreviousVertex |
DtGroundMoveAlongControllerComponent is a controller that models movement of a ground entity along a route.
Uses Descriptor Type: DtGroundMoveToDescriptor
| DtGroundMoveAlongControllerComponent::DtGroundMoveAlongControllerComponent | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtGroundMoveAlongControllerComponent::~DtGroundMoveAlongControllerComponent | ( | ) | [virtual] |
destructor
default constructor - should not be called
| DtGroundMoveAlongControllerComponent::DtGroundMoveAlongControllerComponent | ( | const DtGroundMoveAlongControllerComponent & | orig | ) | [protected] |
copy constructor
| virtual DtString DtGroundMoveAlongControllerComponent::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.
Reimplemented from DtGroundMoveToDestinationControllerComponent.
Reimplemented in DtGroundPatrolRouteController.
| virtual void DtGroundMoveAlongControllerComponent::tick | ( | ) | [virtual] |
Override to try and look up route if we start out with a move-along route task.
Register an objectAddedCallback if route not found yet.
Reimplemented from DtGroundMoveToDestinationControllerComponent.
| static void DtGroundMoveAlongControllerComponent::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 move-along tasks.
| virtual void DtGroundMoveAlongControllerComponent::processMoveAlongTask | ( | DtSimMessage * | msg | ) | [virtual] |
Handle messages to move along a route or assume a move along task from another.
| static void DtGroundMoveAlongControllerComponent::routeChangedCallback | ( | DtVrfObject * | obj, |
| void * | usr | ||
| ) | [static] |
Handle messages that may indicate the route we're following has changed.
| virtual void DtGroundMoveAlongControllerComponent::processRouteChanged | ( | DtVrfObject * | obj | ) | [virtual] |
| virtual void DtGroundMoveAlongControllerComponent::registerTaskMsgCallbacks | ( | ) | [virtual] |
Overrides this so it can register it's interest in MoveAlong commands.
Reimplemented from DtGroundMoveToDestinationControllerComponent.
Reimplemented in DtGroundPatrolRouteController.
| static DtSimComponent* DtGroundMoveAlongControllerComponent::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
Reimplemented from DtGroundMoveToDestinationControllerComponent.
Reimplemented in DtGroundPatrolRouteController.
| virtual bool DtGroundMoveAlongControllerComponent::setupRoute | ( | ) | [virtual] |
Look up the route by name, and set myRoute if found.
Looks up the route in the Control Manager. If it does not find the route, it returns false. Otherwise, it sets the myRoute member to point to the object found. setupRoute() then checks the myRouteChanged flag. If myRouteChanged is true, it calls the route object’s resyncRouteState() member function to update the current DtRouteState. setupRoute() then returns true.
| virtual bool DtGroundMoveAlongControllerComponent::setupDestination | ( | ) | [virtual] |
Sets myControlPoint to the position of the route's current vertex.
If setupRoute() returns false, setupControlPoint() calls taskComplete() and returns false. Otherwise, it sets the position of the myControlPoint member variable to the position of myRoute’s current vertex. If myRouteHasChanged is true, setupGoalVector() is called, and myRouteHasChanged is set to false. true is then returned.
Reimplemented from DtGroundMoveToDestinationControllerComponent.
| virtual double DtGroundMoveAlongControllerComponent::findDesiredSpeed | ( | ) | [virtual] |
Overrides so the entity will slow down when coming to large turns in the route, but not slowdown/stop if the turn is small.
Checks the myNearGoal member variable. If myNearGoal is false, the desired speed is simply the ordered speed. If myNearGoal is true, findDesiredSpeed() next checks to see if the entity is moving toward the last vertex in the route. If it is, then the desired speed in the approach speed parameter specified in the DtGroundMoveToDescriptor. If myNearGoal is true and the entity is not approaching the last vertex, findDesiredSpeed() calls the function findCosTurnAngle() to get a measure of the turn that may be required when the current vertex is reached. If the turn angle is less than 30 degrees then the desired speed is the speed which the entity has been ordered to go. If the turn angle is between 30 and 45 degrees, then the desired speed is the mean of the ordered speed and the approach speed parameter. If the turn angle is greater than 45 degrees, the desired speed is the approach speed parameter. In all cases above, if the current gear is DtAutoGearReverse, the desired speed is negated before being returned.
Reimplemented from DtGroundMoveToDestinationControllerComponent.
| virtual double DtGroundMoveAlongControllerComponent::findCosTurnAngle | ( | ) | [virtual] |
Returns the cos of the angle of the next turn in the route.
| virtual void DtGroundMoveAlongControllerComponent::stop | ( | ) | [virtual] |
Overrides to advance to the next vertex rather then actually stop when a vertex is reached.
Checks to see if the entity is currently moving to the last vertex in the route. If so, DtGroundMoveToControllerComponent::stop() is called. Otherwise, myProcessState->routeState()->next() is called, followed by setupControlPoint() and setupGoalVector().
Reimplemented from DtGroundMoveToDestinationControllerComponent.
Reimplemented in DtGroundPatrolRouteController.
| static void DtGroundMoveAlongControllerComponent::objectAddedCb | ( | DtVrfObject * | vrfObject, |
| void * | usr | ||
| ) | [static] |
Calls processObjectAdded().
| DtGroundMoveAlongControllerComponent& DtGroundMoveAlongControllerComponent::operator= | ( | const DtGroundMoveAlongControllerComponent & | orig | ) | [protected] |
assignment operator
| virtual void DtGroundMoveAlongControllerComponent::buildLocalRoute | ( | ) | [protected, virtual] |
builds the local copy of the route by copying myRoute's vertices to my local storage in process state repository: myVertices.
(calls process state repository's setRouteVertices()).
| virtual void DtGroundMoveAlongControllerComponent::emptyVertexList | ( | ) | [protected, virtual] |
removes and deletes vertices from the vertex list in process state repository (calls process state repository's emptyRouteVertices()).
| virtual void DtGroundMoveAlongControllerComponent::processObjectAdded | ( | DtVrfObject * | vrfObject | ) | [protected, virtual] |
Checks given vrfObject against the route we're looking for.
If it is ours, registers a vertices-changed callback on the object. This way we can detect if the route changes while we're trying to follow it.
| virtual void DtGroundMoveAlongControllerComponent::clearTask | ( | ) | [protected, virtual] |
Override to clear route name and route state data stored in myProcessState.
Reimplemented from DtGroundAutoControllerComponent.
| virtual bool DtGroundMoveAlongControllerComponent::decideToGiveUpTask | ( | ) | const [protected, virtual] |
Checks to see if destination is inside an obstruction.
If it is, returns true. Otherwise it returns the value of DtGroundAutoControllerComponent::decideToGiveUpTask()
Reimplemented from DtGroundMoveToDestinationControllerComponent.
DtVrfObject* DtGroundMoveAlongControllerComponent::myRoute [protected] |
This is looked up once per tick - assumed unchanging while we have control.
This gets set to true when a modifyRoute message for the route we're following is received.
int DtGroundMoveAlongControllerComponent::myPreviousVertex [protected] |