CARMA C++
CalTertOld.h
Go to the documentation of this file.
1 #ifndef SZA_ANTENNA_CANBUS_CALTERTOLD_H
2 #define SZA_ANTENNA_CANBUS_CALTERTOLD_H
3 
12 
14 
15 namespace sza {
16  namespace antenna {
17 
18  namespace control {
19  class AntennaRx;
20  }
21 
22  namespace canbus {
23 
24  class CalTertOld : public CalTert {
25  public:
26 
27  // Enumerate known mirror positions
28 
29  enum MirPos {
30  RX30GHZ = 0,
31  RX90GHZ = 1,
32  RX230GHZ = 2,
33  };
34 
35  // Enumerate known tertiary states
36 
37  enum TertState {
38  IN_POSITION = 0,
39  MOVING = 1,
40  HOMING = 2,
41  STOPPED = 3,
42  POS_SOFT_LIMIT = 4,
43  NEG_SOFT_LIMIT = 5,
44  HARD_LIMIT = 6,
45  ERROR = 7,
46  };
47 
51  CalTertOld(sza::antenna::control::AntennaRx* parent,
53  std::string boardName,
56 
60  virtual ~CalTertOld();
61 
65  std::vector<carma::canbus::Message>
66  oneWireInterface(sza::util::CalTertTypes::OwDevice device,
67  sza::util::CalTertTypes::OwCommand command,
68  bool send=true);
69 
73  std::vector<carma::canbus::Message>
74  positionCalibrator(sza::util::CalPos::Pos position, bool send=true);
75 
79  std::vector<carma::canbus::Message>
80  homeTertiary(bool send=true);
81 
85  std::vector<carma::canbus::Message>
86  positionTertiary(sza::util::Rx::Id id, bool send=true);
87 
91  std::vector<carma::canbus::Message>
92  positionTertiary(unsigned short position, bool send=true);
93 
97  std::vector<carma::canbus::Message>
98  enableTertiary(bool enable, bool send=true);
99 
103  std::vector<carma::canbus::Message>
104  resetStepper(bool send=true);
105 
110  std::vector<carma::canbus::Message>
111  indexCurrentEncoderPosition(sza::util::Rx::Id id, bool send=true);
112 
117  std::vector<carma::canbus::Message>
118  setEncoderPositionIndex(sza::util::Rx::Id id,
119  unsigned short index, bool send=true);
120 
121  std::vector<carma::canbus::Message>
122  setDefaultEncoderPositionIndex(sza::util::Rx::Id id, bool send=true);
123 
124  void storeEncoderPositionIndex(sza::util::Rx::Id id,
125  unsigned short index);
126 
127  unsigned short getEncoderPosition(sza::util::Rx::Id id);
128 
133  void registerRequest(unsigned seq);
134 
139  void registerTertiaryInPositionHandler(CAN_STATUS_MSG_HANDLER(*handler),
140  void* arg1, unsigned arg2);
141 
145  unsigned char tertStateToBit(unsigned char);
146 
147  private:
148 
150 
155  unsigned char posnCode_;
156 
160  unsigned short rx30GHzIndex_;
161 
165  unsigned short rx90GHzIndex_;
166 
170  long lastReq_;
171 
175  long lastAck_;
176 
180  void registerDone();
181 
182  //------------------------------------------------------------
183  // Blanking-frame (half-second) monitor members.
184  //------------------------------------------------------------
185 
189  std::map<carma::canbus::msgType, std::string>
190  getHalfSecMonitors() const;
191 
192  // Methods to deal with monitor packets for this device.
193 
197  void processBlankingFrameMonitor1(std::vector<carma::canbus::byteType>&
198  data, bool isSim);
199 
203  void processBlankingFrameMonitor2(std::vector<carma::canbus::byteType>&
204  data, bool isSim);
205 
209  void processBlankingFrameMonitor3(std::vector<carma::canbus::byteType>&
210  data, bool isSim);
211 
215  void processBlankingFrameMonitor4(std::vector<carma::canbus::byteType>&
216  data, bool isSim);
217 
218  //------------------------------------------------------------
219  // Status messages
220  //------------------------------------------------------------
221 
222  enum statusMessages {
223  STATUS_MSG_1 = 0x130, // Calibrator in position
224  STATUS_MSG_2 = 0x131, // Mirror in position
225  };
226 
230  virtual std::map<carma::canbus::msgType, std::string>
231  getStatusMessages() const;
232 
233  // Methods for processing status messages
234 
235  void processStatusMessage1(bool isSim);
236  void processStatusMessage2(bool isSim);
237 
238  //------------------------------------------------------------
239  // Commands for this device.
240  //------------------------------------------------------------
241 
245  enum engineeringCommands
246  {
247  ENGCMD_1WIRE_INTERFACE = 0x080,
248  ENGCMD_POS_CAL = 0x081,
249  ENGCMD_HOME_TERT = 0x082,
250  ENGCMD_POS_TERT = 0x083,
251  ENGCMD_ENABLE_TERT = 0x084,
252  ENGCMD_RESET_STEPPER = 0x085,
253  ENGCMD_IND_CURR_ENC_POS= 0x086,
254  ENGCMD_SET_ENC_POS = 0x087,
255  };
256 
257  // Utility conversion
258 
259  MirPos rxIdToMirPos(sza::util::Rx::Id rxId);
260 
261  // Check the tertiary position, and determine whether or not
262  // it is an error, given the current receiver id
263 
264  void checkTertPos();
265 
266  }; // End class CalTertOld
267 
268  } // End namespace canbus
269  } // End namespace antenna
270 } // End namespace sza
271 
272 
273 
274 #endif // End #ifndef SZA_ANTENNA_CANBUS_CALTERTOLD_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