VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtSurfaceEntitySimpleActuator Class Reference

Provides a simple, kinematics-based model for surface vessels.

End User Description: A simple surface ship actuator that provides for ships to move according to acceleration, speed and turn commands. In effect, low level actions such as setting the engine commands (forward/back, amount) and rudder commands (degrees) are abstracted away. The inputs are simply desired acceleration, desired turn radius, and final speed/heading. This makes this actuator something of a low-level controller. The DtSurfaceEntitySimpleActuator converts acceleration and turn radius inputs into orientation (heading), acceleration, velocity, and position.

Uses Descriptor Type: DtSurfaceEntitySimpleActuatorDescriptor

Inheritance diagram for DtSurfaceEntitySimpleActuator:
Inheritance graph
[legend]

Public Member Functions

 DtSurfaceEntitySimpleActuator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtSurfaceEntitySimpleActuator ()
 
virtual bool init ()
 
virtual const chartype () const
 
virtual bool postAddComponentsInit ()
 
virtual void initProcessSR ()
 
virtual void tick ()
 
virtual void decrementFuelResource (double fuelUsed)
 
- Public Member Functions inherited from DtActuatorComponent
virtual ~DtActuatorComponent ()
 
virtual DtSimRadioradio ()
 
virtual bool tickWhileDestroyed () const
 
- Public Member Functions inherited from DtSimComponent
 DtSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simServices, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtSimComponent ()
 
virtual void setParentSystem (DtComponentSystem *system)
 
DtComponentSystemparentSystem () const
 
virtual void registerAttributeFunctions ()
 
virtual void preFirstTickInit ()
 
virtual void postTick ()
 
virtual void timedTick ()
 
virtual void setMinTickPeriod (double minTickPeriod, double minTickPeriodVariance)
 
virtual void setupFirstTickTime ()
 
virtual void setEntity (DtLocalObject *entity)
 
virtual DtSimComponentnextComponent ()
 
virtual DtSimComponentprevComponent ()
 
virtual void setListItem (DtListItem *item)
 
virtual DtListItem * listItem ()
 
virtual void putData (std::string &fp, int indentLevel=0)
 
virtual DtlObjPtr getData (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
 
virtual void addInputPort (DtInputPort *port)
 
virtual void removeInputPort (DtInputPort *port)
 
virtual DtInputPortlookupInputPort (const DtString &portName)
 
virtual DtList inputPortList () const
 
virtual void addOutputPort (DtOutputPort *port)
 
virtual void removeOutputPort (DtOutputPort *port)
 
virtual DtOutputPortlookupOutputPort (const DtString &portName)
 
virtual DtList outputPortList () const
 
virtual void addInputPortGroup (DtInputPortGroup *group)
 
virtual void removeInputPortGroup (DtInputPortGroup *group)
 
virtual DtInputPortGrouplookupInputPortGroup (const DtString &groupName)
 
virtual DtList inputPortGroupList () const
 
virtual void addOutputPortGroup (DtOutputPortGroup *group)
 
virtual void removeOutputPortGroup (DtOutputPortGroup *group)
 
virtual DtOutputPortGrouplookupOutputPortGroup (const DtString &groupName)
 
virtual DtList outputPortGroupList () const
 
virtual int priority () const
 
virtual void setPriority (int priority)
 
double dT () const
 
virtual void setDT (double deltaT)
 
virtual void setComponentDescriptor (DtComponentDescriptor *componentDescriptor)
 
virtual const
DtComponentDescriptor
componentDescriptor () const
 
DtVrfProcessStateRepositoryManagerpsrManager ()
 
virtual const DtSymbolStringcomponentFullName () const
 
DtPhysicalWorldphysicalWorld ()
 
const DtPhysicalWorldphysicalWorld () const
 
const DtAttachedTerrainterrainAttachedTo () const
 
DtLocalObjectentity ()
 
const DtLocalObjectentity () const
 
DtSimulationServicessimulationServices ()
 
const DtSimulationServicessimulationServices () const
 
const Coordinate_SystemcoordinateSystem () const
 
virtual void isClutterChanged ()
 
virtual bool taskVisualizationsActive () const
 
virtual bool taskVisualizationsEnabled () const
 
virtual void onRestore ()
 
makVrf::DtTaskVisualizationMaptaskVisualizations ()
 
virtual void enable ()
 
virtual void disable ()
 
virtual bool isEnabled ()
 
virtual void setIsEnabled (bool yesNo)
 
virtual DtOutputStream & objectConsoleDebug (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleVerbose (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleInfo (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleWarn (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleError (const DtString &channel="") const
 
virtual int notifyLevel () const
 
virtual DtSimResourceManagerresourceManager ()
 
virtual const
DtSimResourceManager
resourceManager () const
 
VRF4API_METHOD const
DtSimulationServices
simManager () const
 
- Public Member Functions inherited from DtReaderWriter
 DtReaderWriter ()
 
 DtReaderWriter (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 
 DtReaderWriter (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 
 DtReaderWriter (const DtString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtReaderWriter (const DtReaderWriter &, DtReaderWriterRegistry *parentRegistry=NULL)
 
const DtReaderWriteroperator= (const DtReaderWriter &orig)
 
bool operator== (const DtReaderWriter &) const
 
bool operator!= (const DtReaderWriter &rhs)
 
virtual ~DtReaderWriter ()
 
virtual void putSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 
virtual void postPutSelf ()
 
virtual void prePutSelf ()
 
virtual void getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 
virtual void postGetSelf ()
 
virtual void preGetSelf ()
 
virtual void writeSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 
virtual DtSymbolString name () const
 
virtual void addAlias (const DtSymbolString &alias)
 
virtual void addAlias (const DtString &alias)
 
virtual bool hasAlias (const DtSymbolString &alias)
 
virtual const aliasContaineraliases () const
 
virtual void setReadonly (bool flag)
 
bool isReadonly () const
 
virtual void reset ()
 
virtual int alignment () const
 
virtual bool variableIsBound () const
 
virtual void unbindVariable ()
 
virtual void setName (const DtString &)
 
virtual const charreaderWriterType () const
 
virtual const charxmlType () const
 
virtual DtString prettyPrint () const
 
std::string debugText () const
 
virtual void bindVariables (DtVariableBindingsList variableBindings)
 
virtual std::list
< DtVariableNameType
unboundVariables () const
 
bool invalid () const
 
virtual bool hasChild (const DtReaderWriter *p) const
 
virtual bool hasVariableReference () const
 
virtual void bindLocalVariables (const DtVariableBindingsList &variableBindings)
 
virtual void recordUpdateTime () const
 
virtual bool changedSinceLastChecked ()
 
virtual bool peekChangedSinceLastChecked () const
 
virtual void setValueSpecified (bool specified, bool recurse=false)
 
virtual bool valueSpecified () const
 
virtual bool isVariableReference () const
 
virtual void setIsVariableReference (bool value)
 
virtual void clearAllVariableReferenceFlags ()
 
virtual DtSymbolString variableName () const
 
virtual void setVariableName (const DtSymbolString variableName)
 
virtual const DtReaderWriterdefaultRWValue () const
 
virtual DtReaderWriterdefaultRWValue ()
 
virtual void setDefaultRWValue (DtReaderWriter *)
 
virtual bool checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 
const DtReaderWriterRegistryregistry () const
 
DtReaderWriterRegistryregistry ()
 
virtual DtPropertyInterfaceproperty ()
 
virtual const DtPropertyInterfaceproperty () const
 
virtual DtString toXml () const
 
virtual DtRwVariableBindingsgenerateVariableBindings () const
 
virtual bool toXml (const DtFilename &) const
 
virtual bool fromXml (const DtString &)
 
virtual bool fromXmlFile (const DtFilename &)
 
virtual void putSelf (DtEnvironmentSP, DtEnvValueSP parent) const
 
virtual void putData (DtEnvironmentSP, DtEnvValueSP value) const
 
virtual void putVariableReference (DtEnvironmentSP, DtEnvValueSP value) const
 
virtual void getSelf (const DtEnvironmentSP, const DtEnvValueSP root, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
 
virtual void getData (const DtEnvironmentSP, const DtEnvValueSP, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
 
virtual void unrecognizedItem (const DtEnvironmentSP env, const DtEnvValueSP root, const SearchPaths &searchPaths, const DtVariableBindingsList &varBindings)
 
virtual void getVariableReference (DtEnvironmentSP, DtEnvValueSP value)
 

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
- Static Public Member Functions inherited from DtSimComponent
static DtSimComponentFactoryfactory ()
 
static void setFactory (DtSimComponentFactory *factory)
 
static DtSimComponentcreateComponent (const DtString &name, const DtString &type, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentSystem *parentSystem, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
static void addSimComponentCreatorFcn (const DtString &type, DtSimComponentCreatorFcn fcn)
 
static VRF4API_METHOD
DtSimComponent
MarkThreadSafe (DtSimComponent *comp)
 
- Static Public Member Functions inherited from DtReaderWriter
static void putIndent (std::string &fp, int indentLevel)
 
static const
DtVariableBindingsList
nullVariableReference ()
 
static void setPostGetSelfCallback (DtGetSelfCallbackFcn fcn, void *usrData)
 
static void setPrePutSelfCallback (DtPutSelfCallbackFcn fcn, void *usrData)
 
static void setPutIndent (bool)
 
static bool putIndent ()
 
static const chartheXmlType ()
 
static const DtFilename & appPath ()
 
static void setFactoryCreatorFunction (DtReaderWriterFactoryCreatorFcn fcn)
 
static void createReaderWriterFactory ()
 
static void cleanupFactory ()
 
static DtReaderWriterFactoryfactory ()
 
static void setOutputStream (DtOutputStream *stream)
 
static DtOutputStream & outputStream ()
 
static DtReaderWritercreateFromXmlFile (const DtFilename &, bool createAsProperty=false)
 
static DtReaderWritercreateFromXml (const DtString &, bool createAsProperty=false)
 
static DtReaderWritercreateFromEnvironment (DtEnvironmentSP, bool createAsProperty=false)
 
static DtString getAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root)
 

Protected Member Functions

virtual bool createPortGroups ()
 
virtual bool createPorts ()
 
virtual void updateHeading (const double dT, double &newHeading)
 
virtual void updateVelocity (const double dT, const double newHeading, const double newVerticalSpeed, double &acceleratingDT, double &newSpeed, DtVector &newVelocity, bool &maxSpeedAchieved)
 
virtual double updateVerticalSpeed (const double dT)
 
virtual void updateOrientationAndPosition (const double dT, const double acceleratingDT, const double newHeading, DtVector &newVelocity, const double newSpeed, DtDcm &newBodyToLocalMatrix, DtVector &newPosition)
 
virtual void adjustAttitude (const double newSpeed, const DtVector &position, const double yawRate, double &roll, double &pitch, double &altitudeAdj)
 
virtual void setAltitude (DtVector &localPosition, const Coordinate_System *cs, const double altitudeAdjustment)
 
virtual bool getTerrainSurfaces (const DtVector &databaseLocation, double &groundHeight, DtSurface &groundSurface, DtVector &groundNormal, double &waterHeight, DtSurface::DtMedium &topSurfaceMedium, bool *dataAvailable=0, bool overrideBlockingAssert=false)
 
virtual bool isShipAground (const DtVector &localPosition, const DtDcm &bodyToLocalMatrix, DtSurface::DtMedium topMedium=DtSurface::WaterSurface)
 
virtual void sinkingAttitude (const DtVector &newPosition, DtDcm &newBodyToLocalMatrix)
 
virtual void setOrientationToBottom (const DtVector &newPosition, const double newHeading, const DtVector &groundNormal, DtDcm &newBodyToLocalMatrix)
 
virtual void computeNewRates (const double turnRate, const double newSpeed, const double newHeading, const double acceleration, const DtDcm &bodyToLocalMatrix, DtVector &bodyRotationRates, DtVector &relativeAcceleration, double &limitedAcceleration)
 
virtual void sinkingRates (DtVector &newPosition, DtVector &newVelocity, DtVector &newRelativeAcceleration, DtVector &newBodyRotationRates)
 
virtual void unpoweredDriftRates (const double newSpeed, const double newHeading, DtVector &newBodyRotationRates, DtVector &newRelativeAcceleration)
 
double driftDecelerationMagnitude () const
 
virtual void updateRepository (const DtVector &newPosition, const DtVector &newVelocity, const DtVector &newAcceleration, const DtTaitBryan &newOrientation, const DtVector &newBodyRotationRates)
 
virtual double computeFuelUsed (const double dT)
 
DtSurfaceEntityStateRepositorysurfaceEntityState (void) const
 
virtual bool createPSR ()
 
 DtSurfaceEntitySimpleActuator ()
 
 DtSurfaceEntitySimpleActuator (const DtSurfaceEntitySimpleActuator &orig)
 
const
DtSurfaceEntitySimpleActuator
operator= (const DtSurfaceEntitySimpleActuator &orig)
 
- Protected Member Functions inherited from DtActuatorComponent
 DtActuatorComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simServices, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual void setRadio (DtSimRadio *radio)
 
 DtActuatorComponent ()
 
- Protected Member Functions inherited from DtSimComponent
virtual void setupTimedTickLogic (double minTickPeriod, double minTickPeriodVariance)
 
virtual double computeCurrentTime ()
 
bool testInvariant () const
 
DtVrfProcessStateRepositorycreateComponentPsr (const DtString &defaultPsrType, const DtString &defaultPsrName, bool useDescriptorParams=true)
 
virtual void updateTaskVisualizations ()
 
virtual void destroyTaskVisualizations ()
 
virtual void destroyTaskVisualization (const DtString &name)
 
virtual
makVrf::DtPointTaskVisualizationPtr 
pointTaskVisualization (const DtString &name)
 
virtual
makVrf::DtLineTaskVisualizationPtr 
lineTaskVisualization (const DtString &name)
 
virtual
makVrf::DtAreaTaskVisualizationPtr 
areaTaskVisualization (const DtString &name)
 
virtual
makVrf::DtTextTaskVisualizationPtr 
textTaskVisualization (const DtString &name)
 
double calculateNextTaskVisTickTime () const
 
DtVrfObjectStateRepositorylocalStateRepository ()
 
const DtVrfObjectStateRepositorylocalStateRepository () const
 
DtPropertyInterfacecachedNextFrameStateProperty (DtPropertyInterface **prop, const DtString &propName)
 
template<typename ValType >
void setCachedNextFrameStatePropertyValue (DtPropertyInterface **prop, const DtString &propName, ValType value)
 
const DtPropertyInterfacecachedCurrentFrameStateProperty (const DtPropertyInterface **prop, const DtString &propName) const
 
template<typename ValType >
bool getCachedCurrentFrameStatePropertyValue (const DtPropertyInterface **prop, const DtString &propName, ValType &value) const
 
void addSimObjectPredicateCallback (DtSimObjectReference, DtVrfObjectPredicateCallbackFunction function, const DtVrfObjectPredicate &predicate, DtTime evaluationPeriod=0, void *userData=0)
 
void removeSimObjectPredicateCallback (const DtSimObject *, DtVrfObjectPredicateCallbackFunction function, const DtVrfObjectPredicate &predicate, DtTime evaluationPeriod=0, void *userData=0)
 
void invokeSimObjectPredicateCallbacks ()
 
virtual void clearPredicateCallbacks ()
 
- Protected Member Functions inherited from DtReaderWriter
virtual void bindToRwAsVariable (const DtReaderWriter *rw)
 

Protected Attributes

DtSurfaceEntityStateRepositorymySurfaceEntityState
 
const DtSurfaceEntityParametersmyParameters
 
DtSurfaceEntityActuatorDescriptormyDescriptor
 
DtUpdateRepositoryOutputPortGroupmyUpdateRepositoryOutputPortGroup
 
DtSurfaceMovementPSRmyProcessState
 
bool myOutOfFuelWarningPrinted
 
double myMaxRollRate
 
bool myAgroundAndDestroyed
 
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
 
Ports and Port Groups
DtInputPortGroupmySurfaceControlPortGroup
 
DtAnalogInputPortmyAccelerationPort
 
DtAnalogInputPortmyClampSpeedPort
 
DtAnalogInputPortmyTurnRatePort
 
DtAnalogInputPortmyFinalHeadingPort
 
double mySeaFloorHeight
 
double myWaterHeight
 
bool myIsAground
 
double mySinkingPitchRate
 
double mySinkingRollRate
 
double mySinkingStartRate
 
- Protected Attributes inherited from DtActuatorComponent
DtSimRadiomyRadio
 
- Protected Attributes inherited from DtSimComponent
DtLocalObjectmyEntity
 
DtComponentSystemmySystem
 
DtListItem * myListItem
 
DtInputPortMap myInputPortList
 
DtOutputPortMap myOutputPortList
 
DtInputPortGroupMap myInputPortGroupList
 
DtOutputPortGroupMap myOutputPortGroupList
 
int myPriority
 
double myLastTickSimTime
 
std::unique_ptr< DtTimedTickLogicmyTimedTickLogic
 
double myDT
 
bool myIsEnabled
 
bool myFirstTick
 
const DtComponentDescriptormyComponentDescriptor
 
std::list
< DtVrfProcessStateRepository * > 
myComponentPsrs
 
makVrf::DtTaskVisualizationMap myTaskVisualizations
 
double myNextTaskVisTickTime
 
DtSymbolString myFullComponentName
 
DtSimulationServicesmySimServices
 
DtPredicateCallbackManagermyPredicateCallbackManager
 
boost::signals2::scoped_connection myIsClutterChangedConnection
 
- Protected Attributes inherited from DtReaderWriter
const DtSymbolString myName
 
DtReaderWriterRegistry myRegistry
 
DtReaderWriterRegistrymyParentRegistry
 
bool myValueSpecified
 
bool myReadOnlyFlag
 
bool myIsVariableReference
 
DtSymbolString myVariableName
 
bool myVariableIsBound
 
DtReaderWritermyDefaultValue
 
aliasContainer myAliases
 
bool myInvalid
 
bool myChangedFlag
 

Additional Inherited Members

- Public Types inherited from DtReaderWriter
typedef std::vector
< DtSymbolString
aliasContainer
 
typedef std::vector
< DtSymbolString >::iterator 
aliasIter
 
typedef std::vector
< DtSymbolString >
::const_iterator 
aliasConstIter
 
typedef std::vector< DtFilename > SearchPaths
 
typedef std::pair
< DtSymbolString, DtString
DtVariableNameType
 
typedef DtReaderWriterFactory *(* DtReaderWriterFactoryCreatorFcn )()
 
- Protected Types inherited from DtSimComponent
typedef std::map< DtString,
DtInputPort * > 
DtInputPortMap
 
typedef std::map< DtString,
DtOutputPort * > 
DtOutputPortMap
 
typedef std::map< DtString,
DtInputPortGroup * > 
DtInputPortGroupMap
 
typedef std::map< DtString,
DtOutputPortGroup * > 
DtOutputPortGroupMap
 
- Static Protected Attributes inherited from DtSimComponent
static DtSimComponentFactorymyFactory
 
- Static Protected Attributes inherited from DtReaderWriter
static DtString theUnspecifiedValue
 
static DtGetSelfCallbackInfo thePostGetSelfCallback
 
static DtPutSelfCallbackInfo thePrePutSelfCallback
 
static const DtVariableBindingsList theEmptyVariableBindingsList
 
static bool theCreatorFcnSet
 
static DtReaderWriterFactorytheFactory
 
static
DtReaderWriterFactoryCreatorFcn 
theFactoryCreatorFcn
 
static bool thePutIndent
 
static DtOutputStream * theOutputStream
 

Constructor & Destructor Documentation

DtSurfaceEntitySimpleActuator::DtSurfaceEntitySimpleActuator ( const DtString name,
DtLocalObject owner,
DtSimulationServices simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

Parameters
nameReader writer name of this component.
ownerThe DtLocalObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object). Constructor
virtual DtSurfaceEntitySimpleActuator::~DtSurfaceEntitySimpleActuator ( )
virtual

Destructor.
Removes myProcessState from the process state repository manager. Deletes all ports and port groups.

DtSurfaceEntitySimpleActuator::DtSurfaceEntitySimpleActuator ( )
protected

default constructor; not implemented

DtSurfaceEntitySimpleActuator::DtSurfaceEntitySimpleActuator ( const DtSurfaceEntitySimpleActuator orig)
protected

copy constructor; not implemented

Member Function Documentation

virtual bool DtSurfaceEntitySimpleActuator::init ( )
virtual

Calls down to the base class, null checks entity(), calls createPSR(), and then caches the entity's state repository in mySurfaceEntityState.

Reimplemented from DtActuatorComponent.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual const char* DtSurfaceEntitySimpleActuator::type ( ) const
virtual

Returns a string identifies the class type of component. Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key. Warning: this function should always return the same pointer and it should be valid forever. This means the data should be static.

Returns
DtSurfaceEntitySimpleActuatorType

Implements DtSimComponent.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual bool DtSurfaceEntitySimpleActuator::postAddComponentsInit ( )
virtual

to initialize the PSR after the components have been created and initialized

Reimplemented from DtSimComponent.

virtual void DtSurfaceEntitySimpleActuator::initProcessSR ( )
virtual

the maxYawRate, maxYawAcceleration, and stoppingSpeed in myProcessState from the DtSurfaceEntitySimpleActuatorDescriptor

virtual void DtSurfaceEntitySimpleActuator::tick ( )
virtual

Calculates new kinematic state.

The tick method carries out the following steps:

  1. The tick() function checks whether dT (the time elapsed since the last tick call) is 0.0. If it is, tick() returns.
  2. The soil type at the current location is checked. If it is not not a water surface, all movement is zeroed out, updateRepository() is called and the tick returns. If there isn't a terrain intersection at the current location (water or otherwise), the ship is allowed to sail on at altitude 0.
  3. In order to store the values that have been calculated during the tick in the entity's state repository, updateRepository() is called.
  4. The actuator calls dataReceived(). This is done as a convenience for future subclasses – this actuator does not examine the newData flag.

Reimplemented from DtSimComponent.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual void DtSurfaceEntitySimpleActuator::decrementFuelResource ( double  fuelUsed)
virtual

Looks up the value of the resource named 'fuel' in the entity's resource manager and deducts the given amount. If the resource is not found, this function just returns. If the resource is found, the amount of fuel passed as the argument to the function is deducted from the resource. When the resource reaches 0, a warning is printed to the object console.
Uses PSR.setHasFuel() to set a flag in the PSR so that the actuator and controllers don't all have to look up fuel resources available.

static DtSimComponent* DtSurfaceEntitySimpleActuator::creator ( const DtString name,
DtLocalObject owner,
DtSimulationServices simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)
static

Parameters
nameReader writer name of this component.
ownerThe DtLocalObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
Returns
New instance of this class.
virtual bool DtSurfaceEntitySimpleActuator::createPortGroups ( )
protectedvirtual

Creates the mySurfaceControlPortGroup input port group and adds it to the component.

Reimplemented from DtSimComponent.

virtual bool DtSurfaceEntitySimpleActuator::createPorts ( )
protectedvirtual

Creates myAccelerationPort, myClampSpeedPort, myTurnRadiusPort, and myFinalHeadingPort and adds them to mySurfaceControlPortGroup.

Reimplemented from DtSimComponent.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual void DtSurfaceEntitySimpleActuator::updateHeading ( const double  dT,
double newHeading 
)
protectedvirtual
virtual void DtSurfaceEntitySimpleActuator::updateVelocity ( const double  dT,
const double  newHeading,
const double  newVerticalSpeed,
double acceleratingDT,
double newSpeed,
DtVector newVelocity,
bool maxSpeedAchieved 
)
protectedvirtual

Update the state of velocity. Use the values for [forward] acceleration and clamp [forward] speed that have been in effect over the last tick and are saved in the PSR. For speed in the vertical direction, uses the input newVerticalSpeed. Computes new forward speed and the new velocity, using the input heading to rotate the forward speed to the correct [topo] direction. Returns a value for acceleratingDT, which can be a time, shorter than dT, during which the entity accelerates to the clamp speed; the remainder of dT, the entity is assumed to be moving at a constant newSpeed.

Note that for sinking ships, velocity is re-set in the update-rates section of the tick function.

virtual double DtSurfaceEntitySimpleActuator::updateVerticalSpeed ( const double  dT)
protectedvirtual

Update the vertical speed. This is primarily for derived subsurface entities; for the surface entities, vertical speed is always 0 unless it is sinking. Called in updateVelocity.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual void DtSurfaceEntitySimpleActuator::updateOrientationAndPosition ( const double  dT,
const double  acceleratingDT,
const double  newHeading,
DtVector newVelocity,
const double  newSpeed,
DtDcm &  newBodyToLocalMatrix,
DtVector newPosition 
)
protectedvirtual

Update the state of position from the velocity and acceleration in effect over the last tick (i.e., in the current vrfKinematicState). Uses the acceleration for a time acceleratingDt, and if that is less than dT, uses a constant speed for the remainder of the dT. This process moves the position correctly when the speed gets clamped part way through the tick. Also updates the orientation. If the entity is sinking, this is done by calling sinkingAttitude. Otherwise, the attitude is adjusted with adjustAttitude, and then in setAltitude the altitude of the position is clamped to the water surface altitude, plus any modification from adjustAttitude.

Returns, in the last 2 arguments, the new values of orientation in terms of a Directed Cosine Matrix for the transformation from body to local coordinates and the new position. The vectors are all in "local" coordinates, e.g. those used in the vrfKinematicState for localPosition and relativeVelocity.

virtual void DtSurfaceEntitySimpleActuator::adjustAttitude ( const double  newSpeed,
const DtVector position,
const double  yawRate,
double roll,
double pitch,
double altitudeAdj 
)
protectedvirtual

Adjusts the attitude of the entity for improved appearance. Makes the entity roll in turns, according to the turnRollRate parameter. Makes the entity pitch up at speed, according to the speedPitchRate parameter. Also provides an altitude adjustment parameter so the pitch-up raises the entity up instead of allowing the stern to sink.

Reimplemented in DtSubSurfaceEntitySimpleActuator.

virtual void DtSurfaceEntitySimpleActuator::setAltitude ( DtVector localPosition,
const Coordinate_System cs,
const double  altitudeAdjustment 
)
protectedvirtual

Sets the altitude of the entity. The position input/output parameter is in local database coordinates. The altitudeAdjustment is the difference from local water surface altitude. This function converts the position to geodetic coordinates, looks up the altitude of the water surface at the position lat-lon, adds the altitudeAdjustment, then converts back to local coordinates. Note that altitude can be negative to set the position below the surface.

virtual bool DtSurfaceEntitySimpleActuator::getTerrainSurfaces ( const DtVector databaseLocation,
double groundHeight,
DtSurface groundSurface,
DtVector groundNormal,
double waterHeight,
DtSurface::DtMedium topSurfaceMedium,
bool dataAvailable = 0,
bool  overrideBlockingAssert = false 
)
protectedvirtual

Gets the characteristics of the terrain surface and sea floor. By default this just calls physicalWorld()-> terrainHeightUnderWater, but special vehicle types or terrain conditions could necessitate making different calls.
See the documentation for the terrain function for an explanation of the arguments.

virtual bool DtSurfaceEntitySimpleActuator::isShipAground ( const DtVector localPosition,
const DtDcm &  bodyToLocalMatrix,
DtSurface::DtMedium  topMedium = DtSurface::WaterSurface 
)
protectedvirtual

This function determines if the ship is aground at the given location and the given orientation. It checks first to see if the top surface medium is not water. Then it checks to see if the altitude of the ship puts the bottom of the bounding box at the altitude of the sea floor (mySeaFloorHeight). Orientation is provided for future enhancement to look at different parts of the bounding box.

virtual void DtSurfaceEntitySimpleActuator::sinkingAttitude ( const DtVector newPosition,
DtDcm &  newBodyToLocalMatrix 
)
protectedvirtual

This function sets the attitude for sinking ships. It is used in place of adjustAttitude when the ship is destroyed.

virtual void DtSurfaceEntitySimpleActuator::setOrientationToBottom ( const DtVector newPosition,
const double  newHeading,
const DtVector groundNormal,
DtDcm &  newBodyToLocalMatrix 
)
protectedvirtual

This function sets the orientation of the entity to that of the underwater polygon underneath newPosition, and given the newHeading. The function is used when the ship is destroyed and aground (i.e., it has sunk to the bottom).

virtual void DtSurfaceEntitySimpleActuator::computeNewRates ( const double  turnRate,
const double  newSpeed,
const double  newHeading,
const double  acceleration,
const DtDcm &  bodyToLocalMatrix,
DtVector bodyRotationRates,
DtVector relativeAcceleration,
double limitedAcceleration 
)
protectedvirtual

Computes the new values for acceleration (relative to the database) and rotation rate (body) based on the control port inputs. The values on these ports are checked and clamped to reasonable values; for example turn rate is limited to values that produce reasonable lateral accelerations–0.1 to 0.4 for warship-sized vessels. Input arguments also include the updated speed, and the updated body-to-local orientation transformation matrix. Speed is signed, so is negative if the vessel is going backwards. Returns the rotation rates, the acceleration vector, and the limited acceleration (a scalar, in direction of body X) in the last 3 arguments.

virtual void DtSurfaceEntitySimpleActuator::sinkingRates ( DtVector newPosition,
DtVector newVelocity,
DtVector newRelativeAcceleration,
DtVector newBodyRotationRates 
)
protectedvirtual

The function that is used to compute body rotation rates and acceleration for the next tick, when the entity is sinking. Also sets clamp speed, clamp heading, and forward acceleration in the PSR.

virtual void DtSurfaceEntitySimpleActuator::unpoweredDriftRates ( const double  newSpeed,
const double  newHeading,
DtVector newBodyRotationRates,
DtVector newRelativeAcceleration 
)
protectedvirtual

Computes body rotation rates and new acceleration vector for an entity that is drifting. It will use a lower deceleration in general than a ship that is powered and can reverse thrust. Also sets clamp speed, clamp heading, and forward acceleration in the PSR.

double DtSurfaceEntitySimpleActuator::driftDecelerationMagnitude ( ) const
protected

Computes the magnitude of the deceleration of a drifting ship. This quantity is estimated from the forward speed and the mass of the ship, and limited to a maximum value.

virtual void DtSurfaceEntitySimpleActuator::updateRepository ( const DtVector newPosition,
const DtVector newVelocity,
const DtVector newAcceleration,
const DtTaitBryan &  newOrientation,
const DtVector newBodyRotationRates 
)
protectedvirtual

Copy newly calculated state data in the arguments into the object's state repository (LocalPosition, RelativeVelocity, RelativeAcceleration, LocalOrientationWrtDatabase, and RotationalVelocity. The Orientation is computed from the DCM matrix using DtBodyToRef_to_Euler()).

virtual double DtSurfaceEntitySimpleActuator::computeFuelUsed ( const double  dT)
protectedvirtual

Computes the amount of fuel used based on the speed, dT, and the fuel efficiency given in the surface entity state repository.

DtSurfaceEntityStateRepository* DtSurfaceEntitySimpleActuator::surfaceEntityState ( void  ) const
protected
virtual bool DtSurfaceEntitySimpleActuator::createPSR ( )
protectedvirtual

Creates myProcessState data member, and adds it to our process state repository manager. Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.

const DtSurfaceEntitySimpleActuator& DtSurfaceEntitySimpleActuator::operator= ( const DtSurfaceEntitySimpleActuator orig)
protected

assignment operator; not implemented

Member Data Documentation

DtSurfaceEntityStateRepository* DtSurfaceEntitySimpleActuator::mySurfaceEntityState
protected

Cache some pointers.

const DtSurfaceEntityParameters* DtSurfaceEntitySimpleActuator::myParameters
protected
DtSurfaceEntityActuatorDescriptor* DtSurfaceEntitySimpleActuator::myDescriptor
protected
DtInputPortGroup* DtSurfaceEntitySimpleActuator::mySurfaceControlPortGroup
protected

Input Port Group Name: surface-control
Input Port Group Description:

DtAnalogInputPort* DtSurfaceEntitySimpleActuator::myAccelerationPort
protected

Acceleration can be positive or negative. Acceleration in either direction is assumed to be effected by the propellers, i.e. active thrust vs. friction braking. This simple actuator assumes that acceleration can be changed to any value in one tick.

DtAnalogInputPort* DtSurfaceEntitySimpleActuator::myClampSpeedPort
protected

Clamp speed is the speed that the controller is trying to accelerate (or decelerate) to; if dT is unexpectedly large, the actuator will accelerate only to this speed, then keep speed constant for the rest of the tick.

DtAnalogInputPort* DtSurfaceEntitySimpleActuator::myTurnRatePort
protected

Turn rate in radians/sec, with positive meaning a turn to the right. Note that if speed < 0, a positive turn rate swings the stern to the left. This simple actuator assumes that turn rate can be changed to any value in one tick.

DtAnalogInputPort* DtSurfaceEntitySimpleActuator::myFinalHeadingPort
protected

Final heading that the entity is clamped to, if dT is too large.

DtUpdateRepositoryOutputPortGroup* DtSurfaceEntitySimpleActuator::myUpdateRepositoryOutputPortGroup
protected

Port group used to set what values should be set into the VRF state repository. All values are in local coordinates.

DtSurfaceMovementPSR* DtSurfaceEntitySimpleActuator::myProcessState
protected

Container for state data associated with this component. This state is saved and restored as part of a scenario (or checkpoint).

bool DtSurfaceEntitySimpleActuator::myOutOfFuelWarningPrinted
protected

Remembers if the warning has been printed, so it's only printed once.

double DtSurfaceEntitySimpleActuator::myMaxRollRate
protected

Remember a reasonable value for maximum roll rate for this entity, based on mass. Computed at init time.

double DtSurfaceEntitySimpleActuator::mySeaFloorHeight
protected

Computed at the beginning of every tick; remembered for use in the tick:

double DtSurfaceEntitySimpleActuator::myWaterHeight
protected

Computed at the beginning of every tick; remembered for use in the tick:

bool DtSurfaceEntitySimpleActuator::myIsAground
protected

Computed at the beginning of every tick; remembered for use in the tick:

bool DtSurfaceEntitySimpleActuator::myAgroundAndDestroyed
protected

Remembered after this state is first entered, to avoid recomputation in future ticks. The entity never leaves this state.

double DtSurfaceEntitySimpleActuator::mySinkingPitchRate
protected

Parameters that define how this ship will sink. Determined randomly at init time.

double DtSurfaceEntitySimpleActuator::mySinkingRollRate
protected

Parameters that define how this ship will sink. Determined randomly at init time.

double DtSurfaceEntitySimpleActuator::mySinkingStartRate
protected

Parameters that define how this ship will sink. Determined randomly at init time.

DtPlatformLocalObjectFacade DtSurfaceEntitySimpleActuator::myPlatformLocalObjectFacade
protected

Member to allow for access to platform specific data


The documentation for this class was generated from the following file:

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)