![]() |
VR-Forces 4.0.4 Class Documentation
|
DtFixedWingMoveToController is a controller used to model the movement of a fixed wing entity to a specific waypoint. More...

Public Member Functions | |
| DtFixedWingMoveToController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtFixedWingMoveToController () |
| destructor | |
| virtual void | tick () |
| Calculate new control values. | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| bool | setMovementStatusFromControlPoint () |
| Looks at the control point and the entity and determines which type of move to case is appropriate. | |
| virtual void | doFinishing () |
| Based on the current Movement status of the entity, calls the appropriate doFinishing function. | |
| virtual void | doFinishingForFlying () |
| Checks to see if the entity is within two seconds of being at the waypoint, or if the entity’s distance from the waypoint is greater than it was the previous frame (by comparing myProcessState->distanceSquared() to myProcessState->lastDistanceSquared()). | |
| virtual void | doFinishingForTaxiing () |
| Only called if the entity is near its goal. | |
| virtual void | doMoving () |
| Determines what state the entity is currently in and then calls the appropriate doMoving function for that state. | |
| virtual void | doFlying () |
| Determines if the entity is five seconds or fewer away from being at the waypoint using the entity’s speed and myDistanceSquared. | |
| virtual void | doTaxiing () |
| Determines if the entity is near its goal. | |
| virtual void | doTakeOff () |
| Changes the ordered speed to be the max ground speed and then taxi's in the direction of the waypoint. | |
| virtual void | updateTakeOffDirection () |
| Calculates and sets a new direction vector using the current waypoint to move to and the current position of the entity. | |
| virtual double | findDesiredSpeed () |
| This function returns the appropriate speed for the movement status of the FWE. | |
| virtual bool | nearGoal () |
| Determines if the entity is close enough to the waypoint that it can be considered near its goal. | |
| virtual bool | atGoal () |
| Determines if the entity is "at" the goal. | |
| virtual bool | passedGoal () |
| Determines if the entity will taxi passed the control point to which it is moving this frame if it continues at its current velocity and acceleration. | |
| virtual void | taskComplete (bool success=true) |
| Overridden to set all internal state (i.e. | |
| virtual void | processMoveToTask (DtSimMessage *msg) |
| Callback functions to execute when messages registered for are received. | |
| virtual void | processMoveToAltitudeTask (DtSimMessage *msg) |
| virtual void | processSetAltitude (DtSimMessage *msg) |
| Changes the entities altitude/position to the user specified value. | |
| virtual void | processSetLocation (DtSimMessage *msg) |
| virtual void | processSetRestore (DtSimMessage *msg) |
| virtual void | processWaypointChanged (DtVrfObject *msg) |
| virtual void | processModifyVrfObject (DtSimMessage *msg) |
| If the entity is tasked, the control point is valid, and the object moved was the entity, then this resets any state associated with the previous location of the FWE when the location of the entity to which this controller is attached is changed through a DtIfModifyVrfObject message (i.e. | |
| virtual void | processDeleteVrfObject (DtVrfObject *msg) |
| Makes sure to update the state of the controller appropriately if either the waypoint or any other relevent vrfobject was deleted. | |
| virtual bool | createWorkingControlPoint (const DtVector location) |
| Creates a new "phantom" waypoint at the current location of the FWE, but at an altitude specified by the MoveToAltitude task. | |
| virtual void | registerTaskMsgCallbacks () |
| Overrides this so it can register its interest in MoveTo commands and all other messages described in the above functions. | |
Static Public Member Functions | |
| static void | moveToCallback (DtSimMessage *msg, void *usr) |
| Instances of this component will register these callbacks with their own 'this' pointer as user data with the msg executive requesting notification of the appropriate tasks and setDataRequests. | |
| static void | moveToAltitudeCallback (DtSimMessage *msg, void *usr) |
| static void | setAltitudeCallback (DtSimMessage *msg, void *usrData) |
| static void | setLocationCallback (DtSimMessage *msg, void *usrData) |
| static void | setRestoreCallback (DtSimMessage *msg, void *usrData) |
| static void | waypointChangedCallback (DtVrfObject *msg, void *usr) |
| static void | modifyVrfObjectCallback (DtSimMessage *msg, void *usr) |
| Calls processModifyVrfObject. | |
| static void | deleteVrfObjectCallback (DtVrfObject *msg, void *usr) |
| Callback for getting DtDeleteVrfObject messages. | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual void | getLocalDestination (DtVector &local) const |
| virtual void | getWorldDestination (DtVector &world) const |
| virtual double | distanceSquaredToDestination (const DtVector ¤t) const |
| Returns distance squared from destination point to current location. | |
| virtual double | distanceSquaredToDestination2D (const DtVector ¤t) const |
| virtual bool | atAltitude (double desiredAltitude) const |
| virtual bool | setupControlPoint () |
| Sets up initial information for where the fixed wing wants to move to. | |
| virtual void | clearTask () |
| Override to set myControlPoint to NULL. | |
Protected Attributes | |
| DtVrfObject * | myControlPoint |
| This is looked up once per tick - assumed unchanging while we have control. | |
| DtVrfObject * | myWorkingControlPoint |
| Locally allocated waypoint for use in moving to an altitude. | |
| bool | myFirstTick |
Private Member Functions | |
| DtFixedWingMoveToController () | |
| default constructor - should not be called | |
| DtFixedWingMoveToController (const DtFixedWingMoveToController &orig) | |
| copy constructor | |
| DtFixedWingMoveToController & | operator= (const DtFixedWingMoveToController &orig) |
| assignment operator | |
DtFixedWingMoveToController is a controller used to model the movement of a fixed wing entity to a specific waypoint.
Uses Descriptor Type: DtFixedWingPilotControllerDescriptor
| DtFixedWingMoveToController::DtFixedWingMoveToController | ( | 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 DtFixedWingMoveToController::~DtFixedWingMoveToController | ( | ) | [virtual] |
destructor
| DtFixedWingMoveToController::DtFixedWingMoveToController | ( | ) | [private] |
default constructor - should not be called
| DtFixedWingMoveToController::DtFixedWingMoveToController | ( | const DtFixedWingMoveToController & | orig | ) | [private] |
copy constructor
| virtual void DtFixedWingMoveToController::tick | ( | ) | [virtual] |
Calculate new control values.
If myWaitingToSetMovementStatus is set in myProcessState, then setMovementStatusFromRoute is called to see if the required terrain data is now available.
Reimplemented from DtFixedWingPilotController.
Reimplemented in DtFixedWingFollowEntityController.
| virtual DtString DtFixedWingMoveToController::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 DtFixedWingPilotController.
Reimplemented in DtFixedWingFlyIntoController, DtFixedWingFollowEntityController, DtFixedWingPatrolBetweenController, and DtFixedWingMoveToLocationController.
Looks at the control point and the entity and determines which type of move to case is appropriate.
Either taxiing, take off, landing, or flight. NOTE: The following objects must be valid before this function can be called or it will fail:
| virtual void DtFixedWingMoveToController::doFinishing | ( | ) | [virtual] |
Based on the current Movement status of the entity, calls the appropriate doFinishing function.
Reimplemented in DtFixedWingPatrolBetweenController.
| virtual void DtFixedWingMoveToController::doFinishingForFlying | ( | ) | [virtual] |
Checks to see if the entity is within two seconds of being at the waypoint, or if the entity’s distance from the waypoint is greater than it was the previous frame (by comparing myProcessState->distanceSquared() to myProcessState->lastDistanceSquared()).
If so, all port values are set to 0.0, myFinishing is set to false, and taskComplete() is called. Otherwise, flyTo() is called, and myProcessState->lastDistanceSquared() is set to myDistanceSquared.
| virtual void DtFixedWingMoveToController::doFinishingForTaxiing | ( | ) | [virtual] |
Only called if the entity is near its goal.
Checks to see if the entity is at the goal or passed it. If so, then it stops. Otherwise, it continues to taxi, but at its approach speed.
| virtual void DtFixedWingMoveToController::doMoving | ( | ) | [virtual] |
Determines what state the entity is currently in and then calls the appropriate doMoving function for that state.
Reimplemented in DtFixedWingFollowEntityController.
| virtual void DtFixedWingMoveToController::doFlying | ( | ) | [virtual] |
Determines if the entity is five seconds or fewer away from being at the waypoint using the entity’s speed and myDistanceSquared.
If it is, it sets the myFinishing flag to true; The myProcessState->lastDistanceSquared() is set to myDistanceSquared. otherwise, it calls the flyTo() function provided by its parent class.
Reimplemented in DtFixedWingFlyIntoController, and DtFixedWingFollowEntityController.
| virtual void DtFixedWingMoveToController::doTaxiing | ( | ) | [virtual] |
Determines if the entity is near its goal.
If it is, it sets the finishing flag to true. The myProcessState->lastDistanceSquared() is set to myDistanceSquared. Otherwise, it calls the taxiTo() function provided by its parent class.
Reimplemented in DtFixedWingFollowEntityController.
| virtual void DtFixedWingMoveToController::doTakeOff | ( | ) | [virtual] |
Changes the ordered speed to be the max ground speed and then taxi's in the direction of the waypoint.
By setting the ordered speed to be the max ground speed, the plane will acclerate until either maxing out its speed or reaching min lift speed and taking off.
| virtual void DtFixedWingMoveToController::updateTakeOffDirection | ( | ) | [virtual] |
Calculates and sets a new direction vector using the current waypoint to move to and the current position of the entity.
| virtual double DtFixedWingMoveToController::findDesiredSpeed | ( | ) | [virtual] |
This function returns the appropriate speed for the movement status of the FWE.
The desired speed can change between flying, taxiing, taking off...
Reimplemented in DtFixedWingFollowEntityController.
| virtual bool DtFixedWingMoveToController::nearGoal | ( | ) | [virtual] |
Determines if the entity is close enough to the waypoint that it can be considered near its goal.
For ground motion, this means determining if its breaking distance is greater than or equal to the specified near distance. For flying, this determines if the entity is within 5 seconds of the goal at current speed or orientation. NOTE: if the entity is not, but because it is at it's maximum altitude and the altitude is further above, it then determines if it is close enough to the goal as if that goal was at its altitude.
| virtual bool DtFixedWingMoveToController::atGoal | ( | ) | [virtual] |
Determines if the entity is "at" the goal.
For taxiing, it determines if entity is within the specified at-distance. For flying, it basically performs the same calculation for closeness, including altitude conditions, as nearGoal(), but for within 2 seconds.
| virtual bool DtFixedWingMoveToController::passedGoal | ( | ) | [virtual] |
Determines if the entity will taxi passed the control point to which it is moving this frame if it continues at its current velocity and acceleration.
It dead-reckons its position. It calculates the vector that points from the entity to the control point by subtracting the DtVector that represents the entity’s position from the one representing the control point’s position. It finds the dot product between this vector and the goal vector, If that dot product is greater than 0.0, the entity will pass the control point this tick if it does not stop.
| virtual void DtFixedWingMoveToController::taskComplete | ( | bool | success = true | ) | [virtual] |
Overridden to set all internal state (i.e.
port values, etc) properly when completing a task before notifying the task manager and actually making the task complete.
Reimplemented from DtSingleTaskControllerComponent.
| static void DtFixedWingMoveToController::moveToCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Instances of this component will register these callbacks with their own 'this' pointer as user data with the msg executive requesting notification of the appropriate tasks and setDataRequests.
| static void DtFixedWingMoveToController::moveToAltitudeCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
| static void DtFixedWingMoveToController::setAltitudeCallback | ( | DtSimMessage * | msg, |
| void * | usrData | ||
| ) | [static] |
| static void DtFixedWingMoveToController::setLocationCallback | ( | DtSimMessage * | msg, |
| void * | usrData | ||
| ) | [static] |
| static void DtFixedWingMoveToController::setRestoreCallback | ( | DtSimMessage * | msg, |
| void * | usrData | ||
| ) | [static] |
| static void DtFixedWingMoveToController::waypointChangedCallback | ( | DtVrfObject * | msg, |
| void * | usr | ||
| ) | [static] |
| static void DtFixedWingMoveToController::modifyVrfObjectCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Calls processModifyVrfObject.
| static void DtFixedWingMoveToController::deleteVrfObjectCallback | ( | DtVrfObject * | msg, |
| void * | usr | ||
| ) | [static] |
Callback for getting DtDeleteVrfObject messages.
| virtual void DtFixedWingMoveToController::processMoveToTask | ( | DtSimMessage * | msg | ) | [virtual] |
Callback functions to execute when messages registered for are received.
| virtual void DtFixedWingMoveToController::processMoveToAltitudeTask | ( | DtSimMessage * | msg | ) | [virtual] |
| virtual void DtFixedWingMoveToController::processSetAltitude | ( | DtSimMessage * | msg | ) | [virtual] |
Changes the entities altitude/position to the user specified value.
As a side effect, redetermines the proper value for the movement status and any other state variables.
| virtual void DtFixedWingMoveToController::processSetLocation | ( | DtSimMessage * | msg | ) | [virtual] |
| virtual void DtFixedWingMoveToController::processSetRestore | ( | DtSimMessage * | msg | ) | [virtual] |
| virtual void DtFixedWingMoveToController::processWaypointChanged | ( | DtVrfObject * | msg | ) | [virtual] |
Reimplemented in DtFixedWingFlyIntoController.
| virtual void DtFixedWingMoveToController::processModifyVrfObject | ( | DtSimMessage * | msg | ) | [virtual] |
If the entity is tasked, the control point is valid, and the object moved was the entity, then this resets any state associated with the previous location of the FWE when the location of the entity to which this controller is attached is changed through a DtIfModifyVrfObject message (i.e.
a drag & drop in the front-end).
| virtual void DtFixedWingMoveToController::processDeleteVrfObject | ( | DtVrfObject * | msg | ) | [virtual] |
Makes sure to update the state of the controller appropriately if either the waypoint or any other relevent vrfobject was deleted.
| virtual bool DtFixedWingMoveToController::createWorkingControlPoint | ( | const DtVector | location | ) | [virtual] |
Creates a new "phantom" waypoint at the current location of the FWE, but at an altitude specified by the MoveToAltitude task.
It sets both myWorkingControlPoint and myControlPoint to the new control point. In order to ensure that the memory is cleaned up properly, myWorkingControlPoint is responsible for deleting the created CP.
| virtual void DtFixedWingMoveToController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Overrides this so it can register its interest in MoveTo commands and all other messages described in the above functions.
Reimplemented from DtTaskControllerComponent.
Reimplemented in DtFixedWingFollowEntityController, DtFixedWingPatrolBetweenController, DtFixedWingFlyIntoController, and DtFixedWingMoveToLocationController.
| static DtSimComponent* DtFixedWingMoveToController::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 DtFixedWingPilotController.
Reimplemented in DtFixedWingFollowEntityController, DtFixedWingFlyIntoController, DtFixedWingPatrolBetweenController, and DtFixedWingMoveToLocationController.
| virtual void DtFixedWingMoveToController::getLocalDestination | ( | DtVector & | local | ) | const [protected, virtual] |
| virtual void DtFixedWingMoveToController::getWorldDestination | ( | DtVector & | world | ) | const [protected, virtual] |
| virtual double DtFixedWingMoveToController::distanceSquaredToDestination | ( | const DtVector & | current | ) | const [protected, virtual] |
Returns distance squared from destination point to current location.
Positions are all in local coordinates
| virtual double DtFixedWingMoveToController::distanceSquaredToDestination2D | ( | const DtVector & | current | ) | const [protected, virtual] |
| virtual bool DtFixedWingMoveToController::atAltitude | ( | double | desiredAltitude | ) | const [protected, virtual] |
| virtual bool DtFixedWingMoveToController::setupControlPoint | ( | ) | [protected, virtual] |
Sets up initial information for where the fixed wing wants to move to.
Must call setMovementStatusFromControlPoint() after setting initial conditions
Reimplemented in DtFixedWingFollowEntityController, and DtFixedWingMoveToLocationController.
| virtual void DtFixedWingMoveToController::clearTask | ( | ) | [protected, virtual] |
Override to set myControlPoint to NULL.
Reimplemented from DtFixedWingPilotController.
| DtFixedWingMoveToController& DtFixedWingMoveToController::operator= | ( | const DtFixedWingMoveToController & | orig | ) | [private] |
assignment operator
DtVrfObject* DtFixedWingMoveToController::myControlPoint [protected] |
This is looked up once per tick - assumed unchanging while we have control.
Locally allocated waypoint for use in moving to an altitude.
Reimplemented in DtFixedWingFollowEntityController.
bool DtFixedWingMoveToController::myFirstTick [protected] |