VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
groundFollowInFormationController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 
10 
11 #pragma once
12 
14 class DtVectorOutputPort;
15 
21 #include "matrix/coordTransform.h"
30 
32 {
33 
34 public:
35 
39  DtLocalObject* owner,
40  DtSimulationServices* simManager,
41  DtComponentDescriptor* desc = 0,
42  DtReaderWriterRegistry* parentRegistry = 0);
43 
46 
49  virtual const char* type() const;
50 
54  virtual void tick();
55 
57  virtual void registerTaskMsgCallbacks();
58 
60  static void followInFormationCallback(DtSimMessage * msg, void * usr);
61 
65  static DtSimComponent * creator(const DtString& name,
66  DtLocalObject* owner,
67  DtSimulationServices* simManager,
68  DtComponentDescriptor* desc = 0,
69  DtReaderWriterRegistry* parentRegistry = 0);
70 protected:
71 
73  void cleanFollowInFormation();
74 
76  virtual void endFollowInFormation(bool taskSuccess = true);
77 
79  virtual void clearTask();
80 
95  virtual int adjustStartPoint(const std::vector<DtVector>& routeVertices,
96  const DtVector& entityLocation);
97 
98 
105  virtual void doMoving();
106 
109  virtual bool checkTaskEndCondition();
110 
112  virtual bool isLeaderCapable() const;
113 
114 
116  virtual double horizDistBetweenPoints(DtVector, DtVector);
120  virtual double horizDistBetweenPoints(DtPoint loc1, DtPoint loc2);
122 
129  virtual int findClosestSegmentIndex(DtVector testPoint, std::vector<DtVector> testRoute,
130  DtPoint& closestSegmentLoc, double& distanceToSegment, int indexSegmentFloor = 0);
131 
135  virtual double findDesiredAcceleration(double targetSpeed, double targetHeading,
136  double currentHeading, double disToTarget);
137 
143  virtual bool createFollowerOffsetRoute(const std::vector<DtVector>& localPoints,
144  float rightOffset, float forwardOffset, DtUUID& routeUUID);
145 
147  virtual void processFollowInFormation(const DtTaskMessage& msg);
148 
150  virtual void updateTaskVisualizations();
151 
154  virtual bool publishFormationRoutes() const;
155 
168  virtual double distanceBehind(const DtVector topoRefPos,
169  const DtVector leaderDir, const DtVector topoCurrentPosition);
170  virtual bool isPastDestination(const int currentIndex);
171 
172 private:
173 
176 
180 
184 
185 protected:
188 
192  std::vector<DtVector> myTopoOffsetRoute;
193  DtCoordTransform myLocalToTopoTransform;
194 
206  double myAtDistance;
227 };
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
DtSimObjectReference myLeadersRoute
Task parameter, unit route to base the working route on.
Definition: groundFollowInFormationController.h:215
DtSimObjectReference myRoute
Working route follower travels along.
Definition: groundFollowInFormationController.h:187
DtMovementLocalObjectFacade myMovementLocalObjectFacade
Definition: groundFollowInFormationController.h:226
virtual void registerTaskMsgCallbacks()
File: lclVecIter.h.
Definition: localVectorIterator.h:25
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
bool myHasProcessed
Flag that signals when the task msg has been processed.
Definition: groundFollowInFormationController.h:198
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtVector myClosestSegmentPt1
Segment of route the follower is currently in. Used for task visualization.
Definition: groundFollowInFormationController.h:221
DtVector myLeaderLongitudinalOffsetPoint
For task visualization.
Definition: groundFollowInFormationController.h:225
Definition: readerWriterRegistry.h:39
const DtGroundAutoControllerComponent & operator=(const DtGroundAutoControllerComponent &orig)
assignment operator; not implemented
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtGroundFollowInFormationControllerComponent is a controller that models movement of a ground entity ...
Definition: groundFollowInFormationController.h:31
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:437
DtMovementSimObjectFacade myLeaderMovementSimObjectFacade
Definition: groundFollowInFormationController.h:213
double myAtDistance
Descriptor parameter, used to end task.
Definition: groundFollowInFormationController.h:206
double myDisToTarget
Distance to myLocalDestination.
Definition: groundFollowInFormationController.h:200
bool myIsOnRoute
Flag that signals when we should return to the route.
Definition: groundFollowInFormationController.h:196
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
File: simMsg.h.
Definition: simMessage.h:35
std::vector< DtVector > myTopoOffsetRoute
After the offset route myRoute is computed, this holds the topo coordinates of the route...
Definition: groundFollowInFormationController.h:192
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtVector myClosestSegmentPt2
Segment of route the follower is currently in. Used for task visualization.
Definition: groundFollowInFormationController.h:222
double myNearDistance
Descriptor parameter, used to keep on route.
Definition: groundFollowInFormationController.h:204
DtSimObjectReference myLeader
Task parameter, leader to follow.
Definition: groundFollowInFormationController.h:212
virtual void clearTask()
Overridden to deactivate the port group when this controller completes a task.
DtCoordTransform myLocalToTopoTransform
Definition: groundFollowInFormationController.h:193
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:94
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
double myBackwardsOffset
Task parameter, follow offset from leader.
Definition: groundFollowInFormationController.h:202
double myApproachSpeed
Descriptor parameter, used to limit turning speed.
Definition: groundFollowInFormationController.h:208
DtVector myLocalDestination
Location on route follower tries to reach. Based on leaders location and myBackwardsOffset.
Definition: groundFollowInFormationController.h:218
int myIndexDriven
Current route vertex index. Ratchet used to avoid repeating a looping segment.
Definition: groundFollowInFormationController.h:210
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
DtGroundAutoControllerComponent is a base controller that holds capabilitites common to all automotiv...
Definition: groundAutoControllerComponent.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 Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)