LRAUV  revA
ZigZag.h
Go to the documentation of this file.
1 
12 #ifndef ZIGZAG_H_
13 #define ZIGZAG_H_
14 
15 #include "component/Behavior.h"
16 #include "data/Location.h"
17 
19 
35 class ZigZag : public Behavior
36 {
37 public:
38 
39  ZigZag( const Str& prefix, const Module* module );
40 
41  virtual ~ZigZag();
42 
44  void initialize( void );
45 
47  bool isSatisfied();
48 
50  bool runIfUnsatisfied();
51 
53  void run();
54 
56  void uninitialize( void );
57 
59  static Behavior* CreateBehavior( const Str& prefix, const Module* module );
60 
61 protected:
62 
65 
68 
70  double headingRead_;
71 
73  double headingCmd_;
74 
77 
79 
80  // True when we turn
81  bool satisfied_;
82 
83  // True once we run once
84  bool ranOnce_;
85 
86  // Slate input setting variables
87 
88  // Desired bearing
90 
91  // Desired angle
93 
94  // Slate input measurements
95 
96  // Gets the horizontal mode for HorizontalControl
98 
99  // Gets the heading for HorizontalControl
101 
102  // Gets the bearing for HorizontalControl
104 
105  // Slate output variables
106 
107  // Sets the horizontal mode for HorizontalControl
109 
110  // Sets the heading for HorizontalControl
112 
113  // Carries out behavior on parameters
114  void writeCmds();
115 
116  // Determines if behavior is satisfied
117  bool calcSatisfied();
118 
119  // Reads in behavior settings
120  void readSettings( bool force );
121 
122  // Reads in parameters used by writeCmds and calcSatisfied
123  bool calculate();
124 
125  // Sets value of going right
126  // Returns true if changed, and ranOnce_ is true
127  void setGoingRight( bool goingRight );
128 
129 private:
130  // Note that the copy constructor below is private and not given a body.
131  // Any attempt to call it will return a compiler error.
132  ZigZag( const ZigZag& old ); // disallow copy constructor
133 
134 
135 };
136 
137 #endif /*ZIGZAG_H_*/
bool calcSatisfied()
Definition: ZigZag.cpp:180
ZigZag(const Str &prefix, const Module *module)
Definition: ZigZag.cpp:20
SettingReader * angleSettingReader_
Definition: ZigZag.h:92
void writeCmds()
Definition: ZigZag.cpp:187
bool isSatisfied()
Returns true when vehicle is starting to turn.
Definition: ZigZag.cpp:81
void readSettings(bool force)
Definition: ZigZag.cpp:107
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: UniversalDataReader.h:26
bool runIfUnsatisfied()
runs only if unsatisfied
Definition: ZigZag.cpp:94
DataReader * bearingCmdReader_
Definition: ZigZag.h:103
bool initialized_
Indicates initialization success.
Definition: ZigZag.h:76
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
bool ranOnce_
Definition: ZigZag.h:84
Behavior is the abstract base class for components that implement mission behaviors and commands...
Definition: Behavior.h:32
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: DataWriter.h:27
void run()
The actual "payload" of the component.
Definition: ZigZag.cpp:86
Contains the Behavior class definition.
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
DataWriter * horizontalModeWriter_
Definition: ZigZag.h:108
double headingCmd_
Next Heading Cmd.
Definition: ZigZag.h:73
bool calculate()
Definition: ZigZag.cpp:120
Replacement for standard template class string.
Definition: Str.h:12
DataReader * horizontalModeReader_
Definition: ZigZag.h:97
float bearingSetting_
Desired Bearing.
Definition: ZigZag.h:64
void uninitialize(void)
Uninit function.
Definition: ZigZag.cpp:194
virtual ~ZigZag()
Definition: ZigZag.cpp:48
Reads values from mission settings.
Definition: SettingReader.h:26
DataReader * headingCmdReader_
Definition: ZigZag.h:100
Contains the ZigZag Behavior/Command.
Definition: ZigZag.h:35
void initialize(void)
Initialize function.
Definition: ZigZag.cpp:52
static Behavior * CreateBehavior(const Str &prefix, const Module *module)
Mission Component factory interface.
Definition: ZigZag.cpp:201
double headingRead_
Current Heading.
Definition: ZigZag.h:70
bool goingRight_
Definition: ZigZag.h:78
void setGoingRight(bool goingRight)
Definition: ZigZag.cpp:174
DataWriter * headingCmdWriter_
Definition: ZigZag.h:111
bool satisfied_
Definition: ZigZag.h:81
Contains the Location class definition.
SettingReader * bearingSettingReader_
Definition: ZigZag.h:89
float angleSetting_
Desired Angle.
Definition: ZigZag.h:67