The VisAO Camera
ShutterControl.h
Go to the documentation of this file.
1 /************************************************************
2 * ShutterControl.h
3 *
4 * Author: Jared R. Males (jrmales@email.arizona.edu)
5 *
6 * Generic shutter controller. Used for simulations or as base class for real shutter.
7 *
8 * Developed as part of the Magellan Adaptive Optics system.
9 ************************************************************/
10 
11 /** \file ShutterControl.h
12  * \author Jared R. Males
13  * \brief Declarations for a generic shutter controller.
14  *
15  * Used for simulations or as base class for real shutter.
16  * To use as a simulator, define SIMSHUTTER prior to compile and include. Then time is incremented with
17  * each call to open_shutter() or close_shutter().
18  *
19 */
20 
21 #ifndef __ShutterControl_h__
22 #define __ShutterControl_h__
23 
24 #include <sys/time.h>
25 #include <iostream>
26 
28 {
29  public:
30  ShutterControl(); ///< Default constructor
31  ShutterControl(double dt, int st); ///< Constructor to set dead_time and sw_state
32 
33  protected:
34  double dead_time; ///<Time to wait between commanded changes in state
35 
36  int sw_state; ///<1 is open, -1 is shut, 0 is unknown
37  int hw_state; ///<1 is open, -1 is shut, 0 is unknown
38  bool ignore_hw_state; ///< For when hw_state is unavailable.
39 
40  double curr_t; ///<the current time
41  double last_t; ///<the time of the last commanded change in state
42 
43  timeval tp; ///<for use in getting system time
44 
45  #ifdef SIMSHUTTER
46  double delta_t; ///<In simulations, the time steps between calls to open and close shutter.
47  #endif
48 
49  int initialize_ShutterControl(); ///<Sets the basic parameters to default values
50 
51  public:
52  int set_last_t(double lt);
53 
54  int open_shutter(void *adata = 0);
55  int close_shutter(void *adata = 0);
56 
57  virtual int set_state(int st);
58 
59  virtual int get_state();
60  virtual int get_sw_state();
61  virtual int get_hw_state();
62 
63  double get_curr_t();
64 
65  //Virtual functions, to be overridden by derived classes specific to shutter and controller
66  virtual int start_ShutterControl();
67  virtual int shutdown_ShutterControl();
68 
69  #ifdef SIMSHUTTER
70  int set_delta_t(dt);
71  int get_delta_t();
72  #endif
73 
74  protected:
75  virtual int do_shutter_open(void *adata);
76  virtual int do_shutter_close(void *adata);
77 };
78 
79 
80 #endif //__ShutterControl_h__
81 
82 
double dead_time
Time to wait between commanded changes in state.
ShutterControl()
Default constructor.
int initialize_ShutterControl()
Sets the basic parameters to default values.
double last_t
the time of the last commanded change in state
int hw_state
1 is open, -1 is shut, 0 is unknown
int sw_state
1 is open, -1 is shut, 0 is unknown
double curr_t
the current time
timeval tp
for use in getting system time
bool ignore_hw_state
For when hw_state is unavailable.