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