VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
convoyTaskController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
15 #include "vrfobjcore/convoyPSR.h"
20 #include "vrfutil/rwRailSegment.h"
21 #include <readerWriter/rwReal.h>
23 #include "terrainCS/coordSystem.h"
24 
25 #include <boost/shared_ptr.hpp>
26 
30 #define CONVOY_CONTROLLER_MAKE_FIRST_SEGMENT 0
31 
32 
33 class DtAsyncJobMapEntry;
34 class DtVrfObjectMessage;
35 class DtBoolSetting;
36 
55 {
56 public:
59  DtConvoyTaskController(const DtString& name,
60  DtLocalObject* owner,
61  DtSimulationServices* simManager,
62  DtComponentDescriptor* desc = 0,
63  DtReaderWriterRegistry* parentRegistry = 0);
64 
66  virtual ~DtConvoyTaskController();
67 
69  virtual bool init();
70 
73  virtual const char* type() const;
74 
76  virtual void clearTask();
77 
79  virtual void resetTask();
80 
82  virtual void registerTaskMsgCallbacks();
83 
88  static void convoyTaskCallback(DtSimMessage * msg, void * usr);
89 
93  static void taskCompleteReportCallback(const DtVrfObjectMessage* msg, void * usr);
94 
98  static DtSimComponent * creator(const DtString& name,
99  DtLocalObject* owner,
100  DtSimulationServices* simManager,
101  DtComponentDescriptor* desc = 0,
102  DtReaderWriterRegistry* parentRegistry = 0);
103 
105  virtual void preFirstTickInit();
106 
107  virtual void tick();
108 
109  virtual bool createPSR();
110 
111  static void settingConsumerCallback(const DtSettingsObject* settingsObject,
112  void* usr);
113 
114  virtual void updateTaskVisualizations();
115 
116 protected:
120  virtual void onModifyVrfObject();
121 
126  virtual void onConvoyTask(DtSimMessage * msg);
127 
130  virtual void onTaskComplete(const DtVrfObjectMessage* msg);
131 
136  virtual void sendTaskToSubordinate(const DtSimTask& task,
137  const DtUUID& subordinate);
138 
143  virtual void sendSetToSubordinate(DtSetDataRequest& request,
144  const DtUUID& subordinate);
145 
151  virtual bool setupTask(const DtLocalObject* aggregate, const DtSimObject* destination,
152  bool pathPlan);
153 
161  virtual DtVector findAssemblyPoint(const DtSimObject* aggregate, const DtVector& destination,
162  bool haveRails, const Coordinate_System* coordSys);
163 
164 #if CONVOY_CONTROLLER_MAKE_FIRST_SEGMENT
165  virtual DtRwRailSegment* createEntrySegment(const DtSimObject* entity,
172  const DtVector& assemblyPoint, const Coordinate_System* coordSys) const;
173 #endif
174 
181  virtual bool setupSubordinates(const DtSimObject* aggregate, bool clearSubs, bool& leaderSet, double initialOrderedSpeed);
182  virtual bool setupSubordinates(const DtLocalObject* aggregate, bool clearSubs, bool& leaderSet, double initialOrderedSpeed);
183  virtual bool setupSubordinates(const std::list<DtSimObjectReference>& list, bool clearSubs, bool& leaderSet,
184  double initialOrderedSpeed);
185 
190  virtual void setupLeadOnDistance(int numberOfEntities, float distanceBetween);
191 
197  virtual bool createDirectRailPath(const DtSimObject* leadEntity, const DtSimObject* destination);
198 
206  virtual bool areSeparationDistancesWithinRange(const DtRwSimObjectReferenceList& subordinates,
207  const float distance, const float tolerance, const Coordinate_System* coordSys);
208 
212  virtual void setLeaderSpeed(const float speed);
213 
217  virtual void resettingPhaseTick(bool retask = true);
218 
221  virtual void startingPhaseTick();
222 
226  virtual void assemblingPhaseTick();
227 
230  virtual void convoyingPhaseTick();
231 
235  virtual void finishingPhaseTick();
236 
243  virtual DtVector findIntersectionOfLineAndCircle(const DtVector& centerPoint,
244  const DtVector& endPoint, double radius, const Coordinate_System* coordSys) const;
245 
254  virtual bool taskEntityToMoveToAssemblyPt(const DtSimObject* entity, const DtVector& assemblyPoint,
255  const Coordinate_System* coordSys);
256 
258  virtual bool getEntityPathToEntry(const DtSimObject* entity, const DtVector& assemblyPoint,
259  const Coordinate_System* coordSys);
260 
270  virtual DtRailSegment* findClosestEntryRail(const DtSimObject* aggregate,
271  const double& radius,
272  DtRailSegmentList* rails,
273  int& railNumber,
274  const Coordinate_System* coordSys) const;
275 
283  virtual bool isPointWithinRadius(const DtVector& center, double radius,
284  const DtVector& point, const Coordinate_System* coordSys) const;
285 
293  virtual bool findPointOnRailOutsideSphere(const DtVector& center, const double& radius,
294  const DtRailSegment* segment, DtVector& resultPoint, const Coordinate_System* coordSys) const;
295 
304  virtual bool updateConvoySubordinates(const DtSimObject* aggregate,
305  std::vector<DtUUID>& tempList, bool recursive = false);
306  virtual bool updateConvoySubordinates(const DtLocalObject* aggregate,
307  std::vector<DtUUID>& tempList, bool recursive = false);
308  virtual bool updateConvoySubordinates(const std::list<DtSimObjectReference>&,
309  std::vector<DtUUID>& tempList, bool recursive = false);
310 
312  virtual bool isEntityPartOfConvoy(const DtUUID& entity) const;
313 
314  virtual bool isEntityIndependentlyTasked(const DtSimObject* entity) const;
315 
316  virtual void setConvoyFollowing();
317 
318  virtual void destroyedPhaseTick();
319 
321  virtual void sendClearTask(const DtUUID& recipientName,
322  const DtSimTaskMessageType& taskType);
323 
324  double maxSearchRadius(const DtPoint& start, const DtPoint& end);
325 
331  virtual bool startPathPlan(const DtSimObject* leadEntity,
332  const DtSimObject* destination);
333 
336  virtual bool pathPlanFinished();
337 
343  virtual DtVector groundClamp(const DtVector& point, DtGeodeticCoord& lastPoint) const;
344 
346  virtual void processSetting( const DtBoolSetting* setting);
347 
348 protected:
349 
351  boost::shared_ptr<DtAsyncJobMapEntry> myPathJobEntry;
352 
356 
359 
360 private:
363 
366 };
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
File: rwRailSegment.h.
If you use a list of object names to archive which objects are part of a controller (or any object) u...
Definition: simObjectReferenceList.h:118
Definition: boolSetting.h:30
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:197
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
virtual void registerTaskMsgCallbacks()
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
DtRailSegment are segments entities can follow when using the rail movement system.
Definition: railSegment.h:23
DtSimObjectReference myDestination
Definition: convoyTaskController.h:357
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
A DtComponentDescriptor that has parameters that indicate the distances at which the entity is consid...
Definition: convoyDescriptor.h:25
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
boost::shared_ptr< DtAsyncJobMapEntry > myPathJobEntry
Token for asynchronous path plan task.
Definition: convoyTaskController.h:351
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
This is a process state repository for the DtConvoyController that stores the list of the names of cu...
Definition: convoyPSR.h:30
DtAggregateLocalObjectFacade myAggregateLocalObjectFacade
Definition: convoyTaskController.h:358
Definition: settingsObject.h:27
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:437
virtual bool init() override
Calls setRadio()
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
Definition: coordSystem.h:54
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
File: simMsg.h.
Definition: simMessage.h:35
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
behavior for a ground vehicle aggregate entity to drive and follow each other on and off roads and ro...
Definition: convoyTaskController.h:54
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
Handle to async job.
Definition: asyncJobMapEntry.h:29
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
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
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...
DtConvoyPSR * myProcessState
Definition: convoyTaskController.h:354
const DtConvoyDescriptor * myDescriptor
Definition: convoyTaskController.h:353
Definition: rwRailSegment.h:27
bool myDrivingOnLeft
Definition: convoyTaskController.h:355
Definition: point.h:34
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

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)