VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
surfaceEntitySimpleActuator.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
14 #include "geometry/surface.h"
15 
16 class DtString;
21 class DtAnalogInputPort;
22 class DtBooleanInputPort;
25 
26 
43 {
44 
45 public:
46 
51  DtLocalObject* owner,
52  DtSimulationServices* simManager,
53  DtComponentDescriptor* desc = 0,
54  DtReaderWriterRegistry* parentRegistry = 0);
55 
61 
64  virtual bool init();
65 
68  virtual const char* type() const;
69 
71  virtual bool postAddComponentsInit();
72 
75  virtual void initProcessSR();
76 
91  virtual void tick();
92 
101  virtual void decrementFuelResource(double fuelUsed);
102 #if 0
103 
110  virtual double fuelLeft() const;
111 #endif
112  static DtSimComponent * creator(const DtString& name,
116  DtLocalObject* owner,
117  DtSimulationServices* simManager,
118  DtComponentDescriptor* desc = 0,
119  DtReaderWriterRegistry* parentRegistry = 0);
120 
121 protected:
122 
125  virtual bool createPortGroups();
126 
130  virtual bool createPorts();
131 
132  virtual void updateHeading(const double dT, double& newHeading);
133 
147  virtual void updateVelocity(const double dT, const double newHeading,
148  const double newVerticalSpeed,
149  double& acceleratingDT, double& newSpeed,
150  DtVector& newVelocity, bool& maxSpeedAchieved);
151 
156  virtual double updateVerticalSpeed(const double dT);
157 
176  virtual void updateOrientationAndPosition(const double dT,
177  const double acceleratingDT, const double newHeading,
178  DtVector& newVelocity, const double newSpeed,
179  DtDcm& newBodyToLocalMatrix, DtVector& newPosition);
180 
187  virtual void adjustAttitude(const double newSpeed, const DtVector& position,
188  const double yawRate,
189  double &roll, double &pitch, double &altitudeAdj);
190 
198  virtual void setAltitude(DtVector& localPosition, const Coordinate_System* cs,
199  const double altitudeAdjustment);
200 
208  virtual bool getTerrainSurfaces(const DtVector& databaseLocation,
209  double& groundHeight, DtSurface& groundSurface, DtVector& groundNormal,
210  double& waterHeight, DtSurface::DtMedium & topSurfaceMedium,
211  bool* dataAvailable = 0, bool overrideBlockingAssert = false);
212 
220  virtual bool isShipAground(const DtVector& localPosition,
221  const DtDcm& bodyToLocalMatrix,
223 
226  virtual void sinkingAttitude(const DtVector& newPosition,
227  DtDcm& newBodyToLocalMatrix);
228 
233  virtual void setOrientationToBottom(const DtVector& newPosition,
234  const double newHeading, const DtVector& groundNormal,
235  DtDcm& newBodyToLocalMatrix);
236 
247  virtual void computeNewRates(
248  const double turnRate, const double newSpeed, const double newHeading,
249  const double acceleration, const DtDcm& bodyToLocalMatrix,
250  DtVector& bodyRotationRates, DtVector& relativeAcceleration,
251  double & limitedAcceleration);
252 
257  virtual void sinkingRates(DtVector& newPosition,
258  DtVector& newVelocity, DtVector& newRelativeAcceleration,
259  DtVector& newBodyRotationRates);
260 
266  virtual void unpoweredDriftRates(const double newSpeed,
267  const double newHeading,
268  DtVector& newBodyRotationRates, DtVector& newRelativeAcceleration);
272  double driftDecelerationMagnitude() const;
273 
279  virtual void updateRepository(
280  const DtVector& newPosition,
281  const DtVector& newVelocity,
282  const DtVector& newAcceleration,
283  const DtTaitBryan& newOrientation,
284  const DtVector& newBodyRotationRates);
285 
288  virtual double computeFuelUsed(const double dT);
289 
290  DtSurfaceEntityStateRepository * surfaceEntityState (void) const;
291 
297  virtual bool createPSR();
298 
299 protected:
300 
303 
306  (const DtSurfaceEntitySimpleActuator & orig);
307 
309  const DtSurfaceEntitySimpleActuator & operator=
310  (const DtSurfaceEntitySimpleActuator & orig);
311 
312 
313 protected:
318 
321 
325 
344 
346 
350 
354 
357 
361 
369 
373 
380 
384 };
385 
double mySinkingPitchRate
Parameters that define how this ship will sink. Determined randomly at init time. ...
Definition: surfaceEntitySimpleActuator.h:377
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual bool postAddComponentsInit()
Called after all components have been created, initialized and added to the component manager...
Definition: simComponent.h:128
Definition: surfaceEntityParameters.h:24
DtInputPortGroup * mySurfaceControlPortGroup
Input Port Group Name: surface-control Input Port Group Description:
Definition: surfaceEntitySimpleActuator.h:324
double myWaterHeight
Computed at the beginning of every tick; remembered for use in the tick:
Definition: surfaceEntitySimpleActuator.h:366
Definition: surfaceMovementPSR.h:59
virtual bool init()
Overridden to cache a pointer to the entity's radio in this class.
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Definition: surfaceEntitySimpleActuator.h:383
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
const DtSurfaceEntityParameters * myParameters
Definition: surfaceEntitySimpleActuator.h:316
Definition: surface.h:181
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's radio for convenience. Derived classes may have articulated parts that are configured from the DtActuatorComponentDescriptor's DtSimArtPartDescriptorList. For each articulated part in the list a DtArticulatedPartStateRepository will be created to store the data for the part such as it's location, rotation and so forth. These are created in the entity'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'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's object type.
Definition: actuatorComponent.h:47
DtAnalogInputPort * myClampSpeedPort
Clamp speed is the speed that the controller is trying to accelerate (or decelerate) to; if dT is une...
Definition: surfaceEntitySimpleActuator.h:336
DtSurfaceMovementPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: surfaceEntitySimpleActuator.h:353
DtAnalogInputPort * myTurnRatePort
Turn rate in radians/sec, with positive meaning a turn to the right. Note that if speed < 0...
Definition: surfaceEntitySimpleActuator.h:341
Definition: coordSystem.h:54
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
This repository holds all information that is common to all the forms of local surface entities withi...
Definition: surfaceEntityStateRepository.h:26
Contains class declarations for DtBooleanInputPort, DtBooleanOutputPort, and DtBooleanPortData.
Definition: boolIOPort.h:25
double mySinkingRollRate
Parameters that define how this ship will sink. Determined randomly at init time. ...
Definition: surfaceEntitySimpleActuator.h:378
DtAnalogInputPort * myAccelerationPort
Acceleration can be positive or negative. Acceleration in either direction is assumed to be effected ...
Definition: surfaceEntitySimpleActuator.h:331
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
Contains class declaration for DtSurfaceEntityActuatorDescriptor, descriptor for the DtSurfaceEntityA...
Definition: surfaceEntityActuatorDescriptor.h:26
Definition: surface.h:192
DtUpdateRepositoryOutputPortGroup * myUpdateRepositoryOutputPortGroup
Port group used to set what values should be set into the VRF state repository. All values are in loc...
Definition: surfaceEntitySimpleActuator.h:349
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:94
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
bool myAgroundAndDestroyed
Remembered after this state is first entered, to avoid recomputation in future ticks. The entity never leaves this state.
Definition: surfaceEntitySimpleActuator.h:372
DtSurfaceEntityStateRepository * mySurfaceEntityState
Cache some pointers.
Definition: surfaceEntitySimpleActuator.h:315
double mySinkingStartRate
Parameters that define how this ship will sink. Determined randomly at init time. ...
Definition: surfaceEntitySimpleActuator.h:379
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
DtAnalogInputPort * myFinalHeadingPort
Final heading that the entity is clamped to, if dT is too large.
Definition: surfaceEntitySimpleActuator.h:343
double myMaxRollRate
Remember a reasonable value for maximum roll rate for this entity, based on mass. Computed at init ti...
Definition: surfaceEntitySimpleActuator.h:360
DtSurfaceEntityActuatorDescriptor * myDescriptor
Definition: surfaceEntitySimpleActuator.h:317
DtMedium
Definition: surface.h:187
bool myOutOfFuelWarningPrinted
Remembers if the warning has been printed, so it's only printed once.
Definition: surfaceEntitySimpleActuator.h:356
DtUpdateRepositoryOutputPortGroup is a data port group of a data consumer that contains methods and p...
Definition: updateRepositoryOutputPortGroup.h:31
Provides a simple, kinematics-based model for surface vessels.
Definition: surfaceEntitySimpleActuator.h:42
virtual const char * type() const =0
Returns a string identifies the class type of component. Type values are defined in compTypes...
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
bool myIsAground
Computed at the beginning of every tick; remembered for use in the tick:
Definition: surfaceEntitySimpleActuator.h:367
double mySeaFloorHeight
Computed at the beginning of every tick; remembered for use in the tick:
Definition: surfaceEntitySimpleActuator.h:365

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)