CARMA C++
Optics.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_ANTENNA_OVRO_OPTICS_H
11 #define CARMA_ANTENNA_OVRO_OPTICS_H
12 
13 // Carma includes
15 #include "carma/canbus/Types.h"
16 #include "carma/monitor/OvroSubsystem.h"
17 #include "carma/util/PthreadMutex.h"
18 
19 namespace log4cpp {
20  // Forward dec
21  class Category;
22 } // End namespace log4cpp
23 
24 namespace carma {
25 
26 namespace antenna {
27 namespace ovro {
28 
38 public:
39 
48  carma::monitor::OvroSubsystem & ovroSubsys );
49 
53  ~Optics();
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
112  enum CAL_POS {
113  SKY = 0x00, // Sky
114  AMBIENT = 0x01, // Sidecab temperature
115  PARTIAL = 0x02, // Partial reflecting vane
116  HOT = 0x03, // Temperature controlled load
117  };
118 
124  LINEAR_VERTICAL = 0x00,
125  LINEAR_HORIZONTAL = 0x01,
126  LEFT_CIRCULAR = 0x02,
127  RIGHT_CIRCULAR = 0x03
128  };
129 
133  enum RECEIVER {
134  RX_CM = 0x00, // Centimeter Receiver
135  RX_3MM = 0x01, // 3mm Receiver
136  RX_1MM = 0x02, // 1mm Receiver
137  RX_GRID = 0x03 // Grid (3mm and 1mm)
138  };
139 
144  MIRROR = 0x00, // Mirror (3-mm Rx)
145  THROUGH = 0x01, // Through (1-mm)
146  GRID = 0x02 // Grid (3-mm and 1-mm)
147  };
148 
153  void selectReceiver( enum RECEIVER rx );
154 
159  void setCalPosition( enum CAL_POS pos );
160 
166  void setCalPosition( enum CAL_POS pos,
167  unsigned long sequenceNo,
168  bool sequenceNoFromRx );
169 
174  void moveMmRxSelect( enum MM_RX_SELECTION mmRx );
175 
180  void moveTertiary( bool in );
181 
189  void setMmCalPosition( enum CAL_POS pos );
190 
198  void setCmCalPosition( enum CAL_POS pos );
199 
205  void setMmRxSelectorAngle( float angleInDegrees );
206 
207 private:
208 
209 
210  // Disallow assignment and copy construction.
211  Optics(const Optics &);
212  Optics &operator=(const Optics &);
213 
214  // Routines to process individual blanking frame CAN packets.
215  // These routines are called by processMsg.
216  void processBlankingFramePacket1(
217  std::vector<carma::canbus::byteType> &data);
218  void processBlankingFramePacket2(
219  std::vector<carma::canbus::byteType> &data);
220  void processBlankingFramePacket3(
221  std::vector<carma::canbus::byteType> &data);
222  void processBlankingFramePacket4(
223  std::vector<carma::canbus::byteType> &data);
224  void processBlankingFramePacket5(
225  std::vector<carma::canbus::byteType> &data);
226  void processBlankingFramePacket6(
227  std::vector<carma::canbus::byteType> &data);
228 
229  // Routines to produce individual simulated blanking frame
230  // CAN packets. These routines are called by simulateMsg.
231  carma::canbus::Message simBlankingFramePacket1();
232  carma::canbus::Message simBlankingFramePacket2();
233  carma::canbus::Message simBlankingFramePacket3();
234  carma::canbus::Message simBlankingFramePacket4();
235  carma::canbus::Message simBlankingFramePacket5();
236  carma::canbus::Message simBlankingFramePacket6();
237 
238  typedef carma::monitor::OvroSubsystem::CalStateMonitorPointEnum OvroCalStateMPE;
239 
240  void
241  setAntennaCommonCalibratorState(
242  OvroCalStateMPE::CALSTATE instantaneousCalState );
243 
244  void
245  handlePendingCalibratorPositionRequests(
246  OvroCalStateMPE::CALSTATE instantaneousCalState );
247 
248  typedef struct {
249  OvroCalStateMPE::CALSTATE requestedPosition;
250  bool requestPending;
251  unsigned int requestPendingFrames;
252  unsigned long pendingSequenceNo;
253  bool sequenceNoFromRx;
255  } CalPosRequestType;
256 
257  // Member variables
258  log4cpp::Category &log_; // Reference to the system logger
259  carma::monitor::AntennaCommon &common_; // Reference to common MPs.
260  carma::monitor::OvroSubsystem::Optics &mon_;
261 
262  CalPosRequestType calPosRequest_;
263  unsigned long currentSequenceNo_;
264 
265  OvroCalStateMPE::CALSTATE lastInstantaneousCalState_;
266 
267 }; // End class Optics
268 }}} // End namespace carma::antenna::ovro
269 #endif
void setMmCalPosition(enum CAL_POS pos)
Set millimeter calibrator position.
void selectReceiver(enum RECEIVER rx)
Select receiver.
std::map< carma::canbus::msgType, std::string > getHalfSecMonitors() const
Retrieve a map of this devices half second monitor points.
void setMmRxSelectorAngle(float angleInDegrees)
Set mm rx selector position.
Declarations of carma::canbus types.
void processMsg(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool sim)
Process a CAN message addressed to the SecondaryMirror module.
void setCmCalPosition(enum CAL_POS pos)
Set centimeter calibrator position.
POLARIZATION_STATE
Polarization State enumeration.
Definition: Optics.h:123
Class to encapsulate a CAN message.
Definition: Message.h:21
void moveMmRxSelect(enum MM_RX_SELECTION mmRx)
Rotate the receiver select mechanism in the sidecab.
RECEIVER
Receiver enumeration.
Definition: Optics.h:133
carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Produce a simulated CAN message for a given msgType.
void updateFrameData()
Update Frame Data.
XacDevice canbus::device class implementation.
Definition: XacDevice.h:37
10-m Antenna Optics CAN device class.
Definition: Optics.h:37
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
MM_RX_SELECTION
Mm Rx selection enumerator.
Definition: Optics.h:143
void setCalPosition(enum CAL_POS pos)
Set Calibrator Position.
CAL_POS
Calibrator wheel position enumeration.
Definition: Optics.h:112
void moveTertiary(bool in)
Move the tertiary mirror to a selected position.
std::map< carma::canbus::msgType, std::string > getSlowMonitors() const
Return a map of this devices slow monitor points.
carma::canbus::devices::XacDevice class declaration.
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
unsigned short msgType
Carma Message id type.
Definition: Types.h:69
CanOutput interface.
Definition: CanOutput.h:26
Optics(carma::canbus::nodeType node, carma::canbus::CanOutput &io, carma::monitor::OvroSubsystem &ovroSubsys)
Constructor.