![]() |
VR-Forces 4.0.4 Class Documentation
|
Class DtAggregateMoveIntoFormationController is a task controller that models aggregate entity behavior of moving into a given formation, at a given heading and location. More...

Public Member Functions | |
| DtDisaggregatedMoveIntoFormationController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtDisaggregatedMoveIntoFormationController () |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual bool | init () |
| Initializes myFormationState. | |
| virtual void | tick () |
| Overridden to call registerOrgNodeCallbacks(). | |
| virtual void | registerTaskMsgCallbacks () |
| Registers task and set data request callbacks for following type: DtMoveIntoFormationTask Overridden from base class to register for DtTaskCompleteReports. | |
| virtual void | clearTask () |
| Override to send clear task messages to subordinates. | |
Static Public Member Functions | |
| static void | taskCompleteReportCallback (DtSimMessage *msg, void *usr) |
| Handles task complete reports from our subordinates. | |
| static void | formationStateChanged (const DtFormationState &formationState, void *usr) |
| Called whenever formation state has changed in myFormationState. | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| static void | moveIntoFormationTaskCallback (DtSimMessage *msg, void *usr) |
| Callback function for handling incoming turn to move to task message. | |
| static void | subordinateRemoved (DtEntityIdentifier childEid, void *usr) |
| Callback function for handling subordinate removed events. | |
Protected Member Functions | |
| virtual void | moveIntoFormation (const DtVector &location, double heading, DtString formation) |
| Sends DtFormationTypeRequest to ourself if formation is anything other than 'DtKeepExistingFormation'. | |
| virtual void | onTaskComplete (DtSimMessage *msg) |
| If task complete from our subordinate indicates task just completed is of type DtMoveToLocationTaskType, then send subordinate a DtTurnToHeadingType task with the new heading. | |
| virtual void | onFormationStateChanged () |
| Clears list of currently tasked subordinate names in the process state repository (myProcessState), and calls moveIntoFormation() with our cached location, heading, formation, and apply formation to subordinates data members. | |
| virtual void | sendRequestToSelf (const DtSetDataRequest &request) const |
| Sends given data request message to ourself through myRadio. | |
| virtual void | sendTaskToSubordinate (const DtSimTask &task, const DtString &subordinateName) const |
| Sends given task message to a given subordinate through myRadio. | |
| void | sendSetDataRequestToSubordinate (const DtSetDataRequest &request, const DtString &subordinateName) const |
| Sends given set data request message to a given subordinate through myRadio. | |
| virtual void | processMoveIntoFormationTask (DtSimMessage *msg) |
| Unpacks incoming DtMoveToTask, calls startTask() and then moveIntoFormation(). | |
| virtual bool | createPSR () |
| Creates myProcessState data member, and adds it to our process state repository manager. | |
| virtual void | clearDebugWaypointNames () |
| virtual void | processSubordinateRemoved (DtEntityIdentifier childEid) |
| Handles subordinate removed events. | |
| virtual bool | registerOrgNodeCallbacks () |
| Registers subordinateRemoved() callback with the aggregate's organization node. | |
| virtual void | groundClampLocation (DtVector &location) |
| Utility function. | |
| virtual bool | shouldGroundClamp () const |
Protected Attributes | |
| const DtAggregateMoveIntoFormationDescriptor * | myAggregateMoveIntoFormationDescriptor |
| DtFormationState * | myFormationState |
| DtVector | myLocation |
| DtString | myFormation |
| DtCommandChannelRadio * | myCommandRadio |
| Pointer to aggregate's command radio, cached in this class for convenience. | |
| DtSetDataManager * | mySetDataManager |
| Pointer to aggregate's DtSetDataManager, cached in this class for convenience. | |
| std::vector< DtString > | myDebugWaypointNames |
| List of object names of waypoints, generated at target locations. | |
| DtVrfAggregateStateRepository * | myAggregateStateRepository |
| Pointer to aggregate's state repository, cached in this class for convenience. | |
| DtAggregateMoveToPSR * | myProcessState |
| Container for state data associated with this component. | |
| bool | myStopMovingUponArrival |
| Flag indicating whether or not subordinates should stop upon arrival at destination. | |
| bool | myTurnToHeadingUponArrival |
| Flag indicating whether or not subordinates should turn to given heading upon arrival at the destination. | |
| bool | myRegisteredWithOrgNode |
| Flag used to indicate if the subordinateRemoved() callback has been registered with the aggregate's organization node. | |
Private Member Functions | |
| DtDisaggregatedMoveIntoFormationController (const DtDisaggregatedMoveIntoFormationController &orig) | |
| not implemented | |
| DtDisaggregatedMoveIntoFormationController & | operator= (const DtDisaggregatedMoveIntoFormationController &orig) |
| not implemented | |
Class DtAggregateMoveIntoFormationController is a task controller that models aggregate entity behavior of moving into a given formation, at a given heading and location.
End User Description: DtAggregateMoveIntoFormationController models movement of an aggregate into formation at a given location, formation, and heading. It responds to DtMoveIntoFormationTask commands issued to the aggregate. To implement the behavior, it computes the final position each subordinate should be in, to be in formation at the desired location and orientation. It then issues a move-to-location task to each subordinate, directing it to move into position. When it arrives, it issues a turn-to-heading task to the subordinate, to orient it at the desired heading. The task is considered complete when all subordinates have reached their target location and have finished their turn-to-heading tasks.
This controller may only be configured as a part of an entity that has a vrf-aggregate-state-repository.
Uses Descriptor Type: DtAggregateMoveIntoFormationDescriptor
| DtDisaggregatedMoveIntoFormationController::DtDisaggregatedMoveIntoFormationController | ( | 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 DtDisaggregatedMoveIntoFormationController::~DtDisaggregatedMoveIntoFormationController | ( | ) | [virtual] |
| DtDisaggregatedMoveIntoFormationController::DtDisaggregatedMoveIntoFormationController | ( | const DtDisaggregatedMoveIntoFormationController & | orig | ) | [private] |
not implemented
| virtual DtString DtDisaggregatedMoveIntoFormationController::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.
Implements DtTaskControllerComponent.
| virtual bool DtDisaggregatedMoveIntoFormationController::init | ( | ) | [virtual] |
Initializes myFormationState.
Reimplemented from DtControllerComponent.
| virtual void DtDisaggregatedMoveIntoFormationController::tick | ( | ) | [virtual] |
Overridden to call registerOrgNodeCallbacks().
Reimplemented from DtSimComponent.
| virtual void DtDisaggregatedMoveIntoFormationController::registerTaskMsgCallbacks | ( | ) | [virtual] |
Registers task and set data request callbacks for following type: DtMoveIntoFormationTask Overridden from base class to register for DtTaskCompleteReports.
Reimplemented from DtTaskControllerComponent.
| virtual void DtDisaggregatedMoveIntoFormationController::clearTask | ( | ) | [virtual] |
Override to send clear task messages to subordinates.
Reimplemented from DtSingleTaskControllerComponent.
| static void DtDisaggregatedMoveIntoFormationController::taskCompleteReportCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Handles task complete reports from our subordinates.
Calls onTaskComplete().
| msg | Message containing a DtTaskCompleteReport. |
| static void DtDisaggregatedMoveIntoFormationController::formationStateChanged | ( | const DtFormationState & | formationState, |
| void * | usr | ||
| ) | [static] |
Called whenever formation state has changed in myFormationState.
Calls onFormationStateChanged().
| static DtSimComponent* DtDisaggregatedMoveIntoFormationController::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). |
| static void DtDisaggregatedMoveIntoFormationController::moveIntoFormationTaskCallback | ( | DtSimMessage * | msg, |
| void * | usr | ||
| ) | [static] |
Callback function for handling incoming turn to move to task message.
Calls onMoveToTask to actually handle the message.
| static void DtDisaggregatedMoveIntoFormationController::subordinateRemoved | ( | DtEntityIdentifier | childEid, |
| void * | usr | ||
| ) | [static] |
Callback function for handling subordinate removed events.
Calls processSubordinateRemoved.
| virtual void DtDisaggregatedMoveIntoFormationController::moveIntoFormation | ( | const DtVector & | location, |
| double | heading, | ||
| DtString | formation | ||
| ) | [protected, virtual] |
Sends DtFormationTypeRequest to ourself if formation is anything other than 'DtKeepExistingFormation'.
For each subordinate, computes new location and heading, given the formation If subordinate is an individual, sends DtMoveToTask with new location. If subordinate is an aggregate, sends DtMoveIntoFormationTask with new location, heading, formation, and apply to subordinates flag.
| virtual void DtDisaggregatedMoveIntoFormationController::onTaskComplete | ( | DtSimMessage * | msg | ) | [protected, virtual] |
If task complete from our subordinate indicates task just completed is of type DtMoveToLocationTaskType, then send subordinate a DtTurnToHeadingType task with the new heading.
If task completed is of type DtTurnToHeadingType, then removes subordinate from list of currently tasked subordinate names in the process state repository (myProcessState). If list of currently tasked subordinate names is empty, places a value of true on myAtDestinationOutputPort and sends the data (at this point, behavior is complete).
| msg | Message containing a DtTaskCompleteReport. |
| virtual void DtDisaggregatedMoveIntoFormationController::onFormationStateChanged | ( | ) | [protected, virtual] |
Clears list of currently tasked subordinate names in the process state repository (myProcessState), and calls moveIntoFormation() with our cached location, heading, formation, and apply formation to subordinates data members.
| virtual void DtDisaggregatedMoveIntoFormationController::sendRequestToSelf | ( | const DtSetDataRequest & | request | ) | const [protected, virtual] |
Sends given data request message to ourself through myRadio.
| virtual void DtDisaggregatedMoveIntoFormationController::sendTaskToSubordinate | ( | const DtSimTask & | task, |
| const DtString & | subordinateName | ||
| ) | const [protected, virtual] |
Sends given task message to a given subordinate through myRadio.
| void DtDisaggregatedMoveIntoFormationController::sendSetDataRequestToSubordinate | ( | const DtSetDataRequest & | request, |
| const DtString & | subordinateName | ||
| ) | const [protected] |
Sends given set data request message to a given subordinate through myRadio.
| virtual void DtDisaggregatedMoveIntoFormationController::processMoveIntoFormationTask | ( | DtSimMessage * | msg | ) | [protected, virtual] |
Unpacks incoming DtMoveToTask, calls startTask() and then moveIntoFormation().
| virtual bool DtDisaggregatedMoveIntoFormationController::createPSR | ( | ) | [protected, virtual] |
Creates myProcessState data member, and adds it to our process state repository manager.
Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.
| virtual void DtDisaggregatedMoveIntoFormationController::clearDebugWaypointNames | ( | ) | [protected, virtual] |
| virtual void DtDisaggregatedMoveIntoFormationController::processSubordinateRemoved | ( | DtEntityIdentifier | childEid | ) | [protected, virtual] |
Handles subordinate removed events.
If this controller is currently tasked, removes this subordinate name from the process state list of currently tasked subordinates.
| virtual bool DtDisaggregatedMoveIntoFormationController::registerOrgNodeCallbacks | ( | ) | [protected, virtual] |
Registers subordinateRemoved() callback with the aggregate's organization node.
| virtual void DtDisaggregatedMoveIntoFormationController::groundClampLocation | ( | DtVector & | location | ) | [protected, virtual] |
Utility function.
| virtual bool DtDisaggregatedMoveIntoFormationController::shouldGroundClamp | ( | ) | const [protected, virtual] |
| DtDisaggregatedMoveIntoFormationController& DtDisaggregatedMoveIntoFormationController::operator= | ( | const DtDisaggregatedMoveIntoFormationController & | orig | ) | [private] |
not implemented
const DtAggregateMoveIntoFormationDescriptor* DtDisaggregatedMoveIntoFormationController::myAggregateMoveIntoFormationDescriptor [protected] |
Pointer to aggregate's command radio, cached in this class for convenience.
Aggregate must be configured with a command channel radio for this controller to work correctly (it must have a command radio to issue commands to subordinates).
Pointer to aggregate's DtSetDataManager, cached in this class for convenience.
std::vector<DtString> DtDisaggregatedMoveIntoFormationController::myDebugWaypointNames [protected] |
List of object names of waypoints, generated at target locations.
Used for debugging.
DtVrfAggregateStateRepository* DtDisaggregatedMoveIntoFormationController::myAggregateStateRepository [protected] |
Pointer to aggregate's state repository, cached in this class for convenience.
Container for state data associated with this component.
This state is saved and restored as part of a scenario (or checkpoint).
Flag indicating whether or not subordinates should stop upon arrival at destination.
Typically set to true for ground vehicles, set to false for air vehicles. Default is false.
Flag indicating whether or not subordinates should turn to given heading upon arrival at the destination.
Typically set to true for ground vehicles, set to false for air vehicles (who can't stop and turn). Default is false.
Flag used to indicate if the subordinateRemoved() callback has been registered with the aggregate's organization node.
This registration cannot occur until the first tick of the entity. This flag is initially false, and gets set to true in the first non-zero dT() tick..