VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
humanMovementActuator.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
17 #include <map>
19 
20 class DtInputPortGroup;
21 class DtAnalogInputPort;
24 class DtIntegerInputPort;
26 class DtAttachedTerrain;
27 class DtBooleanInputPort;
29 class DtAnalogOutputPort;
30 class DtVectorInputPort;
34 class DtSurface;
35 
44 {
45 private:
50 
51 public:
52 
53  typedef std::map<DtLifeformStaticPosture, DtLifeformState>
55 
56 public:
59  DtHumanMovementActuator(const DtString& name,
60  DtLocalObject* owner,
61  DtSimulationServices* simManager,
62  DtComponentDescriptor* desc = 0,
63  DtReaderWriterRegistry* parentRegistry = 0);
64 
66  virtual ~DtHumanMovementActuator();
67 
70  virtual bool init();
71 
74  virtual const char* type() const;
75 
77  virtual bool createPSR();
78 
79  virtual void preFirstTickInit();
80 
81  virtual void tick();
82 
86  static DtSimComponent * creator(const DtString& name,
87  DtLocalObject* owner,
88  DtSimulationServices* simManager,
89  DtComponentDescriptor* desc = 0,
90  DtReaderWriterRegistry* parentRegistry = 0);
91 
92 protected:
95  virtual double calculateMaxSpeed();
96 
101  virtual double maxSpeedFromFacingError(const double desiredHeading,
102  const double currentHeading) const;
103 
104  virtual double maxSpeedSoilFactor() const;
105 
106  virtual DtVector calculateProjectedLocation(
107  const DtVector& oldLocalPosition, const DtVector& newBodyVelocity,
108  double newHeading, double dt = -1);
109 
129  virtual void calculateOrientationAndPosition(
130  const DtVector& newLocalProjectedLocation, double newHeading, double newFacingOrientation,
131  DtDcm& newLocalOrientation, DtDcm& newLocalDirectionOfMovement, DtVector& newLocalPosition);
132 
159  virtual void identifySupportSurfaceAndAltitude(
160  const DtVector& testPosition,
161  const double altOfTestPosition,
162  const DtVector& stepUpVector,
163  const double bodyHeight,
164  DtSurface& interactionSurface,
165  double& adjustedAltitude);
166 
169  virtual double stepUpFractionLimit() const;
170 
173  virtual double underWaterFraction() const;
174 
180  virtual double dropSpeed() const;
181 
190 
202  virtual double altitudeForNoTerrainBelow(double projectedPointAlt,
203  DtVector projectedPoint,
204  double surfacePointAlt) const;
205 
220  virtual double altitudeForDropToSurface(double projectedPointAlt,
221  DtVector projectedPoint,
222  double surfacePointAlt) const;
223 
233  virtual double altitudeForNearbySurface(double projectedPointAlt,
234  DtVector projectedPoint,
235  double surfacePointAlt) const;
236 
248  virtual double altitudeForNoSurface(double projectedPointAlt,
249  DtVector projectedPoint) const;
250 
252 
253  virtual void updateRepository(const DtVector & position,
254  const DtVector & velocity, const DtVector & acceleration,
255  const DtTaitBryan & localOrientation, const DtVector& rotationalVelocity,
256  double newHeading);
257 
261  virtual void computeAndSetPosture();
262 
265  virtual DtLifeformState computeDynamicPosture(DtLifeformStaticPosture staticPosture);
266 
271  virtual DtLifeformStaticPosture restrictPostureForTerrain(DtLifeformStaticPosture desiredPosture);
272 
281  virtual bool checkForTerrainCollisions() const;
282 
285  virtual bool checkForEntityCollisions() const;
286 
294  virtual bool checkBlockedByTerrain(const DtVector& oldLocalPosition,
295  DtVector& newLocalProjectedLocation, double heightFraction = -1.0);
296 
297  virtual bool checkBlockedByEntities(const DtVector& oldLocalPosition,
298  DtVector& newLocalProjectedLocation);
299 
304  virtual DtChord movementChord(const DtVector& oldLocalPosition, const DtVector& newLocalProjectedLocation,
305  DtVector& intersectionVec, DtVector& bvCenterStartFromOldPos);
306 
309  virtual DtChord movementChordAtHeight(const DtVector& oldLocalPosition, const DtVector& newLocalProjectedLocation,
310  double heightFraction, DtVector& intersectionVec, DtVector& offsetFromOldPosition);
311 
317  virtual double maxUprightTerrainPitch() const;
318 
323  virtual double maxWalkingSpeed() const;
324 
326  virtual void initializeStaticToDynamicPostureMap();
327 
329  virtual bool computeEntityDirOfMovement(double& heading) const;
330 
333  virtual double calculateTerrainPitch(const DtVector& localPosition,
334  double heading, const DtAttachedTerrain& terrain);
335 
337  virtual bool createPorts();
338 
340  virtual bool createPortGroups();
341 
355  virtual bool getSurfacesBelow(const DtVector& testPosition,
356  double underWaterLimit,
357  const DtAttachedTerrain* terrain,
359  bool& dataAvailable);
360 
364  virtual bool closestSurfaceAbove(const DtVector& testPosition,
365  const DtAttachedTerrain* terrain,
366  double &altitude, DtSurface &surface);
367 
371  virtual bool isWater(const DtSurface & surface);
372 
373  static void setHeadingCallback(DtSimMessage * msg, void * usr);
374  virtual void processSetHeading(DtSimMessage* msg);
375 
376  static void setGroundClampFidelityCallback(DtSimMessage * msg, void * usr);
377  virtual void processGroundClampFidelity(DtSimMessage* msg);
378 
380  virtual bool checkAndDisembarkIfEmbarked(const DtVector& localPosition);
381 
384  virtual bool checkIfMoveOntoEmbarked(const DtVector& localPosition);
385 
386  virtual bool initializeAglPort();
387 
388  virtual void setTerrainUpdateFlagsBasedonDataAvailable(bool dataAvailable);
389 
391 
394  virtual void calculateOrientationAndPositionCrawling(
395  const DtVector& newLocalProjectedLocation, double newHeading, double newFacingOrientation,
396  DtDcm& newLocalOrientation, DtDcm& newLocalDirectionOfMovement, DtVector& newLocalPosition);
397 
398  virtual void groundClamp(double heading,
399  const DtVector& location, DtAttachedTerrain& terrainDatabase, DtVector& newNormal);
400 
401  virtual void calculateDirectionOfLinearMotion(
402  const DtDcm& newLocalOrientation, double desiredDirectionOfMovement, const DtVector& newLocalPosition,
403  DtDcm& newLocalDirectionOfLinearMotion);
404 
405  virtual bool closestIntersectionWithBias(const DtVector& localPosition, DtVrfChordIntersectionRecord& record,
406  DtIntersectionRecord::DtIntersectionType irtFlag, double bias,
407  const DtAttachedTerrain* terrain);
409 
410 
414  static void terainChangeNotification(const DtExtent& spatExtent, void* usr);
415 
420  virtual void processTerrainChangeNotification(const DtExtent& spatExtent);
421 
423 
425  virtual void detachFromParentDueToAutomaticDisembark();
426 
427 protected:
430 
438 
448 
455 
460 
468 
476 
483 
490 
491 
498 
504 
508 
512  mutable double myMutablePitch;
513  mutable bool myMutablePitchValid;
514 
516 
518 
520 
522 
525 
529 
532 
534 
537 
539 
540 
543 
546 
549 
554 };
555 
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
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
DtVrfMovingObjectStateRepository * myMovingObjectStateRepository
Convenience pointers to our state repository.
Definition: humanMovementActuator.h:501
DtStaticToDynamicPostureMap myStaticToDynamicPostureMap
Definition: humanMovementActuator.h:517
Definition: attachedTerrain.h:46
DtVrfChordIntersectionRecord represents a list of DtChordIntersectRecords. This is useful for followi...
Definition: vrfChordIntersectRecordList.h:31
Description: This repository holds all information that is common to all the forms of all objects wit...
Definition: vrfMovingObjectStateRepository.h:31
DtVector myPreviousDestination
Definition: humanMovementActuator.h:538
const DtActuatorComponent & operator=(const DtActuatorComponent &orig)
assignment operator
Description: This repository holds all information that is common to all the forms of humans within t...
Definition: humanStateRepository.h:33
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
virtual bool init()
Overridden to cache a pointer to the entity&#39;s radio in this class.
DtHumanMovementActuatorPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: humanMovementActuator.h:507
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtVectorInputPort * myDestinationInputPort
Input Port Name: destination Input Port Description: Specifies the current destination of the entity ...
Definition: humanMovementActuator.h:475
Definition: readerWriterRegistry.h:39
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
Definition: surface.h:181
Contains class declarations for DtIntegerInputPort, DtIntegerOutputPort, and DtIntegerPortData.
Definition: integerIOPort.h:25
End User Description: DtActuator is the base class for all actuator model components. Developer Description: The DtActuator base class caches a pointer to the entity&#39;s radio for convenience. Derived classes may have articulated parts that are configured from the DtActuatorComponentDescriptor&#39;s DtSimArtPartDescriptorList. For each articulated part in the list a DtArticulatedPartStateRepository will be created to store the data for the part such as it&#39;s location, rotation and so forth. These are created in the entity&#39;s DtVrfObjectStateRepository createParts() function. This call creates all the attached parts for all the actuators. These articulated state repositories are managed by the DtAttachmentManager. They are cached by their partType which is the DIS Enumeration describing the part from the disEnums.h file and was specified in the actuator&#39;s DtActuatorComponentDescriptor as descriped above. The partType is used as the category of the DtObjectType used to look up articulated parts in the DtAttachementManager. When an actuator needs access to a particular articulated part it looks it up by the part&#39;s object type.
Definition: actuatorComponent.h:47
bool myWasOnGround
These states are used for controlling debug print statements.
Definition: humanMovementActuator.h:524
DtBooleanInputPort * myPostureChangingPort
Input Port Name: posture-changing Input Port Description: Will be used to halt movement if set...
Definition: humanMovementActuator.h:482
Contains class declarations for DtVectorInputPort, DtVectorOutputPort, and DtVectorPortData.
Definition: vectorIOPort.h:27
DtHumanMovementActuatorDescriptor; descriptor for the DtHumanMovementActuatorDescriptor component...
Definition: humanMovementActuatorDescriptor.h:26
bool myPreviouslyEmbarked
Definition: humanMovementActuator.h:521
Instances of DtAnalogOutputPort are input ports through which data producers can send real numbers...
Definition: analogIOPort.h:45
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Port group used to set what values should be set into the VRF state repository. All values are in loc...
Definition: humanMovementActuator.h:528
DtLifeformStaticPosture
These are the available static postures for lifeform (human) entities. Static postures are equivalent...
Definition: lifeformStaticPostures.h:22
DtHumanMovementActuator is a simple movement actuator for lifeforms.
Definition: humanMovementActuator.h:43
bool myAglPortInitialized
Definition: humanMovementActuator.h:535
File: simMsg.h.
Definition: simMessage.h:35
Contains the DtLifeformStaticPosture enumeration declaration.
double myPostureSpeed
Definition: humanMovementActuator.h:542
DtVector myCachedPosition
Definition: humanMovementActuator.h:536
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
double myMutablePitch
This value is the pitch of the terrain under the entity. Since it is expensive to calculate...
Definition: humanMovementActuator.h:512
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
DtAnalogInputPort * myFacingDirectionInputPort
Input Port Name: desired-facing-direction Input Port Description: Desired facing direction of the ent...
Definition: humanMovementActuator.h:447
DtIntegerInputPort * myDesiredStaticPostureInputPort
Input Port Name: desired-static-posture Input Port Description: The desired posture of the entity...
Definition: humanMovementActuator.h:467
DtVector myLastParentPosition
Definition: humanMovementActuator.h:515
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
DtInputPortGroup * myMovementControlInputPortGroup
Input Port Group Name: movement-control Input Port Group Description: Collection of inputs specifying...
Definition: humanMovementActuator.h:459
DtAnalogInputPort * mySpeedInputPort
Input Port Name: desired-speed Input Port Description: Desired speed of the entity in m/s...
Definition: humanMovementActuator.h:454
double myDesiredFacingDirection
Definition: humanMovementActuator.h:530
DtAnalogOutputPort * myAltitudeAglOutputPort
Output Port Name: altitude-agl Output Port Description: Altitude above ground level. Output Port Range: 0 and up. Output Port Default Value: 0.
Definition: humanMovementActuator.h:496
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
Definition: vrfChordIntersectionRecord.h:19
DtAnalogInputPort * myMovementDirectionInputPort
Input Port Name: desired-movement-direction Input Port Description: Desired movement direction of the...
Definition: humanMovementActuator.h:437
bool myPostureChanging
Definition: humanMovementActuator.h:541
DtInputPortGroup is a data port group of a data consumer. It may contain any number of DtInputPorts a...
Definition: inputPortGroup.h:35
Contains class declarations for DtAnalogInputPort, DtAnalogOutputPort, and DtAnalogPortData.
Definition: analogIOPort.h:25
bool myDataUnavailableOnTerrainUpdate
A flag to indicate that data was not available when querying terrain during a terrain update so that ...
Definition: humanMovementActuator.h:553
DtHumanStateRepository * myHumanStateRepository
Convenience pointers to our state repository.
Definition: humanMovementActuator.h:502
Definition: humanMovementActuatorPSR.h:20
std::map< DtLifeformStaticPosture, DtLifeformState > DtStaticToDynamicPostureMap
Definition: humanMovementActuator.h:54
DtUpdateRepositoryOutputPortGroup is a data port group of a data consumer that contains methods and p...
Definition: updateRepositoryOutputPortGroup.h:31
bool myMutablePitchValid
Definition: humanMovementActuator.h:513
bool myUseDesiredFacingDirectionValue
Definition: humanMovementActuator.h:531
DtHumanLocalObjectFacade myHumanLocalObjectFacade
Member to allow for access to platform specific data.
Definition: humanMovementActuator.h:545
bool myTerrainUpdateTriggeredFlag
A flag that is set if the terrain has been altered.
Definition: humanMovementActuator.h:548
DtUUID myWasJustEmbarkedOn
Definition: humanMovementActuator.h:533
virtual const char * type() const =0
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtIntersectionType
Definition: intersectionRecord.h:41
const DtHumanMovementActuatorDescriptor * myHumanMovementActuatorDescriptor
Definition: humanMovementActuator.h:519
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
DtIntegerInputPort * myOverrideGroundClampFidelityPort
Input Port Name: override-ground-clamp-fidelity Input Port Description: Indicates whether or not the ...
Definition: humanMovementActuator.h:489

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)