LRAUV  revA
RudderServo.h
Go to the documentation of this file.
1 
12 #ifndef RUDDERSERVO_H_
13 #define RUDDERSERVO_H_
14 
15 #include "EZServoServo.h"
16 #include "io/LoadControl.h"
17 #include "io/UartStream.h"
18 
20 
32 class RudderServo : public EZServoServo
33 {
34 public:
35  RudderServo( const Module* module );
36  virtual ~RudderServo();
37 
38  virtual void run();
39 
42  virtual RunState start();
43 
45  virtual RunState starting();
46 
48  virtual RunState pause();
49 
51  virtual RunState paused();
52 
54  virtual RunState resume();
55 
57  virtual RunState resuming();
58 
60  virtual RunState runnable();
61 
63  virtual RunState resetting()
64  {
65  return stop();
66  }
67 
69  virtual RunState stop();
70 
71  virtual RunState stopping();
72 
74  virtual RunState stopped();
75 
76  // Shuts down motor controllers
77  void uninitialize( void );
78 
80  virtual ConfigURI getConfigURI( ConfigOption configOption ) const;
81 
82 private:
83 
84  // Note that the copy constructor below is private and not given a body.
85  // Any attempt to call it will return a compiler error.
86  RudderServo( const RudderServo& old ); // disallow copy constructor
87 
88  // Instance of load controller
90 
91  // The outputs themselves
93 
94  // The inputs
96 
97  // returns true if data is requested from one of the readers
98  bool isDataRequested();
99 
100  // returns true if a new position has been commanded
101  bool isNeeded();
102 
103  typedef enum
104  {
105  INITIALIZE, // Program basic initialization into EEPROM
106  WAIT, // Wait for EEPROM write to finish
107  HOME, // Do any centering/homing, etc if needed
108  EXECUTE, // Execute any stored programs
109  VERIFY, // Confirm operable and no errors
110  DONE, // Ready to run
111  } StartupSequence;
112 
114 
115  // indicates whether things are ok to run
116  bool ok_;
117 
118  // Actual and commanded rudder angles
121 
122  // Debugging outputs
123  bool debug_;
124 
125  //-----------------------------------------------------------------*/
126 
128 
129  //-----------------------------------------------------------------*/
130 
131  // Config readers
133 
134  // read vehicle config variables
135  bool readConfig( void );
136 
137  // the given motor controller is ready to receive commands
139 
140  // Initialization routines. Returns true if initialization completed without error
141  bool initRudder( void );
142 };
143 
144 #endif /*RUDDERSERVO_H_*/
ConfigReader * rudderDeadbandCfgReader_
Definition: RudderServo.h:132
Definition: RudderServo.h:107
virtual RunState resetting()
Might occur in case of Error.
Definition: RudderServo.h:63
DataReader * rudderAngleReader_
Definition: RudderServo.h:95
Definition: RudderServo.h:105
RudderServo(const Module *module)
Definition: RudderServo.cpp:22
virtual RunState stop()
Initial state – can be later followed by START.
Definition: RudderServo.cpp:424
Contains the LoadControl class declaration.
float cmdRudderAngle_
Definition: RudderServo.h:120
virtual RunState stopping()
Might follow a STOP request.
Definition: RudderServo.cpp:435
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: UniversalDataWriter.h:24
virtual void run()
The actual "payload" of the component.
Definition: RudderServo.cpp:91
RunState
Definition: Component.h:115
Contains the UartStream class declaration.
Contains the EZServoServo class declaration.
bool ok_
Definition: RudderServo.h:116
virtual RunState stopped()
Initial state – can be later followed by START.
Definition: RudderServo.cpp:454
virtual RunState resuming()
Might follow a PAUSE...RESUME sequence.
Definition: RudderServo.cpp:301
Definition: ElementURI.h:166
bool readConfig(void)
Definition: RudderServo.cpp:73
virtual RunState paused()
Should eventually follow a PAUSE request: should set continueTime.
Definition: RudderServo.cpp:268
Module is the abstract base class for a collection of Component objects that can be contained in a lo...
Definition: Module.h:45
bool isNeeded()
Definition: RudderServo.cpp:482
Definition: RudderServo.h:110
This class allows one to control loads on a load controller channel.
Definition: LoadControl.h:24
Definition: ConfigReader.h:13
StartupSequence
Definition: RudderServo.h:103
virtual ConfigURI getConfigURI(ConfigOption configOption) const
Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc.
Definition: RudderServo.cpp:115
bool initRudder(void)
Definition: RudderServo.cpp:130
virtual RunState resume()
Resume from PAUSE.
Definition: RudderServo.cpp:285
virtual ~RudderServo()
Definition: RudderServo.cpp:70
float actualRudderAngle_
Definition: RudderServo.h:119
This is the parent class for device drivers that interface with EZServos Since all EZServos shares th...
Definition: EZServoServo.h:23
virtual RunState pause()
Pause for a short period (indicated by pauseTime)
Definition: RudderServo.cpp:252
Definition: RudderServo.h:106
bool rudderRdy_
Definition: RudderServo.h:138
virtual RunState start()
Do what needs to be done to run Similar to initialize, in old init/run/uninit sequence.
Definition: RudderServo.cpp:156
LoadControl loadControl_
Definition: RudderServo.h:89
ConfigOption
Definition: Component.h:456
UniversalDataWriter * rudderAngleWriter_
Definition: RudderServo.h:92
StartupSequence startup_
Definition: RudderServo.h:113
float ruddDeadbandCfg_
Definition: RudderServo.h:127
virtual RunState starting()
Might follow a STOP...START sequence.
Definition: RudderServo.cpp:187
void uninitialize(void)
Provide a space for uninitialization.
Definition: RudderServo.cpp:96
This is the device driver for the EZServo that controls the vehicle's rudder.
Definition: RudderServo.h:32
bool debug_
Definition: RudderServo.h:123
Definition: RudderServo.h:109
Definition: RudderServo.h:108
virtual RunState runnable()
Should eventually follow a START request or RESETTING.
Definition: RudderServo.cpp:308
bool isDataRequested()
Definition: RudderServo.cpp:476