VR-Forces 5.0.2 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 
28 
30 {
31 
32 public:
33 
37  DtLocalObject* owner,
38  DtSimulationServices* simManager,
39  DtComponentDescriptor* desc = 0,
40  DtReaderWriterRegistry* parentRegistry = 0);
41 
44 
47  virtual const char* type() const;
48 
51  virtual void tick();
52 
54  virtual void registerTaskMsgCallbacks();
55 
57  static void followInFormationCallback(DtSimMessage * msg, void * usr);
58 
62  static DtSimComponent * creator(const DtString& name,
63  DtLocalObject* owner,
64  DtSimulationServices* simManager,
65  DtComponentDescriptor* desc = 0,
66  DtReaderWriterRegistry* parentRegistry = 0);
67 protected:
68 
70  void cleanFollowInFormation();
71 
73  virtual void endFollowInFormation(bool taskSuccess = true);
74 
76  virtual void clearTask();
77 
84  virtual void doMoving();
85 
89  virtual double distanceAlongRoute(DtVector testLocation, int segmentIndex, std::vector<DtVector> testRoute);
90 
93  virtual bool checkTaskEndCondition();
94 
96  virtual double findDistanceToTarget(DtVector, DtVector);
100  virtual double findDistanceToTarget(DtPoint loc1, DtPoint loc2);
102 
109  virtual int findClosestSegmentIndex(DtVector testPoint, std::vector<DtVector> testRoute,
110  DtPoint& closestSegmentLoc, double& distanceToSegment, int indexSegmentFloor = 0);
111 
114  virtual double findHeading(DtVector initialLocation, DtVector localDestination);
115 
120  virtual DtVector shiftLocationAlongRoute(double shiftDistance,
121  std::vector<DtVector> testRoute, DtVector initalLoc, int segmentIndex);
122 
125  virtual DtVector findTargetLocation();
126 
130  virtual double findDesiredAcceleration(double targetSpeed, double targetHeading,
131  double currentHeading, double disToTarget);
132 
138  virtual bool createFollowerOffsetRoute(const std::vector<DtVector>& localPoints,
139  float rightOffset, float forwardOffset, DtUUID& routeUUID);
140 
142  virtual void processFollowInFormation(const DtTaskMessage& msg);
143 
145  virtual void updateTaskVisualizations();
146 
148  virtual double headingTo(DtVector localDestination);
149 
152  bool publishFormationRoutes() const;
153 
154 private:
155 
158 
162 
166 
167 protected:
181  double myAtDistance;
203 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtSimObjectReference myLeadersRoute
Task parameter, leaders route to base the working route on.
Definition: groundFollowInFormationController.h:189
DtVector myPlaceOnRoute
Used for task vis, follows position snapped to route.
Definition: groundFollowInFormationController.h:191
DtSimObjectReference myRoute
Working route follower travels along.
Definition: groundFollowInFormationController.h:169
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:173
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:197
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:29
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:436
double myAtDistance
Descriptor parameter, used to end task.
Definition: groundFollowInFormationController.h:181
double myDisToTarget
Distance to myLocalDestination.
Definition: groundFollowInFormationController.h:175
bool myIsOnRoute
Flag that signals when we should return to the route.
Definition: groundFollowInFormationController.h:171
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
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:198
double myNearDistance
Descriptor parameter, used to keep on route.
Definition: groundFollowInFormationController.h:179
DtSimObjectReference myLeader
Task parameter, leader to follow.
Definition: groundFollowInFormationController.h:187
virtual void clearTask()
Overridden to deactivate the port group when this controller completes a task.
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
double myBackwardsOffset
Task parameter, follow offset from leader.
Definition: groundFollowInFormationController.h:177
double myApproachSpeed
Descriptor parameter, used to limit turning speed.
Definition: groundFollowInFormationController.h:183
DtVector myLocalDestination
Location on route follower tries to reach. Based on leaders location and myBackwardsOffset.
Definition: groundFollowInFormationController.h:194
DtVector myLeaderLocationOnMyRoute
The closest location of the leader along the entity&#39;s route. Used for task visualization.
Definition: groundFollowInFormationController.h:202
int myIndexDriven
Ratchet used to avoid repeating a looping segment.
Definition: groundFollowInFormationController.h:185
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)