VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
surfaceEntityMoveAlongController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 #pragma once
12 
15 
16 class DtString;
18 class DtRouteState;
19 class DtSimMessage;
20 class DtVectorOutputPort;
21 class DtMoveAlongTask;
22 
38 
41 {
42 
43 public:
44 
48  DtLocalObject* owner,
49  DtSimulationServices* simManager,
50  DtComponentDescriptor* desc = 0,
51  DtReaderWriterRegistry* parentRegistry = 0);
52 
58 
61  virtual const char* type() const;
62 
64  virtual bool init();
65 
69  virtual void preFirstTickInit();
70 
71  virtual void clearTask();
72 
80  static void moveAlongCallback(DtSimMessage* msg, void* usr);
81 
94  virtual void processMoveAlongTask(DtSimMessage * msg);
95 
104  static DtReaderWriter* provideCurrentMinTurnRadius(void* controller);
105 
113  static DtReaderWriter* provideTurnRadiusForOrderedSpeed(void* controller);
114 
116  static DtReaderWriter* provideNextRoutePointIndex(void* controller);
118 
126  virtual void processRouteChanged();
127 
136  virtual bool atGoal();
137 
146  virtual bool passedGoal();
147 
148 
150 
158  virtual bool targetNextVertex();
159 
163  static DtSimComponent * creator(const DtString& name,
164  DtLocalObject* owner,
165  DtSimulationServices* simManager,
166  DtComponentDescriptor* desc = 0,
167  DtReaderWriterRegistry* parentRegistry = 0);
168 
169  virtual void tick();
170  virtual void taskComplete(bool success = true);
171 
172 protected:
175 
179 
181  const DtSurfaceEntityMoveAlongController& operator=
183 
204  virtual bool getNextRoutePoint(int & index,
205  DtVector * & point);
206 
210  virtual DtVector previousRoutePoint();
211 
219  virtual void setStateForCurrentPoint();
220 
225  virtual bool setupControlPoint();
226 
235  virtual void controlMovement();
236 
240  virtual void moveToMiddleOrFinalPoint();
241 
254  virtual bool shouldMoveToRouteSegment(double& distanceToSegment);
255 
259  virtual void controlMovementToRouteSegment(double distanceToSegment);
260 
269  virtual DtReal computeStartTurnDistance2();
270 
273  virtual DtReal minTurnRadiusForSpeed(double speed) const;
274 
281 
285  virtual void registerTaskMsgCallbacks();
286 
289  virtual void emptyVertexList();
290 
304  virtual double integralControl() const;
307  virtual double integratedErrorDecayRate() const { return 0.9; }
308 
312  virtual double integralControlGain() const { return 0.002; }
314 
315  virtual void processEstimatedTotCalculation();
316 
317  virtual bool createPorts();
318 
319  virtual void processMoveAlongTask(DtMoveAlongTask* moveAlong);
320 
321 protected:
326 
332 
339 
341 
343 };
virtual double integralControlGain() const
Returns radian offset per accumulated normalized error. Positive because positive error is to left...
Definition: surfaceEntityMoveAlongController.h:312
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual void tick()
Overridden to check for valid myProcessState pointer. If it is null a warning is printed to the objec...
DtSurfaceEntityMoveAlongController is a controller that models movement of a ship along a route...
Definition: surfaceEntityMoveAlongController.h:39
Definition: surfaceEntityParameters.h:24
DtVectorOutputPort * myCurrentVertexLocationOutputPort
Output Port Name: current-vertex-location Output Port Description: Specifies the current vertex locat...
Definition: surfaceEntityMoveAlongController.h:338
Description: This repository holds all information that is common to all the forms of all objects wit...
Definition: vrfMovingObjectStateRepository.h:31
virtual const DtSurfaceEntityParameters * getParams()
Gets the entity parameters for the purposes of providing attributes.
Definition: surfaceEntityMoveAlongController.h:280
virtual void controlMovement()
Executes the control function for the task, to produce control port outputs.
DtVrfMovingObjectStateRepository * myEntityState
Definition: surfaceEntityPilotController.h:279
Definition: surfaceMovementPSR.h:59
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
virtual void clearTask()
Calls down to the base class and then calls allowDeactivation() on mySurfaceControlPortGroup.
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
Definition: readerWriter.h:85
bool myReprocessTask
Definition: surfaceEntityMoveAlongController.h:342
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
virtual bool passedGoal()
Determines if the entity has passed the goal. This is true for move-to-loc if the vector from the goa...
virtual void taskComplete(bool success=true)
If we are currently tasked, this will cause us to notify the entity that we're done and delete the ta...
DtSimObjectReference myRoute
Definition: surfaceEntityMoveAlongController.h:340
//! DtSurfaceEntityMoveToLocationController is a controller that models the movement of a surface ent...
Definition: surfaceEntityMoveToLocationController.h:28
virtual double integratedErrorDecayRate() const
The reduction factor in the accumulated error, per second. Must be < 1.0.
Definition: surfaceEntityMoveAlongController.h:307
virtual void processEstimatedTotCalculation()
calculate estimated tot
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
const DtSurfaceEntityParameters * myParameters
Cache a pointer to the entity parameters.
Definition: surfaceEntityPilotController.h:283
File: simMsg.h.
Definition: simMessage.h:35
DtMoveAlongTask represents a Move Along Route task for an entity to perform. It inherits read/writabl...
Definition: moveAlongTasks.h:46
virtual DtVrfMovingObjectStateRepository * getSR()
Gets the entity state repository for purposes of providing attributes.
Definition: surfaceEntityMoveAlongController.h:276
virtual DtSurfaceMovementPSR * getPSR()
Gets the process state repository for purposes of providing attributes.
Definition: surfaceEntityMoveAlongController.h:278
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
virtual bool setupControlPoint()
Every tick, this makes sure the destination is taken from current data.
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 myIntegratedAlignmentError
This is the accumulated error of normalized distance from the route segment line. This value is used ...
Definition: surfaceEntityMoveAlongController.h:331
virtual void registerTaskMsgCallbacks()
Registers interest in move to location tasks by calling addTaskProcessorCallback moveToLocationCallba...
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
double myMinManeuverDistance2
Caches a threshold distance inside of which the entity will not consider moving to the route line...
Definition: surfaceEntityMoveAlongController.h:325
virtual bool createPorts()
Overridden to call createThrottlePort() and createRudderPort().
DtSurfaceMovementPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: surfaceEntityPilotController.h:290
virtual bool init()
Calls down to the base class and then caches a pointer to the state repository in mySurfaceEntityStat...
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
virtual bool atGoal()
Determines when the entity is at the goal. Uses the stoppingDistance parameter.

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)