CARMA C++
CalTertNew.h
Go to the documentation of this file.
1 #ifndef SZA_ANTENNA_CANBUS_CALTERTNEW_H
2 #define SZA_ANTENNA_CANBUS_CALTERTNEW_H
3 
11 #include "carma/szautil/Angle.h"
12 
14 
16 
17 namespace sza {
18  namespace antenna {
19 
20  namespace control {
21  class AntennaRx;
22  }
23 
24  namespace canbus {
25 
26  class CalTertNew : public CalTert {
27  public:
28 
29  // Enumerate known mirror positions
30 
31  enum MirPos {
32  RX30GHZ = 0,
33  RX90GHZ = 1,
34  RX230GHZ = 2,
35  RX1CM = RX30GHZ,
36  RX3MM = RX90GHZ,
37  RX1MM = RX230GHZ
38  };
39 
40  // Enumerate known tertiary states
41 
42  enum TertState {
43  TS_IDLE = 0,
44  TS_HOMING = 1,
45  TS_HOME = 2,
46  TS_HOME_ERROR = 3,
47  TS_MOVING = 4,
48  TS_RX1CM_SELECTED = 5,
49  TS_RX3MM_SELECTED = 6,
50  TS_RX1MM_SELECTED = 7,
51  TS_MANUAL_POSITION = 8,
52  TS_STUCK = 9,
53  };
54 
55  enum CalState {
56  CS_IDLE = 0,
57  CS_MOVING = 1,
58  CS_SKY = 2,
59  CS_AMBIENT = 3,
60  CS_WAIT_FOR_TERTIARY = 4,
61  CS_STUCK = 5,
62  };
63 
67  CalTertNew(sza::antenna::control::AntennaRx* parent,
69  std::string boardName,
72 
76  virtual ~CalTertNew();
77 
81  std::vector<carma::canbus::Message>
82  positionCalibrator(sza::util::CalPos::Pos position, unsigned seq=0, bool send=true);
83 
87  std::vector<carma::canbus::Message>
88  positionTertiary(sza::util::Rx::Id id, unsigned seq=0, bool send=true);
89 
93  std::vector<carma::canbus::Message>
94  positionTertiary(sza::util::Angle position, unsigned seq=0, bool send=true);
95 
99  std::vector<carma::canbus::Message>
100  homeTertiary(bool send=true);
101 
106  void registerTertiaryInPositionHandler(CAN_STATUS_MSG_HANDLER(*handler),
107  void* arg1, unsigned arg2);
108 
109  static TertState rxIdToTertState(sza::util::Rx::Id rxId);
110 
111  private:
112 
113  CalState expectedCalState_;
114  sza::util::Mutex calStateGuard_;
115  unsigned lastReqCalStateSeq_;
116  unsigned lastAckCalStateSeq_;
117 
118  TertState expectedTertState_;
119  sza::util::Mutex tertStateGuard_;
120  unsigned lastReqTertStateSeq_;
121  unsigned lastAckTertStateSeq_;
122 
123  short expectedTertPos_;
124  sza::util::Mutex tertPosGuard_;
125  unsigned lastReqTertPosSeq_;
126  unsigned lastAckTertPosSeq_;
127 
129 
134  unsigned char tertState_;
135 
139  void registerDone(unsigned& req, unsigned& ack);
140 
141  //------------------------------------------------------------
142  // Blanking-frame (half-second) monitor members.
143  //------------------------------------------------------------
144 
148  std::map<carma::canbus::msgType, std::string>
149  getHalfSecMonitors() const;
150 
151  // Methods to deal with monitor packets for this device.
152 
156  void processBlankingFrameMonitor1(std::vector<carma::canbus::byteType>&
157  data, bool isSim);
158 
162  void processBlankingFrameMonitor2(std::vector<carma::canbus::byteType>&
163  data, bool isSim);
164 
168  void processBlankingFrameMonitor3(std::vector<carma::canbus::byteType>&
169  data, bool isSim);
170 
174  void processBlankingFrameMonitor4(std::vector<carma::canbus::byteType>&
175  data, bool isSim);
176 
180  void processBlankingFrameMonitor5(std::vector<carma::canbus::byteType>&
181  data, bool isSim);
182 
183  //------------------------------------------------------------
184  // Commands for this device.
185  //------------------------------------------------------------
186 
190  enum engineeringCommands
191  {
192  ENGCMD_POS_CAL = 0x080,
193  ENGCMD_SELECT_RX = 0x081,
194  ENGCMD_POS_TERT = 0x082,
195  ENGCMD_HOME_TERT = 0x083
196  };
197 
198  // Utility conversion
199 
200  MirPos rxIdToMirPos(sza::util::Rx::Id rxId);
201 
202  // Check the tertiary position, and determine whether or not
203  // it is an error, given the current receiver id
204 
205  void checkTertPos();
206 
207  }; // End class CalTertNew
208 
209  } // End namespace canbus
210  } // End namespace antenna
211 } // End namespace sza
212 
213 
214 
215 #endif // End #ifndef SZA_ANTENNA_CANBUS_CALTERTNEW_H
Started: Fri Nov 21 15:46:44 UTC 2003.
AntennaRx class will handle all receiver functions.
Definition: AntennaRx.h:55
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
Tagged: Thu Jun 17 20:58:48 UTC 2004.
CanOutput interface.
Definition: CanOutput.h:26
An instance of this class is created by AntennaMaster and passed to the constructors of other tasks...
Definition: Share.h:38