CARMA C++
Tiltmeter.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_ANTENNA_BIMA_TILTMETER_H
11 #define CARMA_ANTENNA_BIMA_TILTMETER_H
12 
13 // Carma includes
15 #include "carma/canbus/Types.h"
16 #include "carma/monitor/BimaSubsystem.h"
17 
18 namespace log4cpp {
19  // Forward dec
20  class Category;
21 } // End namespace log4cpp
22 
23 namespace carma
24 {
25  namespace antenna
26  {
27  namespace ovro
28  {
29 
35  {
36  public:
37 
44  Tiltmeter(
47  carma::monitor::BimaSubsystem &bmon
48  );
49 
53  virtual ~Tiltmeter();
54 
62  std::map<carma::canbus::msgType, std::string> getHalfSecMonitors() const;
63 
71  std::map<carma::canbus::msgType, std::string> getSlowMonitors() const;
72 
83  std::vector<carma::canbus::byteType> &data,
84  bool sim);
85 
96 
100  void updateFrameData();
101 
102  // Public Control Commands.
107  void setTemperature(float temp);
108 
112  enum OpMode {LOOP_ON, LOOP_OFF, MANUAL};
113 
119  void regulateTemperature(OpMode opMode, float pwrFract);
120 
127  void setLoopGain(float gain);
128 
134  void setLoopIntegrationConstant(float loopInteg);
135 
141  void setLoopRateConstant(float rateConst);
142 
148  void setLoopBandwidth(float bw);
149 
154 
155  private:
156 
157  // API Id for this device.
158  static const carma::canbus::apiType API_ID = 40;
159 
160  // API version this class was implemented from
161  static const char API_VERSION = 'E';
162 
163  // Late packet timeout in ms
164  static const double PACKET_LATE_THRESHOLD = 150.0;
165 
166  // Control command message ids.
167  static const carma::canbus::msgType SET_TEMPERATURE = 0x080;
168  static const carma::canbus::msgType REGULATE_TEMPERATURE = 0x081;
169  static const carma::canbus::msgType SET_LOOP_GAIN = 0x082;
170  static const carma::canbus::msgType SET_LOOP_INT_CONSTANT = 0x083;
171  static const carma::canbus::msgType SET_LOOP_RATE_CONSTANT = 0x084;
172  static const carma::canbus::msgType SET_LOOP_BANDWIDTH = 0x085;
173  static const carma::canbus::msgType WRITE_LOOP_PARAMS = 0x086;
174 
175  // Blanking frame message ids.
176  static const carma::canbus::msgType BLANKING_FRAME_PACKET_1 = 0x0E0;
177  static const carma::canbus::msgType BLANKING_FRAME_PACKET_2 = 0x0E1;
178  static const carma::canbus::msgType BLANKING_FRAME_PACKET_3 = 0x0E2;
179  static const carma::canbus::msgType BLANKING_FRAME_PACKET_4 = 0x0E3;
180  static const carma::canbus::msgType BLANKING_FRAME_PACKET_5 = 0x0E4;
181  static const carma::canbus::msgType BLANKING_FRAME_PACKET_6 = 0x0E5;
182 
183  // Disallow assignment and copy construction.
184  Tiltmeter(const Tiltmeter &);
185  Tiltmeter &operator=(const Tiltmeter &);
186 
187  // Routines to process individual blanking frame CAN packets.
188  // These routines are called by processMsg.
189  void processBlankingFramePacket1(
190  std::vector<carma::canbus::byteType> &data);
191  void processBlankingFramePacket2(
192  std::vector<carma::canbus::byteType> &data);
193  void processBlankingFramePacket3(
194  std::vector<carma::canbus::byteType> &data);
195  void processBlankingFramePacket4(
196  std::vector<carma::canbus::byteType> &data);
197  void processBlankingFramePacket5(
198  std::vector<carma::canbus::byteType> &data);
199  void processBlankingFramePacket6(
200  std::vector<carma::canbus::byteType> &data);
201 
202  // Routines to produce individual simulated blanking frame
203  // CAN packets. These routines are called by simulateMsg.
204  carma::canbus::Message simBlankingFramePacket1();
205  carma::canbus::Message simBlankingFramePacket2();
206  carma::canbus::Message simBlankingFramePacket3();
207  carma::canbus::Message simBlankingFramePacket4();
208  carma::canbus::Message simBlankingFramePacket5();
209  carma::canbus::Message simBlankingFramePacket6();
210 
211  // Other helper routines
212 
213  // Units in arcminutes.
214  void updateTiltMagAndDir(double lrTilt, double afTilt);
215 
216  // Member variables
217  log4cpp::Category &log_; // Reference to the system logger
218  carma::monitor::TiltmeterModule &mon_;
219  carma::monitor::BimaSubsystem &inputMon_; // For pointing c's and offsets.
220 
221  }; // End class Tiltmeter
222  }
223  }
224 } // End namespace carma::antenna::ovro
225 #endif
226 
void updateFrameData()
Update Frame Data.
carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Produce a simulated CAN message for a given msgType.
void setLoopRateConstant(float rateConst)
Set loop rate constant.
Declarations of carma::canbus types.
Tiltmeter device class.
Definition: Tiltmeter.h:34
Class to encapsulate a CAN message.
Definition: Message.h:21
void setLoopGain(float gain)
Set loop gain.
XacDevice canbus::device class implementation.
Definition: XacDevice.h:37
unsigned short apiType
Carma API id type.
Definition: Types.h:64
void setLoopBandwidth(float bw)
Set loop bandwidth.
void writeLoopParametersToEEPROM()
Write loop parameters to EEPROM.
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
virtual ~Tiltmeter()
Destructor.
void regulateTemperature(OpMode opMode, float pwrFract)
Regulate temperature.
void setTemperature(float temp)
Set temperature of the tiltmeter.
void processMsg(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool sim)
Process a CAN message addressed to the CryoCompressor module.
std::map< carma::canbus::msgType, std::string > getSlowMonitors() const
Return a map of this devices slow monitor points.
std::map< carma::canbus::msgType, std::string > getHalfSecMonitors() const
Retrieve a map of this devices half second monitor points.
carma::canbus::devices::XacDevice class declaration.
unsigned short msgType
Carma Message id type.
Definition: Types.h:69
void setLoopIntegrationConstant(float loopInteg)
Set loop integration constant.
Tiltmeter(carma::canbus::nodeType node, carma::canbus::CanOutput &io, carma::monitor::BimaSubsystem &bmon)
Constructor.
CanOutput interface.
Definition: CanOutput.h:26
OpMode
Enumeration for Thermal control operation mode.
Definition: Tiltmeter.h:112