CARMA C++
Motor.h
Go to the documentation of this file.
1 
15 #ifndef CARMA_ANTENNA_BIMA_MOTOR_H
16 #define CARMA_ANTENNA_BIMA_MOTOR_H
17 
18 // System includes
19 #include <string>
20 #include <unistd.h>
21 
22 // CARMA includes
24 
25 namespace carma
26 {
27  namespace antenna
28  {
29  namespace bima
30  {
31  class Motor : public TelemetryClient
32  {
33  typedef enum { RECEIVER, FOCUS, DRIVE, MMOSC } MotorType;
34  typedef enum { ABOVE, BELOW, EITHER } StepFrom;
35  private:
36  const char *_name; // name of the motor, for ref to telemetry.xml
37  std::string _fullname;
38  MotorType _type;
39  const char *_dir; // name of direction byte, ref to telemetry.xml
40  const char *_toggle; // name of toggle byte, ref to telemetry.xml
41  const char *_lock; // name of toggle byte, ref to telemetry.xml
42  const char *_bitsin; // name of toggle byte, ref to telemetry.xml
43  int _cardaddr; // address of the motor driver card
44  int _togglebit; // address of the motor, 0 thru 7
45  int _lockcode;
46  int _mask;
47  std::string *_dir_addr;
48  int _potent; // Address of the potentiometer readout on the A/D card
49  const char *_ad_ref; // Address of the a/d reference readout on the a/d card
50  int _pulse; // Distance travelled in 1 pulse, in counts
51  int _coast; // Distance motor coasts in a/d counts
52  int _backlash; // Overshoot (required for backlash in counts
53  int _halfstep;
54  int _far;
55  int _close;
56  int _near;
57  int _hair;
58  int _offset;
59  float _hifocus;
60  float _lofocus;
61  public:
62  int _fast;
63  int _medium;
64  int _slow;
65  int _crawl;
66 
67  public:
68  Motor( std::string properName, Configuration& config );
69 
70  int getCoast() { return _coast; };
71 
72  void moveUp( unsigned short target );
73  void moveDown( unsigned short target );
74  void moveToTarget( unsigned short target,
75  StepFrom = Motor::EITHER );
76  void enableLock();
77  void disableLock();
78  void limitTarget( unsigned short& target );
79  void step( int num );
80  void setDirection( unsigned char dir );
81  short getADMax();
82  short position();
83  short position( float &focus ); // pos info for Focus motor
84  const char *getName();
85 
86  static const unsigned char UP = 0xff;
87  static const unsigned char DOWN = 0x00;
88  static const unsigned short _upperlimit = 32740;
89  static const unsigned short _lowerlimit = 25;
90 
91  }; // class Motor
92  } // namespace bima
93  } // namespace antenna
94 } // namespace carma
95 
96 #endif // CARMA_ANTENNA_BIMA_MOTOR_H
Class definition for TelemetryClient on the BIMA antennas.