VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
disaggregatedLeadFollowInFormationController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2004 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
12 
13 #pragma once
14 
15 #include <vlutil/vlConfig.h>
16 #include <vector>
17 
22 
24 class DtFormationState;
25 class DtMoveAlongTask;
26 class DtSimMessage;
29 class DtSetDataRequest;
30 class DtVrfObjectManager;
32 
60 {
61 public:
62 
66  DtLocalObject* owner,
67  DtSimulationServices* simManager,
68  DtComponentDescriptor* desc = 0,
69  DtReaderWriterRegistry* parentRegistry = 0);
70 
71 
74 
77  virtual const char* type() const;
78 
84  virtual bool init();
85 
91  virtual void registerTaskMsgCallbacks();
92 
94  virtual void preFirstTickInit();
95 
98  virtual void tick();
99 
104  virtual void clearTask();
105 
111  virtual bool createPSR();
112 
115  virtual DtSimTaskStatePtr currentTaskState() const;
116 
117  static void moveAlongCallback(DtSimMessage* msg, void* usr, DtSimTaskStatePtr taskStatePtr);
118 
125  static void taskCompleteReportCallback(DtSimMessage * msg, void * usr);
126 
134  static void formationChangedCallback(const DtFormationState& formationState,
135  void* usr);
136 
140  static DtSimComponent * creator(const DtString& name,
141  DtLocalObject* owner,
142  DtSimulationServices* simManager,
143  DtComponentDescriptor* desc = 0,
144  DtReaderWriterRegistry* parentRegistry = 0);
145 
146 protected:
147  virtual void processMoveAlong(const DtTaskMessage& msg, DtSimTaskStatePtr taskStatePtr);
148 
152  virtual void processFormationChanged(const DtFormationState& formationState);
153 
159  virtual void processTaskComplete(DtSimMessage * msg);
160 
164  virtual void processRouteChanged();
165 
173  virtual int sendTaskToSubordinate(const DtSimTask& task,
174  const DtUUID& subordinate);
175 
182  virtual void sendSetDataToSubordinate(const DtSetDataRequest& setData,
183  const DtUUID& subordinate) const;
184 
188  virtual void beginFollowInFormation(const DtUUID& routeName,
189  const bool startAtClosestPoint, const bool traverseForward);
190 
203  virtual int findClosestSegmentIndex(DtVector testPoint, std::vector<DtVector> testRoute,
204  DtPoint& closestSegmentLoc, double& distanceToSegment, int indexSegmentFloor = 0);
205 
206 
214  virtual bool createLeaderOffsetRoute(
215  const std::vector<DtVector>& localPoints,
216  const double rightOffset, const double forwardOffset,
217  DtUUID& routeUUID, DtUUID);
218 
221  virtual bool isPlatformCapable(const DtUUID& platform) const;
222 
225  virtual int taskLeader(const DtUUID& leader, const DtSimObjectReferenceList& subs,
226  const DtUUID& leaderRoute,
227  const double formationWidth, const double formationLength);
228 
231  virtual int taskFollower(const DtUUID& subEntity, const DtUUID& formationLeader,
232  const DtUUID& unitRouteUUID, const double leaderForwardOffset,
233  const bool doReverseRoute, const double vertexStartIndex);
234 
241  virtual void sendVrfObjectModifyMsg(const DtUUID& object, DtList* vertices) const;
242 
244  virtual void initializeMemberDataFromDescriptor(
245  const DtAggregateMoveAlongDescriptor& desc);
246 
254  virtual bool isUnitMovementExhausted();
255 
262  virtual void sendClearTask(const DtUUID& recipient, const DtSimTaskMessageType& taskType) const;
263 
266  virtual bool publishFormationRoutes() const;
267 
268  virtual double dist2D(const DtVector& position1, const DtVector& position2,
269  const Coordinate_System& coordinateSystem);
270 
271 
272 private:
273 
276 
279 
282 
283 protected:
284 
286  std::map<int, DtString> myPromotionIndexRouteNameMap;
287 
289  std::map<const DtSimObject*, DtEntityRouteFollowingData> myEntityRouteFollowingMap;
290 
292  std::map<const DtSimObject*, DtEntityRouteTraversalState> myEntityRouteTraversalStateMap;
293 
297 
301 
306 
310 
314 
318 
321 
325 
328  unsigned int myNextRouteIndex;
329 
331 
333 
335 
337 };
338 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
class DtLocalObjectManager:
Definition: localObjectManager.h:151
Definition: formationState.h:41
std::map< const DtSimObject *, DtEntityRouteFollowingData > myEntityRouteFollowingMap
Map of subordinates and route following data.
Definition: disaggregatedLeadFollowInFormationController.h:289
bool mySetObjectToBeRemovedCallbacks
Definition: disaggregatedLeadFollowInFormationController.h:332
DtFormationState * myFormationState
Pointer to aggregate&#39;s formation state object, cached in this class for convenience.
Definition: disaggregatedLeadFollowInFormationController.h:300
std::map< const DtSimObject *, DtEntityRouteTraversalState > myEntityRouteTraversalStateMap
Map of subordinate and current route traversal state.
Definition: disaggregatedLeadFollowInFormationController.h:292
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
const DtAggregateMoveAlongDescriptor * myAggregateMoveAlongDescriptor
Pointer to descriptor used to configure this object.
Definition: disaggregatedLeadFollowInFormationController.h:320
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtSimObjectReference myRoute
Definition: disaggregatedLeadFollowInFormationController.h:334
Definition: readerWriterRegistry.h:39
bool myRegisteredFormationChangedCallback
Flag used to indicate whether formation changed callback has been registered yet. ...
Definition: disaggregatedLeadFollowInFormationController.h:324
Class DtAggregateMoveAlongDescriptor holds all of the readable/writeable parameters used to configure...
Definition: aggregateMoveAlongDescriptor.h:30
std::map< int, DtString > myPromotionIndexRouteNameMap
Map of formation positions to generated route object names.
Definition: disaggregatedLeadFollowInFormationController.h:286
DtBoost::shared_ptr< DtSimTaskState > DtSimTaskStatePtr
Definition: taskAndTaskStateDefines.h:18
virtual bool init() override
Calls setRadio()
bool myRestartTaskOnFormationUpdate
Definition: disaggregatedLeadFollowInFormationController.h:336
DtSetDataRequest is an abstract base class from which real setDataRequests can derive. It manages the read/write capability; derived classes need only use and register read/writatble data types for derived information.
Definition: setDataRequest.h:41
DtAggregateMoveAlongPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: disaggregatedLeadFollowInFormationController.h:317
Definition: coordSystem.h:54
File: simMsg.h.
Definition: simMessage.h:35
Class DtDisaggregatedLeadFollowInFormationController is a task controller that models aggregate entit...
Definition: disaggregatedLeadFollowInFormationController.h:59
DtMoveAlongTask represents a Move Along Route task for an entity to perform. It inherits read/writabl...
Definition: moveAlongTasks.h:46
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtCompatibilityRadio * myCommandRadio
Pointer to aggregate&#39;s command radio, cached in this class for convenience. Aggregates must be config...
Definition: disaggregatedLeadFollowInFormationController.h:305
virtual DtSimTaskStatePtr currentTaskState() const
unsigned int myNextRouteIndex
Counter used in naming generated routes. Routes are assigned unique object names using the convention...
Definition: disaggregatedLeadFollowInFormationController.h:328
DtSimTaskStatePtr myCachedTaskState
Definition: disaggregatedLeadFollowInFormationController.h:330
This is a convenience list that will add DtSimObjectReference objects and modify the list as objects ...
Definition: simObjectReferenceList.h:23
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
DtVrfAggregateStateRepository * myAggregateStateRepository
Pointer to aggregate&#39;s state repository, cached in this class for convenience.
Definition: disaggregatedLeadFollowInFormationController.h:296
DtSimTask is an abstract base class from which real tasks can derive. It manages the read/write capab...
Definition: simTask.h:30
virtual void clearTask() override
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
file aggregateMoveAlongPSR.h
Definition: aggregateMoveAlongPSR.h:33
Definition: vrfAggregateStateRepository.h:21
DtCompatibilityRadio.
Definition: compatibilityRadio.h:30
A DtTaskMsg is a DtRadioMsg with a pointer to a task. The type of the taskMsg is just the type of the...
Definition: taskMessage.h:21
Definition: point.h:34
bool myGenerateRoutesWithRoundedCorners
Flag indicating all generated route should have rounded turns. Default is true.
Definition: disaggregatedLeadFollowInFormationController.h:309
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
double myVertexSpacingAlongRoundedCorners
Spacing in meters between extra vertices inserted in generated routes to form rounded turns...
Definition: disaggregatedLeadFollowInFormationController.h:313

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)