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 
29 #define CONVOY_CONTROLLER_MAKE_FIRST_SEGMENT 0
30 
31 
32 class DtAsyncJobMapEntry;
33 class DtVrfObjectMessage;
34 class DtBoolSetting;
35 
54 {
55 public:
58  DtConvoyTaskController(const DtString& name,
59  DtLocalObject* owner,
60  DtSimulationServices* simManager,
61  DtComponentDescriptor* desc = 0,
62  DtReaderWriterRegistry* parentRegistry = 0);
63 
65  virtual ~DtConvoyTaskController() override;
66 
68  virtual bool init() override;
69 
72  virtual const char* type() const override;
73 
75  virtual void clearTask() override;
76 
78  virtual void resetTask();
79 
81  virtual void registerTaskMsgCallbacks() override;
82 
87  static void convoyTaskCallback(DtSimMessage * msg, void * usr);
88 
92  static void taskCompleteReportCallback(const DtVrfObjectMessage* msg, void * usr);
93 
97  static DtSimComponent * creator(const DtString& name,
98  DtLocalObject* owner,
99  DtSimulationServices* simManager,
100  DtComponentDescriptor* desc = 0,
101  DtReaderWriterRegistry* parentRegistry = 0);
102 
104  virtual void preFirstTickInit() override;
105 
106  virtual void tick() override;
107 
108  virtual bool createPSR();
109 
110  static void settingConsumerCallback(const DtSettingsObject* settingsObject,
111  void* usr);
112 
113  virtual void updateTaskVisualizations() override;
114 
115 protected:
119  virtual void onModifyVrfObject();
120 
125  virtual void onConvoyTask(DtSimMessage * msg);
126 
129  virtual void onTaskComplete(const DtVrfObjectMessage* msg);
130 
135  virtual void sendTaskToSubordinate(const DtSimTask& task,
136  const DtUUID& subordinate);
137 
142  virtual void sendSetToSubordinate(DtSetDataRequest& request,
143  const DtUUID& subordinate);
144 
150  virtual bool setupTask(const DtLocalObject* aggregate, const DtSimObject* destination,
151  bool pathPlan);
152 
160  virtual DtVector findAssemblyPoint(const DtSimObject* aggregate, const DtVector& destination,
161  bool haveRails, const Coordinate_System* coordSys);
162 
163 #if CONVOY_CONTROLLER_MAKE_FIRST_SEGMENT
164  virtual DtRwRailSegment* createEntrySegment(const DtSimObject* entity,
171  const DtVector& assemblyPoint, const Coordinate_System* coordSys) const;
172 #endif
173 
180  virtual bool setupSubordinates(const DtSimObject* aggregate, bool clearSubs, bool& leaderSet, double initialOrderedSpeed);
181  virtual bool setupSubordinates(const DtLocalObject* aggregate, bool clearSubs, bool& leaderSet, double initialOrderedSpeed);
182  virtual bool setupSubordinates(const std::list<DtSimObjectReference>& list, bool clearSubs, bool& leaderSet,
183  double initialOrderedSpeed);
184 
189  virtual void setupLeadOnDistance(int numberOfEntities, float distanceBetween);
190 
196  virtual bool createDirectRailPath(const DtSimObject* leadEntity, const DtSimObject* destination);
197 
205  virtual bool areSeparationDistancesWithinRange(const DtRwSimObjectReferenceList& subordinates,
206  const float distance, const float tolerance, const Coordinate_System* coordSys);
207 
211  virtual void setLeaderSpeed(const float speed);
212 
216  virtual void resettingPhaseTick(bool retask = true);
217 
220  virtual void startingPhaseTick();
221 
225  virtual void assemblingPhaseTick();
226 
229  virtual void convoyingPhaseTick();
230 
234  virtual void finishingPhaseTick();
235 
242  virtual DtVector findIntersectionOfLineAndCircle(const DtVector& centerPoint,
243  const DtVector& endPoint, double radius, const Coordinate_System* coordSys) const;
244 
253  virtual bool taskEntityToMoveToAssemblyPt(const DtSimObject* entity, const DtVector& assemblyPoint,
254  const Coordinate_System* coordSys);
255 
257  virtual bool getEntityPathToEntry(const DtSimObject* entity, const DtVector& assemblyPoint,
258  const Coordinate_System* coordSys);
259 
269  virtual DtRailSegment* findClosestEntryRail(const DtSimObject* aggregate,
270  const double& radius,
271  DtRailSegmentList* rails,
272  int& railNumber,
273  const Coordinate_System* coordSys) const;
274 
282  virtual bool isPointWithinRadius(const DtVector& center, double radius,
283  const DtVector& point, const Coordinate_System* coordSys) const;
284 
292  virtual bool findPointOnRailOutsideSphere(const DtVector& center, const double& radius,
293  const DtRailSegment* segment, DtVector& resultPoint, const Coordinate_System* coordSys) const;
294 
303  virtual bool updateConvoySubordinates(const DtSimObject* aggregate,
304  std::vector<DtUUID>& tempList, bool recursive = false);
305  virtual bool updateConvoySubordinates(const DtLocalObject* aggregate,
306  std::vector<DtUUID>& tempList, bool recursive = false);
307  virtual bool updateConvoySubordinates(const std::list<DtSimObjectReference>&,
308  std::vector<DtUUID>& tempList, bool recursive = false);
309 
311  virtual bool isEntityPartOfConvoy(const DtUUID& entity) const;
312 
313  virtual bool isEntityIndependentlyTasked(const DtSimObject* entity) const;
314 
315  virtual void setConvoyFollowing();
316 
317  virtual void destroyedPhaseTick();
318 
320  virtual void sendClearTask(const DtUUID& recipientName,
321  const DtSimTaskMessageType& taskType);
322 
323  double maxSearchRadius(const DtPoint& start, const DtPoint& end);
324 
330  virtual bool startPathPlan(const DtSimObject* leadEntity,
331  const DtSimObject* destination);
332 
335  virtual bool pathPlanFinished();
336 
342  virtual DtVector groundClamp(const DtVector& point, DtGeodeticCoord& lastPoint) const;
343 
345  virtual void processSetting( const DtBoolSetting* setting);
346 
347 protected:
348 
350  std::shared_ptr<DtAsyncJobMapEntry> myPathJobEntry;
351 
355 
358 
359 private:
362 
365 };
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:120
Definition: boolSetting.h:30
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:194
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:20
DtSimObjectReference myDestination
Definition: convoyTaskController.h:356
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
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:29
DtAggregateLocalObjectFacade myAggregateLocalObjectFacade
Definition: convoyTaskController.h:357
Definition: settingsObject.h:27
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:443
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:53
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:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
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:80
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...
std::shared_ptr< DtAsyncJobMapEntry > myPathJobEntry
Token for asynchronous path plan task.
Definition: convoyTaskController.h:350
DtConvoyPSR * myProcessState
Definition: convoyTaskController.h:353
const DtConvoyDescriptor * myDescriptor
Definition: convoyTaskController.h:352
Definition: rwRailSegment.h:27
bool myDrivingOnLeft
Definition: convoyTaskController.h:354
Definition: point.h:34
A locally simulated VRF object.
Definition: localObject.h:98

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)