|
LRAUV
revA
|
Contains the DepthServo Behavior/Command Uses depth, or the specified surrogate for depth to control the depth of the vehicle such that the vehicle stays at a constant depth, or other variable (if specified). More...
#include <DepthServo.h>


Public Member Functions | |
| DepthServo (const Str &prefix, const Module *module) | |
| virtual | ~DepthServo () |
| void | initialize (void) |
| Initialize function. More... | |
| bool | readConfig () |
| Read in relevant configuration values. More... | |
| bool | readSettings (float &measuredValue) |
| Read in settings. More... | |
| bool | readParams () |
| Read in the parameters for satisfied or runIfUnsatisfied: return true if OK. More... | |
| bool | calcSatisfied (const float measuredValue) |
| Perform the satisfied: return true if envelope "satisfied". More... | |
| void | run () |
| Just do the run: ignore the results of the satisfied. More... | |
| bool | isSatisfied () |
| Just do the satisfied: return true if envelope "satisfied". More... | |
| bool | runIfUnsatisfied () |
| Do the run, and return true if envelope "satisfied". More... | |
| void | uninitialize (void) |
| Uninit function. More... | |
Public Member Functions inherited from Behavior | |
| virtual | ~Behavior () |
| bool | executeIfUnsatisfied () |
| Combined run and test with metrics generation. More... | |
| virtual void | preempted () |
| virtual bool | isRunnable () |
| virtual bool | isSatisfiable () |
| virtual bool | isCommand () |
| BehaviorState | getBehaviorState () const |
| void | setBehaviorState (BehaviorState behaviorState) |
| virtual bool | isCompleted (void) |
| Query if this component is completed. More... | |
| SettingReader * | findSettingReader (const Str &settingURI) |
| SettingReader * | addValueClause (const Str &uriPart, ValueClause *valueClause) |
| void | addArgWriter (const Str &uriPart, DataWriter *argWriter) |
| const Timespan & | getTimeout () |
| void | setTimeout (const Timespan &timeout) |
Public Member Functions inherited from Component | |
| virtual | ~Component () |
| Destructor cleans up readers_ and writers_. More... | |
| void | registerReader (DataReader *reader) |
| void | unregisterReader (DataReader *reader) |
| void | registerWriter (DataWriter *writer) |
| void | unregisterWriter (DataWriter *writer) |
| void | disableMetering (void) |
| FlexArray< DataReader * > & | getReaderList (void) |
| FlexArray< DataWriter * > & | getWriterList (void) |
| const Module * | getModule () |
| virtual void | configure () |
| Read (or re-read!) configuration settings. More... | |
| virtual void | execute (void) |
| bool | isActive () const |
| Indicates if the component is active. More... | |
| const CodedStr & | getName (void) const |
| Returns the name. More... | |
| const Timestamp & | getTimeOfLastRun (void) const |
| ComponentState | getState (void) |
| Return the component's current state. More... | |
| void | setState (ComponentState state) |
| RunState | getRunState (void) |
| Return the component's run state. More... | |
| bool | isUsingRunState () |
| Return true if using runState. More... | |
| void | requestData (bool requestingData) |
| Tell the component to start (or stop) sending data. More... | |
| void | requestStart () |
| Tell the component to start runnning. More... | |
| void | requestPause (const Timespan expectedPauseTime) |
| Tell the component to pause runnning. More... | |
| void | requestResume () |
| Tell the component resume from pause. More... | |
| void | requestStop () |
| Tell the component to stop runnning. More... | |
| virtual RunState | start () |
| Do what needs to be done to run Similar to initialize, in old init/run/uninit sequence. More... | |
| virtual RunState | starting () |
| Might follow a STOP...START sequence Subseqent. More... | |
| virtual RunState | runnable () |
| Should eventually follow a START request or RESETTING. More... | |
| virtual RunState | satisfied () |
| Possible return value of a Behavior. More... | |
| virtual RunState | pause () |
| Pause for a short period (indicated by pauseTime) More... | |
| virtual RunState | pausing () |
| Might follow a PAUSE request. More... | |
| virtual RunState | paused () |
| Should eventually follow a PAUSE request: should set continueTime. More... | |
| virtual RunState | resume () |
| Resume from PAUSE. More... | |
| virtual RunState | resuming () |
| Might follow a PAUSE...RESUME sequence. More... | |
| virtual RunState | resetting () |
| Might occur in case of Error. More... | |
| virtual RunState | stop () |
| Initial state – can be later followed by START. More... | |
| virtual RunState | stopping () |
| Might follow a STOP request. More... | |
| virtual RunState | stopped () |
| Should eventually follow a STOP request. More... | |
| void | setCriticalFailureReported (bool boolVal) |
| void | setRecoveringFromCritical (bool boolVal) |
| void | setFailureReported (bool boolVal) |
| bool | isFailureUninitialized () |
| void | setFailureUninitialized (bool boolVal) |
| void | setRetryTimeout (const Timespan &timeout) |
| void | setPeriod (const Timespan &period) |
| Set the period of this component... used if it is periodic. More... | |
| const Timespan & | getPeriod (void) |
| Returns the component's period (regardless of whether it is periodic) More... | |
| ComponentType | getComponentType () |
| Getter function for ComponentType. More... | |
| virtual bool | isFailed (void) const |
| virtual FailureMode::FailType | getFailureType (void) const |
| virtual bool | getCriticalFailureReported (void) const |
| virtual bool | getFailureReported (void) const |
| virtual Timespan | getRetryTimeout (void) const |
| virtual FailureMode::FailType | setFailure (FailureMode::FailType failureType) |
| virtual int | getFailCount (void) const |
| virtual bool | isFailureMissionCritical () |
| virtual int | getAllowableFailures (void) const |
| virtual void | setAllowableFailures (int fails) |
| Logger & | getLogger (void) |
| virtual int | incrementFailCount (void) |
| virtual void | resetFailCount (void) |
| virtual int | getSkippedRunsSinceFail (void) const |
| virtual int | incrementSkippedRunsSinceFail (void) |
| virtual void | logVoltage (float voltage, float averageVoltage) |
| virtual void | logCurrent (float current, float averageCurrent) |
| const Timestamp & | getWriteTimestamp (void) |
| void | setWriteTimestamp (const Timestamp &writeTimestamp) |
| BlobReader * | newBlobReader (const BlobURI &blobURI) |
| BlobReader * | newBlobReaderFromUniversal (const Str &componentName, const UniversalBlobURI &blobURI) |
| BlobWriter * | newBlobWriter (const BlobURI &blobURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| ConfigReader * | newConfigReader (const ConfigURI &configURI) |
| DataReader * | newDataReader (const DataURI &dataURI) |
| DataReader * | newDataReaderFromUniversal (const Str &componentName, const UniversalURI &universalURI) |
| DataWriter * | newDataWriter (const DataURI &dataURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalBlobReader * | newUniversalBlobReader (const UniversalBlobURI &universalURI) |
| UniversalBlobWriter * | newUniversalBlobWriter (const UniversalBlobURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalDataReader * | newUniversalReader (const UniversalURI &universalURI) |
| UniversalDataWriter * | newUniversalWriter (const UniversalURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
Static Public Member Functions | |
| static Behavior * | CreateBehavior (const Str &prefix, const Module *module) |
| Mission Component factory interface. More... | |
Protected Attributes | |
| SettingReader * | holdValueSettingReader_ |
| Desired depth of the vehicle, or surrogate for depth. More... | |
| SettingReader * | inputSettingReader_ |
| Input variable to control. More... | |
| SettingReader * | proportionalGainSettingReader_ |
| Specifies PID loop proportional gain – required if DepthSurrogate specified. More... | |
| SettingReader * | integralGainSettingReader_ |
| Specifies PID loop integral gain – required if DepthSurrogate specified. More... | |
| SettingReader * | derivativeGainSettingReader_ |
| Specifies PID loop derivative gain – required if DepthSurrogate specified. More... | |
| SettingReader * | changePerMeterSettingReader_ |
| Specifies approximate change per meter depth. More... | |
| ConfigReader * | abortDepthCfgReader_ |
| Configuration Readers. More... | |
| DataReader * | speedCmdReader_ |
| Speed being fed to speed Control. More... | |
| ConfigReader * | maxDiveRateCfgReader_ |
| From Vertical Control, get max dive rate. More... | |
| ConfigReader * | maxBuoyDiveRateCfgReader_ |
| From Vertical Control, get max dive rate under buoy control. More... | |
| ConfigReader * | maxDiveAccelCfgReader_ |
| From Vertical Control, get max dive accel. More... | |
| ConfigReader * | maxBuoyDiveAccelCfgReader_ |
| From Vertical Control, get max dive accel under buoy control. More... | |
| DataWriter * | verticalModeWriter_ |
| Sets the depth mode for dynamic control. More... | |
| DataWriter * | depthCmdWriter_ |
| Sets the depth specification for Vertical Control. More... | |
| float | holdValueSetting_ |
| Desired depth of the vehicle, or surrogate for depth. More... | |
| float | proportionalGainSetting_ |
| Specifies PID loop proportional gain. More... | |
| float | integralGainSetting_ |
| Specifies PID loop integral gain. More... | |
| float | derivativeGainSetting_ |
| Specifies PID loop derivative gain. More... | |
| float | changePerMeterSetting_ |
| Used in state estimation. More... | |
| float | holdValueIntegral_ |
| Actual integral of depth (or its surrogate) More... | |
| float | lastMeasuredValue_ |
| Used to determine rate of change in hold value. More... | |
| Trajectory | trajectory_ |
| Estimator for depth or its surrogate. More... | |
| float | maxDiveRate_ |
| Used in estimating maxChangeRate_. More... | |
| float | maxBuoyDiveRate_ |
| float | maxDiveAccel_ |
| float | maxBuoyDiveAccel_ |
| float | abortDepth_ |
| Stores the abort depth of the vehicle. More... | |
| float | speedCmd_ |
| Current speedCmd. More... | |
| bool | startBelowSetting_ |
| Indicates difference between setting and position at initialization. More... | |
Protected Attributes inherited from Behavior | |
| bool | runnable_ |
| bool | satisfiable_ |
| BehaviorState | behaviorState_ |
| Timespan | timeout_ |
| Time before this behavior must end – defaults no timeout. More... | |
| FastMap< const Str, SettingReader * > * | settingReaderMap_ |
| FastMap< const Str, DataWriter * > * | argWriterMap_ |
Protected Attributes inherited from Component | |
| Logger | logger_ |
| Syslog::Severity | debugLevel_ |
| ComponentState | state_ |
| Keep track of whether the component has "completed" or should be run again. More... | |
| Timespan | desiredPeriod_ |
| CodedStr & | name_ |
| Store the component's name (used for logging purposes) More... | |
| Timestamp | timeOfRun_ |
| Timestamp | timeOfLastRun_ |
| Timespan | durationOfLastRun_ |
| Timespan | dt_ |
| Timespan | retryTimeout_ |
| bool | enabled_ |
| bool | failureReported_ |
| Indicates if the failure has been reported – cuts down on syslog. More... | |
| bool | criticalFailureReported_ |
| Indicates if a "Critical" failure has been reported – cuts down on syslog. More... | |
| bool | recoveringFromCritical_ |
| Indicates that a component had a previous critical failure that has been cleared temporarily awaiting final word from the component itself. More... | |
| bool | failureUninitialized_ |
| Indicates if the failure has resulted in an uninitialize call. More... | |
| int | failCount_ |
| Number of failures logged by PCaller. More... | |
| bool | failureMissionCritical_ |
| If true (default), complete failure ends mission. More... | |
| int | allowableFailures_ |
| Number of failures allowed to occur. More... | |
| int | skippedRunsSinceFail_ |
| Number of skipped runs since failureMode_ set by failCount_. More... | |
| FailureMode::FailType | failureType_ |
| Failed status. If failCount_ > 0, then this may be reset. More... | |
| Timestamp | timeOfFailure_ |
| Time of last failure. Relevant only if failed=true. More... | |
| Timestamp | writeTimestamp_ |
| Time of last write. More... | |
| FlexArray< DataReader * > | readers_ |
| FlexArray< DataWriter * > | writers_ |
| const Module * | module_ |
| Timespan | pauseTime_ |
| bool | meteringEnabled_ |
| If true, metering is enabled. More... | |
| DataWriter * | durationOfLastRunWriter_ |
| Writer for durationOfLastRun. More... | |
| DataWriter * | voltageWriter_ |
| DataWriter * | avgVoltageWriter_ |
| DataWriter * | currentWriter_ |
| DataWriter * | avgCurrentWriter_ |
| bool | persistentPause_ |
| True if data is persistent while component is paused. More... | |
Private Member Functions | |
| DepthServo (const DepthServo &old) | |
Additional Inherited Members | |
Public Types inherited from Behavior | |
| enum | BehaviorState { BEHAVIOR_INACTIVE, BEHAVIOR_CALLED, BEHAVIOR_ACTIVE, BEHAVIOR_TIMEOUT, BEHAVIOR_COMPLETED } |
Public Types inherited from Component | |
| enum | ComponentState { BLOCK_CONTINUOUS, BLOCK_PERIODIC, BLOCK_NORMAL, BLOCK_COMPLETED, BLOCK_UNKNOWN } |
| In this model, the component has basically two states: wanting to run, and completed (no longer needing to run). More... | |
| enum | ComponentType { COMPONENT_ASYNC, COMPONENT_CONFIG, COMPONENT_BEHAVIOR, COMPONENT_SYNC } |
| Components can indicate how they want to be handled by their type. More... | |
| enum | RunState { NO_RUN_STATE = 0, START, STARTING, RUNNABLE, SATISFIED, PAUSE, PAUSING, PAUSED, RESUME, RESUMING, RESETTING, STOP, STOPPING, STOPPED } |
Protected Types inherited from Component | |
| enum | ConfigOption { CONFIG_SIMULATE_HARDWARE, CONFIG_POWER, CONFIG_FREQUENCY, CONFIG_LATENCY } |
Protected Member Functions inherited from Behavior | |
| Behavior (const Str &name, const Module *module, const bool runnable, const bool satisfiable) | |
| Protected constructor for abstract base class. More... | |
| Behavior (const Behavior &old) | |
| SettingReader * | newSettingReader (const Str &uriPart, const DataValue *defaultValue, bool deleteDefaultValue=true) |
| SettingReader * | newSettingReader (const SettingURI &uriPart) |
| DataWriter * | findArgWriter (const OutputURI &uriPart) |
Protected Member Functions inherited from Component | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption) const |
| Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc. More... | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption, ElementURI forElement) const |
| Should return [myNamespace]::POWER_[forElement], [myNamespace]::LATENCY_[forElement], etc. More... | |
| virtual void | setDurationOfLastRun (const Timespan &span) |
| virtual void | setTimeOfRun (const Timestamp &time) |
| virtual void | setTimeOfLastRun (const Timestamp &time) |
| virtual void | setDt (const Timespan &dt) |
| virtual bool | setEnabled (bool enabled=true) |
| void | setRunState (const RunState runState) |
| const Timespan | getPauseTime () const |
| virtual void | setFailureMissionCritical (bool failureMissionCritical) |
| bool | simulateHardware () |
Contains the DepthServo Behavior/Command Uses depth, or the specified surrogate for depth to control the depth of the vehicle such that the vehicle stays at a constant depth, or other variable (if specified).
If a variable other than depth (i.e., a surrogate) is specified, PID loop constants must also be supplied.
DepthServo.h should only be included by DepthServo.cpp Other classes should include DepthServoIF.h
References abortDepthCfgReader_, changePerMeterSettingReader_, depthCmdWriter_, derivativeGainSettingReader_, holdValueSettingReader_, inputSettingReader_, integralGainSettingReader_, Component::logger_, maxBuoyDiveAccelCfgReader_, maxBuoyDiveRateCfgReader_, maxDiveAccelCfgReader_, maxDiveRateCfgReader_, Component::newConfigReader(), Component::newDataReader(), Component::newDataWriter(), Behavior::newSettingReader(), proportionalGainSettingReader_, speedCmdReader_, Logger::syslog(), and verticalModeWriter_.
Referenced by CreateBehavior().
|
virtual |
|
private |
| bool DepthServo::calcSatisfied | ( | const float | measuredValue | ) |
Perform the satisfied: return true if envelope "satisfied".
References holdValueSetting_, and startBelowSetting_.
Referenced by isSatisfied(), and runIfUnsatisfied().
Mission Component factory interface.
References DepthServo().
Referenced by GuidanceModule::loadComponents().
|
virtual |
Initialize function.
Reimplemented from Component.
References changePerMeterSetting_, derivativeGainSetting_, holdValueIntegral_, holdValueSetting_, Syslog::INFO, integralGainSetting_, lastMeasuredValue_, Component::logger_, proportionalGainSetting_, readConfig(), readSettings(), startBelowSetting_, and Logger::syslog().
|
virtual |
Just do the satisfied: return true if envelope "satisfied".
Reimplemented from Behavior.
References calcSatisfied(), readConfig(), readParams(), and readSettings().
| bool DepthServo::readConfig | ( | void | ) |
Read in relevant configuration values.
References maxBuoyDiveAccel_, maxBuoyDiveAccelCfgReader_, maxBuoyDiveRate_, maxBuoyDiveRateCfgReader_, maxDiveAccel_, maxDiveAccelCfgReader_, maxDiveRate_, maxDiveRateCfgReader_, Units::NONE, and DataReader::read().
Referenced by initialize(), isSatisfied(), run(), and runIfUnsatisfied().
| bool DepthServo::readParams | ( | ) |
Read in the parameters for satisfied or runIfUnsatisfied: return true if OK.
References Units::METER_PER_SECOND, DataReader::read(), speedCmd_, speedCmdReader_, and DataReader::wasTouchedSinceLastRun().
Referenced by isSatisfied(), run(), and runIfUnsatisfied().
| bool DepthServo::readSettings | ( | float & | measuredValue | ) |
Read in settings.
References changePerMeterSetting_, changePerMeterSettingReader_, Syslog::CRITICAL, derivativeGainSetting_, derivativeGainSettingReader_, holdValueSetting_, holdValueSettingReader_, inputSettingReader_, integralGainSetting_, integralGainSettingReader_, Component::logger_, Units::NONE, proportionalGainSetting_, proportionalGainSettingReader_, SettingReader::read(), and Logger::syslog().
Referenced by initialize(), isSatisfied(), run(), and runIfUnsatisfied().
|
virtual |
Just do the run: ignore the results of the satisfied.
Reimplemented from Component.
References abortDepth_, abortDepthCfgReader_, Timespan::asDouble(), changePerMeterSetting_, VerticalControlIF::DEPTH, depthCmdWriter_, derivativeGainSetting_, dt, Component::dt_, Units::ENUM, holdValueIntegral_, holdValueSetting_, integralGainSetting_, lastMeasuredValue_, AuvMath::Limit(), maxBuoyDiveAccel_, maxBuoyDiveRate_, maxDiveAccel_, maxDiveRate_, Units::METER, AuvMath::NanZero(), Trajectory::project(), proportionalGainSetting_, Units::RADIAN, DataReader::read(), readConfig(), readParams(), readSettings(), speedCmd_, trajectory_, verticalModeWriter_, and DataWriter::write().
Referenced by runIfUnsatisfied().
|
virtual |
Do the run, and return true if envelope "satisfied".
Reimplemented from Behavior.
References calcSatisfied(), lastMeasuredValue_, readConfig(), readParams(), readSettings(), and run().
|
virtual |
|
protected |
Stores the abort depth of the vehicle.
Referenced by run().
|
protected |
Configuration Readers.
Depth at which we drop the weight. Should be greater than all depth envelopes
Referenced by DepthServo(), and run().
|
protected |
Used in state estimation.
Referenced by initialize(), readSettings(), and run().
|
protected |
Specifies approximate change per meter depth.
Referenced by DepthServo(), and readSettings().
|
protected |
Sets the depth specification for Vertical Control.
Referenced by DepthServo(), and run().
|
protected |
Specifies PID loop derivative gain.
Referenced by initialize(), readSettings(), and run().
|
protected |
Specifies PID loop derivative gain – required if DepthSurrogate specified.
Referenced by DepthServo(), and readSettings().
|
protected |
Actual integral of depth (or its surrogate)
Referenced by initialize(), and run().
|
protected |
Desired depth of the vehicle, or surrogate for depth.
Referenced by calcSatisfied(), initialize(), readSettings(), and run().
|
protected |
Desired depth of the vehicle, or surrogate for depth.
Referenced by DepthServo(), and readSettings().
|
protected |
Input variable to control.
Referenced by DepthServo(), and readSettings().
|
protected |
Specifies PID loop integral gain.
Referenced by initialize(), readSettings(), and run().
|
protected |
Specifies PID loop integral gain – required if DepthSurrogate specified.
Referenced by DepthServo(), and readSettings().
|
protected |
Used to determine rate of change in hold value.
Referenced by initialize(), run(), and runIfUnsatisfied().
|
protected |
Referenced by readConfig(), and run().
|
protected |
From Vertical Control, get max dive accel under buoy control.
Referenced by DepthServo(), and readConfig().
|
protected |
Referenced by readConfig(), and run().
|
protected |
From Vertical Control, get max dive rate under buoy control.
Referenced by DepthServo(), and readConfig().
|
protected |
Referenced by readConfig(), and run().
|
protected |
From Vertical Control, get max dive accel.
Referenced by DepthServo(), and readConfig().
|
protected |
Used in estimating maxChangeRate_.
Referenced by readConfig(), and run().
|
protected |
From Vertical Control, get max dive rate.
Referenced by DepthServo(), and readConfig().
|
protected |
Specifies PID loop proportional gain.
Referenced by initialize(), readSettings(), and run().
|
protected |
Specifies PID loop proportional gain – required if DepthSurrogate specified.
Referenced by DepthServo(), and readSettings().
|
protected |
Current speedCmd.
Referenced by readParams(), and run().
|
protected |
Speed being fed to speed Control.
Referenced by DepthServo(), and readParams().
|
protected |
Indicates difference between setting and position at initialization.
Referenced by calcSatisfied(), and initialize().
|
protected |
Estimator for depth or its surrogate.
Referenced by run().
|
protected |
Sets the depth mode for dynamic control.
Referenced by DepthServo(), and run().