VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
DtDisaggregatedMoveIntoFormationController Class Reference

Class DtAggregateMoveIntoFormationController is a task controller that models aggregate entity behavior of moving into a given formation, at a given heading and location. More...

Inheritance diagram for DtDisaggregatedMoveIntoFormationController:
Inheritance graph
[legend]

List of all members.

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 DtSimComponentcreator (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
DtFormationStatemyFormationState
DtVector myLocation
DtString myFormation
DtCommandChannelRadiomyCommandRadio
 Pointer to aggregate's command radio, cached in this class for convenience.
DtSetDataManagermySetDataManager
 Pointer to aggregate's DtSetDataManager, cached in this class for convenience.
std::vector< DtStringmyDebugWaypointNames
 List of object names of waypoints, generated at target locations.
DtVrfAggregateStateRepositorymyAggregateStateRepository
 Pointer to aggregate's state repository, cached in this class for convenience.
DtAggregateMoveToPSRmyProcessState
 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
DtDisaggregatedMoveIntoFormationControlleroperator= (const DtDisaggregatedMoveIntoFormationController &orig)
 not implemented

Detailed Description

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


Constructor & Destructor Documentation

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

not implemented


Member Function Documentation

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtAggregateMoveIntoFormationControllerType

Implements DtTaskControllerComponent.

Initializes myFormationState.

Reimplemented from DtControllerComponent.

Overridden to call registerOrgNodeCallbacks().

Reimplemented from DtSimComponent.

Registers task and set data request callbacks for following type: DtMoveIntoFormationTask Overridden from base class to register for DtTaskCompleteReports.

Reimplemented from DtTaskControllerComponent.

Override to send clear task messages to subordinates.

Reimplemented from DtSingleTaskControllerComponent.

Handles task complete reports from our subordinates.

Calls onTaskComplete().

Parameters:
msgMessage 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*,

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.

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).

Parameters:
msgMessage containing a DtTaskCompleteReport.

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.

Unpacks incoming DtMoveToTask, calls startTask() and then moveIntoFormation().

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::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.

Registers subordinateRemoved() callback with the aggregate's organization node.

virtual void DtDisaggregatedMoveIntoFormationController::groundClampLocation ( DtVector location) [protected, virtual]

Utility function.

Returns:
Boolean value indicating whether or not generated locations should be ground clamped or not.
DtDisaggregatedMoveIntoFormationController& DtDisaggregatedMoveIntoFormationController::operator= ( const DtDisaggregatedMoveIntoFormationController orig) [private]

not implemented


Member Data Documentation

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.

List of object names of waypoints, generated at target locations.

Used for debugging.

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..


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)