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 
19 
20 #include <map>
21 
22 class DtInputPortGroup;
23 class DtAnalogInputPort;
26 class DtIntegerInputPort;
28 class DtAttachedTerrain;
29 class DtBooleanInputPort;
31 class DtAnalogOutputPort;
32 class DtVectorInputPort;
36 class DtSurface;
37 
46 {
47 private:
52 
53 public:
54 
55  typedef std::map<DtLifeformStaticPosture, DtLifeformState>
57 
58 public:
61  DtHumanMovementActuator(const DtString& name,
62  DtLocalObject* owner,
63  DtSimulationServices* simManager,
64  DtComponentDescriptor* desc = 0,
65  DtReaderWriterRegistry* parentRegistry = 0);
66 
68  virtual ~DtHumanMovementActuator() override;
69 
72  virtual bool init() override;
73 
76  virtual const char* type() const override;
77 
79  virtual bool createPSR();
80 
81  virtual void preFirstTickInit() override;
82 
83  virtual void tick() override;
84 
88  static DtSimComponent * creator(const DtString& name,
89  DtLocalObject* owner,
90  DtSimulationServices* simManager,
91  DtComponentDescriptor* desc = 0,
92  DtReaderWriterRegistry* parentRegistry = 0);
93 
94 protected:
97  virtual double calculateMaxSpeed();
98 
103  virtual double maxSpeedFromFacingError(const double desiredHeading,
104  const double currentHeading) const;
105 
106  virtual double maxSpeedSoilFactor() const;
107 
108  virtual DtVector calculateProjectedLocation(
109  const DtVector& oldLocalPosition, const DtVector& newBodyVelocity,
110  double newHeading, double dt = -1);
111 
131  virtual void calculateOrientationAndPosition(
132  const DtVector& newLocalProjectedLocation, double newHeading, double newFacingOrientation,
133  DtDcm& newLocalOrientation, DtDcm& newLocalDirectionOfMovement, DtVector& newLocalPosition);
134 
161  virtual void identifySupportSurfaceAndAltitude(
162  const DtVector& testPosition,
163  const double altOfTestPosition,
164  const DtVector& stepUpVector,
165  const double bodyHeight,
166  DtSurface& interactionSurface,
167  double& adjustedAltitude);
168 
171  virtual double stepUpFractionLimit() const;
172 
175  virtual double underWaterFraction() const;
176 
182  virtual double dropSpeed() const;
183 
192 
204  virtual double altitudeForNoTerrainBelow(double projectedPointAlt,
205  DtVector projectedPoint,
206  double surfacePointAlt) const;
207 
222  virtual double altitudeForDropToSurface(double projectedPointAlt,
223  DtVector projectedPoint,
224  double surfacePointAlt) const;
225 
235  virtual double altitudeForNearbySurface(double projectedPointAlt,
236  DtVector projectedPoint,
237  double surfacePointAlt) const;
238 
250  virtual double altitudeForNoSurface(double projectedPointAlt,
251  DtVector projectedPoint) const;
252 
254 
255  virtual void updateRepository(const DtVector & position,
256  const DtVector & velocity, const DtVector & acceleration,
257  const DtTaitBryan & localOrientation, const DtVector& rotationalVelocity,
258  double newHeading);
259 
263  virtual void computeAndSetPosture();
264 
267  virtual DtLifeformState computeDynamicPosture(DtLifeformStaticPosture staticPosture);
268 
273  virtual DtLifeformStaticPosture restrictPostureForTerrain(DtLifeformStaticPosture desiredPosture);
274 
283  virtual bool checkForTerrainCollisions() const;
284 
287  virtual bool checkForEntityCollisions() const;
288 
296  virtual bool checkBlockedByTerrain(const DtVector& oldLocalPosition,
297  DtVector& newLocalProjectedLocation, double heightFraction = -1.0);
298 
299  virtual bool checkBlockedByEntities(const DtVector& oldLocalPosition,
300  DtVector& newLocalProjectedLocation);
301 
306  virtual DtChord movementChord(const DtVector& oldLocalPosition, const DtVector& newLocalProjectedLocation,
307  DtVector& intersectionVec, DtVector& bvCenterStartFromOldPos);
308 
311  virtual DtChord movementChordAtHeight(const DtVector& oldLocalPosition, const DtVector& newLocalProjectedLocation,
312  double heightFraction, DtVector& intersectionVec, DtVector& offsetFromOldPosition);
313 
319  virtual double maxUprightTerrainPitch() const;
320 
325  virtual double maxWalkingSpeed() const;
326 
328  virtual void initializeStaticToDynamicPostureMap();
329 
331  virtual bool computeEntityDirOfMovement(double& heading) const;
332 
335  virtual double calculateTerrainPitch(const DtVector& localPosition,
336  double heading, const DtAttachedTerrain& terrain);
337 
339  virtual bool createPorts() override;
340 
342  virtual bool createPortGroups() override;
343 
357  virtual bool getSurfacesBelow(const DtVector& testPosition,
358  double underWaterLimit,
359  const DtAttachedTerrain* terrain,
361  bool& dataAvailable);
362 
366  virtual bool closestSurfaceAbove(const DtVector& testPosition,
367  const DtAttachedTerrain* terrain,
368  double &altitude, DtSurface &surface);
369 
373  virtual bool isWater(const DtSurface & surface);
374 
375  static void setHeadingCallback(DtSimMessage * msg, void * usr);
376  virtual void processSetHeading(DtSimMessage* msg);
377 
378  static void setGroundClampFidelityCallback(DtSimMessage * msg, void * usr);
379  virtual void processGroundClampFidelity(DtSimMessage* msg);
380 
382  virtual bool checkAndDisembarkIfEmbarked(const DtVector& localPosition);
383 
386  virtual bool checkIfMoveOntoEmbarked(const DtVector& localPosition);
387 
388  virtual bool initializeAglPort();
389 
390  virtual void setTerrainUpdateFlagsBasedonDataAvailable(bool dataAvailable);
391 
393 
396  virtual void calculateOrientationAndPositionCrawling(
397  const DtVector& newLocalProjectedLocation, double newHeading, double newFacingOrientation,
398  DtDcm& newLocalOrientation, DtDcm& newLocalDirectionOfMovement, DtVector& newLocalPosition);
399 
400  virtual void groundClamp(double heading,
401  const DtVector& location, DtAttachedTerrain& terrainDatabase, DtVector& newNormal);
402 
403  virtual void calculateDirectionOfLinearMotion(
404  const DtDcm& newLocalOrientation, double desiredDirectionOfMovement, const DtVector& newLocalPosition,
405  DtDcm& newLocalDirectionOfLinearMotion);
406 
407  virtual bool closestIntersectionWithBias(const DtVector& localPosition, DtVrfChordIntersectionRecord& record,
408  DtIntersectionRecord::DtIntersectionType irtFlag, double bias,
409  const DtAttachedTerrain* terrain);
411 
412 
416  static void terainChangeNotification(const DtTerrainChangeNotificationInfo& terrainChangeInfo, void* usr);
417 
422  virtual void processTerrainChangeNotification(const DtTerrainChangeNotificationInfo& terrainChangeInfo);
423 
425 
427  virtual void detachFromParentDueToAutomaticDisembark();
428 
429 protected:
432 
440 
450 
457 
462 
470 
478 
485 
492 
493 
500 
506 
510 
514  mutable double myMutablePitch;
515  mutable bool myMutablePitchValid;
516 
518 
520 
522 
524 
527 
531 
534 
536 
539 
541 
542 
545 
548 
551 
556 };
557 
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:503
DtStaticToDynamicPostureMap myStaticToDynamicPostureMap
Definition: humanMovementActuator.h:519
This class is used to interface with the terrain a particular entity is &quot;attached&quot; to...
Definition: attachedTerrain.h:57
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:540
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...
DtHumanMovementActuatorPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: humanMovementActuator.h:509
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:477
Definition: readerWriterRegistry.h:39
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 DtEntityType 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:526
DtBooleanInputPort * myPostureChangingPort
Input Port Name: posture-changing Input Port Description: Will be used to halt movement if set...
Definition: humanMovementActuator.h:484
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:523
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:530
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:45
bool myAglPortInitialized
Definition: humanMovementActuator.h:537
File: simMsg.h.
Definition: simMessage.h:35
virtual bool init() override
Overridden to cache a pointer to the entity&#39;s radio in this class.
Contains the DtLifeformStaticPosture enumeration declaration.
double myPostureSpeed
Definition: humanMovementActuator.h:544
DtVector myCachedPosition
Definition: humanMovementActuator.h:538
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:514
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:449
DtIntegerInputPort * myDesiredStaticPostureInputPort
Input Port Name: desired-static-posture Input Port Description: The desired posture of the entity...
Definition: humanMovementActuator.h:469
DtVector myLastParentPosition
Definition: humanMovementActuator.h:517
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:461
DtAnalogInputPort * mySpeedInputPort
Input Port Name: desired-speed Input Port Description: Desired speed of the entity in m/s...
Definition: humanMovementActuator.h:456
double myDesiredFacingDirection
Definition: humanMovementActuator.h:532
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:498
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:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
Definition: vrfChordIntersectionRecord.h:19
DtAnalogInputPort * myMovementDirectionInputPort
Input Port Name: desired-movement-direction Input Port Description: Desired movement direction of the...
Definition: humanMovementActuator.h:439
bool myPostureChanging
Definition: humanMovementActuator.h:543
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:555
DtHumanStateRepository * myHumanStateRepository
Convenience pointers to our state repository.
Definition: humanMovementActuator.h:504
Definition: humanMovementActuatorPSR.h:20
std::map< DtLifeformStaticPosture, DtLifeformState > DtStaticToDynamicPostureMap
Definition: humanMovementActuator.h:56
DtUpdateRepositoryOutputPortGroup is a data port group of a data consumer that contains methods and p...
Definition: updateRepositoryOutputPortGroup.h:31
bool myMutablePitchValid
Definition: humanMovementActuator.h:515
bool myUseDesiredFacingDirectionValue
Definition: humanMovementActuator.h:533
Provides information about the terrain changes: mySpatExtent defines the terrain change type - e...
Definition: terrainImplementation.h:50
DtHumanLocalObjectFacade myHumanLocalObjectFacade
Member to allow for access to platform specific data.
Definition: humanMovementActuator.h:547
bool myTerrainUpdateTriggeredFlag
A flag that is set if the terrain has been altered.
Definition: humanMovementActuator.h:550
DtUUID myWasJustEmbarkedOn
Definition: humanMovementActuator.h:535
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:521
A locally simulated VRF object.
Definition: localObject.h:98
DtIntegerInputPort * myOverrideGroundClampFidelityPort
Input Port Name: override-ground-clamp-fidelity Input Port Description: Indicates whether or not the ...
Definition: humanMovementActuator.h:491

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)