VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
roadMovementUpdater.h
Go to the documentation of this file.
1 
4 
5 #pragma once
6 
7 //#include "railPSR.h"
8 #include <vector>
9 #include <matrix/vlVector.h>
10 #include <matrix/vlTaitBryan.h>
11 #include <matrix/coordTransform.h>
12 
16 #include "vrfmodel/roadSegment.h"
17 
18 class DtLocalObject;
20 class DtRailSegment;
21 class DtAttachedTerrain;
24 
27 #define DT_ROAD_MOVE_COAST_DECEL_FRACTION 0.5
28 
31 #define DT_ROAD_MOVE_DESTROYED_DECELERATION -5.0
32 
43 {
44 
45 public:
46 
49  bool useHighGroundClamp,const DtAttachedTerrain* attachedTerrain);
50 
52  virtual ~DtRoadMovementUpdater();
53 
56 
57  virtual bool init();
58 
59  virtual void clear();
60 
61  virtual void setPSR(DtRailMovementControllerPSR* psr);
63  virtual void movementComplete();
64 
66 
75  virtual void updateRailAndWorldPosition(DtRoadSegment* currentSeg, double newAccel,
76  double dT, double simTime = 0.0);
77 
80  virtual void updateNoMovement();
81 
85  virtual void updateFromPSR(const DtVector localPos, DtRailSegment * currentSeg);
86 
87 protected:
88 
93  virtual void kinematicUpdate(const double oldSpeed, const double accel,
94  const double dt, double& deltaPosition, double& newSpeed,
95  double &actualAccel);
96 
112  virtual void doKinematicUpdateAlongRail(
113  const double dt,
114  DtRoadSegment* currentSeg,
115  const int roadLaneNum,
116  const double oldPositionInLane,
117  const double oldSpeed,
118  double & accel,
119  double & newPositionInLane,
120  double & newLateralOffset,
121  double & laneChangeHeadingOffset,
122  double & newSpeed,
123  double & newRotationRate);
124 
140  virtual void computePositionInDownstreamSegment(
141  DtRoadSegment* & currentSeg,
142  int & roadLaneNum,
143  double & newPositionInLane,
144  const double newLateralOffset,
145  double &segmentCurveHeadingOffset,
146  DtVector& localPosition,
147  int & segmentIndex);
148 
168  virtual void updateLateralOffset(const double currentOffset,
169  const double distanceBetweenLanes, const double speed,
170  const double xMove,
171  double & newLateralOffset, double& newHeadingOffset,
172  double &headingChangeRate);
173 
181  virtual void updatePsrWithNewState(
182  const int roadLaneNum,
183  const bool isSwitchingLanes,
184  const int roadSegmentIndex,
185  const double positionInLane,
186  double lateralOffset,
187  const double newSpeed,
188  const double newAccel,
189  DtRoadSegment* currentSegment);
190 
199  virtual void computeBodyMotionVectors(const double speed,
200  const double accel, const double turnRate, const double dt,
201  DtVector & bodyVelocity, DtVector & bodyAcceleration);
202 
208  virtual void computeRepositoryUpdateVariables(
209  const DtVector & newLocalPosition,
210  const DtVector & newBodyVelocity,
211  const DtVector & newBodyAcceleration,
212  const DtDcm & newLocalOrientation,
213  const double newRotationRate,
214  DtVector & newRelativeVelocity,
215  DtVector & newRelativeAcceleration,
216  DtTaitBryan & newLocalOrientationTb,
217  DtVector & newBodyRotationalVelocity
218  );
219 
226  virtual void useFuel(double fuelUsed);
227 
228  virtual bool isEntityImmobilized();
229 
235  virtual double fuelLeft() const;
236 
254  virtual void updateRepository(const DtVector & localPosition,
255  const DtVector & localVelocity, const DtVector & localAcceleration,
256  const DtTaitBryan & localOrientation, const DtVector& rotationalVelocity,
257  double newHeading);
258 
284  virtual void calculateOrientationAndPosition(
285  const DtVector& newLocalProjectedLocation, const double newHeading,
286  DtDcm& newLocalOrientation, DtVector& newLocalPosition);
287 
291  virtual void calculateOriginLocation(
292  const DtVector & turnCenterLocation,
293  const double heading,
294  DtVector & originLocation);
295 
307  bool groundClamp(const double heading, const DtVector& location,
308  DtAttachedTerrain& terrain, DtVector& newNormal);
309 
314  void groundClampHighFidelity(const double heading, const DtVector& location,
315  DtAttachedTerrain& terrain, DtVector& newNormal);
316 
322  void groundClampLowFidelity(const double heading, const DtVector& location,
323  DtAttachedTerrain& terrain, DtVector& newNormal);
324 
325  DtLocalObject* entity();
327 
328 private:
331 
334 
336  const DtRoadMovementUpdater & operator=(const
337  DtRoadMovementUpdater & orig);
338 
339 protected:
342 
349 
353 
356 
359 };
360 
361 
362 
DtRoadMovementController * myController
Definition: roadMovementUpdater.h:340
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
Definition: attachedTerrain.h:45
Description: This repository holds all information that is common to all the forms of all objects wit...
Definition: vrfMovingObjectStateRepository.h:31
DtRailSegment are segments entities can follow when using the rail movement system.
Definition: railSegment.h:23
Instances of DtRailMovementControllerPSR are used to hold the shared/checkpointable data for a rail m...
Definition: railMovementControllerPSR.h:47
DtRailMovementControllerPSR * myRailMovementPSR
Definition: roadMovementUpdater.h:341
DtRoadMovementController is a movement controller that models an entity&#39;s movement along a road path...
Definition: roadMovementController.h:65
Models an entity moving along a generated road path. Provides a kinematics-based model of an entity m...
Definition: roadMovementUpdater.h:42
const DtAttachedTerrain * myAttachedTerrain
Used to ground clamp the entity– TODO how we ground clamp, ie get access to terrain may change...
Definition: roadMovementUpdater.h:346
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Port group used to set what values should be set into the VRF state repository. All values are in loc...
Definition: roadMovementUpdater.h:352
bool myUseHighFidelityGroundClamping
Definition: roadMovementUpdater.h:347
bool myWarnedAboutImmobilizedOnce
To warn user about new immobilization just once.
Definition: roadMovementUpdater.h:355
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
Description of one segment of a road.
Definition: roadSegment.h:394
bool myDrivingOnLeft
Definition: roadMovementUpdater.h:348
DtUpdateRepositoryOutputPortGroup is a data port group of a data consumer that contains methods and p...
Definition: updateRepositoryOutputPortGroup.h:31
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Member to allow for access to platform specific data.
Definition: roadMovementUpdater.h:358
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 Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)