LRAUV  revA
YoYo.h
Go to the documentation of this file.
1 
12 #ifndef YOYO_H_
13 #define YOYO_H_
14 
15 #include "component/Behavior.h"
17 #include "data/Location.h"
18 
20 
34 class YoYo : public Behavior
35 {
36 public:
37 
38  YoYo( const Str& prefix, const Module* module );
39 
40  virtual ~YoYo();
41 
43  void initialize( void );
44 
46  bool isSatisfied();
47 
49  bool runIfUnsatisfied();
50 
52  void run();
53 
55  void uninitialize( void );
56 
58  static Behavior* CreateBehavior( const Str& prefix, const Module* module );
59 
60 protected:
61 
62  // Configuration readers
66 
67  // Current control commands
68 
71 
74 
77 
80 
81  // Behavior settings
82 
87 
88  // Behavior depth rate setting
92 
94 
97 
100 
103 
104  // Vertical Control settings
105 
108 
111 
114 
117 
120 
123 
126 
129 
132 
135 
137  float speedCmd_;
138 
141 
144 
145  // True when we inflect
147 
148  // True once we run once
149  bool ranOnce_;
150 
151  // Depth of start of yo
152  float startDepth_;
153 
156 
158  float pitchCmd_;
159 
162 
163  // Carries out behavior on parameters
164  void writeCmds();
165 
166  // Determines if behavior is satisfied
167  bool calcSatisfied();
168 
169  // Reads in configuration
170  void readConfig();
171 
172  // Reads in behavior settings
173  void readSettings();
174 
175  // Reads in parameters used by writeCmds and calcSatisfied
176  bool calculate();
177 
178  // If depthRate is nan, set to appropriate max dive rate.
179  float adjustDepthRate( float depthRate, bool goDown );
180 
181  // Sets value of going down
182  // Sets satified true if changed, and ranOnce_ is true
183  void setGoingDown( bool goingDown );
184 
185 private:
186  // Note that the copy constructor below is private and not given a body.
187  // Any attempt to call it will return a compiler error.
188  YoYo( const YoYo& old ); // disallow copy constructor
189 
190 };
191 
192 #endif /*YOYO_H_*/
bool calcSatisfied()
Definition: YoYo.cpp:352
Contains the YoYo Behavior.
Definition: YoYo.h:34
SettingReader * depthRateSettingReader_
Definition: YoYo.h:89
DataReader * pitchCmdReader_
Current vertical control pitch command.
Definition: YoYo.h:76
float satisfiedThresholdSetting_
Minimum depth change required to enable sequence behavior to be satisfied.
Definition: YoYo.h:128
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: UniversalDataReader.h:26
SettingReader * downPitchSettingReader_
Definition: YoYo.h:85
SettingReader * upDepthRateSettingReader_
Definition: YoYo.h:91
SettingReader * upPitchSettingReader_
Definition: YoYo.h:86
bool calculate()
Definition: YoYo.cpp:199
VerticalControlIF::VerticalMode verticalMode_
Command to set verticalMode.
Definition: YoYo.h:155
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
DataReader * depthRateCmdReader_
Current vertical control depth rate command.
Definition: YoYo.h:73
bool ranOnce_
Definition: YoYo.h:149
VerticalMode
Defines vertical modes.
Definition: VerticalControlIF.h:121
Specifies the interface details for the VerticalControl component in the ControlModule.
void run()
The actual "payload" of the component.
Definition: YoYo.cpp:121
bool satisfied_
Definition: YoYo.h:146
bool initialized_
Indicates initialization success.
Definition: YoYo.h:140
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
float downPitchSetting_
Desired "down" pitch of the vehicle.
Definition: YoYo.h:116
UniversalDataReader * pitchReader_
Current pitch.
Definition: YoYo.h:102
float maxDiveRate_
Maximum dive rate of the vehicle.
Definition: YoYo.h:131
bool isSatisfied()
Returns true when vehicle is starting to inflect.
Definition: YoYo.cpp:116
YoYo(const Str &prefix, const Module *module)
Definition: YoYo.cpp:18
ConfigReader * maxDiveRateCfgReader_
Definition: YoYo.h:64
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: DataWriter.h:27
float upPitchSetting_
Desired "up" pitch of the vehicle.
Definition: YoYo.h:119
SettingReader * pitchSettingReader_
Behavior pitch setting.
Definition: YoYo.h:84
void writeCmds()
Definition: YoYo.cpp:357
void readSettings()
Definition: YoYo.cpp:150
float depthRateCmd_
Command to set depth rate.
Definition: YoYo.h:161
DataReader * speedCmdReader_
Current speed control speed command.
Definition: YoYo.h:79
Contains the Behavior class definition.
void initialize(void)
Initialize function.
Definition: YoYo.cpp:90
void setGoingDown(bool goingDown)
Definition: YoYo.cpp:338
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
void uninitialize(void)
Uninit function.
Definition: YoYo.cpp:376
UniversalDataReader * depthRateReader_
Current depth rate.
Definition: YoYo.h:99
Replacement for standard template class string.
Definition: Str.h:12
float pitchCmd_
Command to set pitch.
Definition: YoYo.h:158
SettingReader * downDepthRateSettingReader_
Definition: YoYo.h:90
Definition: ConfigReader.h:13
SettingReader * satisfiedThresholdSettingReader_
Definition: YoYo.h:93
bool goingDown_
True if going down.
Definition: YoYo.h:143
float upDepthRateSetting_
Desired "up" depth rate of the vehicle.
Definition: YoYo.h:125
Reads values from mission settings.
Definition: SettingReader.h:26
float speedCmd_
Current speed cmd.
Definition: YoYo.h:137
float adjustDepthRate(float depthRate, bool goDown)
Definition: YoYo.cpp:325
bool runIfUnsatisfied()
runs only if unsatisfied
Definition: YoYo.cpp:129
static Behavior * CreateBehavior(const Str &prefix, const Module *module)
Mission Component factory interface.
Definition: YoYo.cpp:386
UniversalDataReader * depthReader_
Current depth.
Definition: YoYo.h:96
DataWriter * depthRateCmdWriter_
Sets the depth rate for VerticalControl.
Definition: YoYo.h:110
DataWriter * verticalModeWriter_
Sets the vertical mode for VerticalControl.
Definition: YoYo.h:107
ConfigReader * maxBuoyDiveRateCfgReader_
Definition: YoYo.h:65
DataWriter * pitchCmdWriter_
Sets the pitch for VerticalControl.
Definition: YoYo.h:113
Contains the Location class definition.
void readConfig()
Definition: YoYo.cpp:142
DataReader * verticalModeReader_
Current vertical control depth mode.
Definition: YoYo.h:70
float startDepth_
Definition: YoYo.h:152
float downDepthRateSetting_
Desired "down" depth rate of the vehicle.
Definition: YoYo.h:122
virtual ~YoYo()
Definition: YoYo.cpp:86
ConfigReader * pitchLimitCfgReader_
Definition: YoYo.h:63
float maxBuoyDiveRate_
Maximum dive rate of the vehicle under only buoyancy control.
Definition: YoYo.h:134