My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
TrackerMsg.h
Go to the documentation of this file.
1 #ifndef TRACKERMSG_H
2 #define TRACKERMSG_H
3 
11 #include "gcp/control/code/unix/libunix_src/common/genericregs.h" // SRC_LEN
12 #include "gcp/control/code/unix/libunix_src/specific/rtcnetcoms.h" // SCAN_NET_NPT
13 
14 #include "gcp/util/common/Exception.h"
15 #include "gcp/util/common/GenericTaskMsg.h"
16 
17 #include "gcp/util/common/Axis.h"
18 #include "gcp/util/common/OffsetMsg.h"
19 #include "gcp/util/common/PointingMode.h"
20 #include "gcp/util/common/PointingTelescopes.h"
21 #include "gcp/util/common/TimeVal.h"
22 #include "gcp/util/common/Tracking.h"
23 
24 #include "gcp/util/common/Collimation.h"
25 #include "gcp/antenna/control/specific/Refraction.h"
26 
27 #include <string.h>
28 
29 namespace gcp {
30  namespace antenna {
31  namespace control {
32 
33  class TrackerMsg :
35 
36  public:
37 
41  enum MsgType {
42  COLLIMATION,
43  CONNECT_DRIVE, // Attempt to connect to the drive.
44  DISCONNECT_DRIVE, // Disconnect from the drive.
45  ENCODER_CALS,
46  ENCODER_LIMITS,
47  ENCODER_ZEROS,
48  EXTEND_EQNEQX,
49  EXTEND_UT1UTC,
50  FLAG_BOARD,
51  FLEXURE,
52  HALT,
53  LOCATION,
54  SITE,
55  OFFSET,
56  REBOOT_DRIVE,
57  SHUTDOWN,
58  REFRACTION,
59  RESTART,
60  SCAN,
61  SELECT_MODEL,
62  SLEW,
63  SLEWRATE,
64  START_TIMER, // Start 1pps timer
65  STOP_TIMER, // Stop 1pps timer
66  STROBE_SERVO,
67  TICK, // 1-pps tick has arrived
68  TILTS,
69  TRACK,
70  TV_ANGLE,
71  YEAR,
72  WEATHER,
73  RX,
74  BENCH_ZERO_POSITION,
75  BENCH_OFFSET,
76  BENCH_USE_BRAKES,
77  BENCH_SET_ACQUIRED_THRESHOLD,
78  BENCH_SET_FOCUS,
79  TILT_METER_CORRECTION,
80  TILT_METER_OFFSET,
81  TILT_METER_ANGLE,
82  TILT_METER_RANGE,
83  TILT_METER_MOVING_AVERAGE_INTERVAL,
84  LINEAR_SENSOR_CORRECTION,
85  LINEAR_SENSOR_OFFSET,
86  LINEAR_SENSOR_RANGE,
87  LINEAR_SENSOR_MOVING_AVERAGE_INTERVAL,
88  STOP,
89  TEST_TRACK_TIME,
90  SPECIFIC_SERVO_COMMAND,
91  };
92 
96  enum SpecMsgType {
97  SERVO_INITIALIZE_ANTENNA,
98  SERVO_HARD_STOP,
99  SERVO_DISABLE_PADS,
100  SERVO_LOAD_PARAMETERS,
101  };
102 
107 
111  union {
112 
116  struct {
117  unsigned long seq;
118  } rebootDrive;
119 
123  struct {
124  char name[SCAN_LEN];
125  int seq;
126  unsigned nreps;
127  unsigned istart;
128  unsigned ibody;
129  unsigned iend;
130  unsigned npt;
131  unsigned msPerSample;
132  unsigned flag[SCAN_NET_NPT];
133  unsigned index[SCAN_NET_NPT];
134  int azoff[SCAN_NET_NPT];
135  int eloff[SCAN_NET_NPT];
136  int dkoff[SCAN_NET_NPT];
137  bool add;
138  } scan;
139 
140 
144  struct {
145  unsigned long seq;
147  gcp::util::Tracking::SlewType slewType;
148  char source[SRC_LEN];
149  double az;
150  double el;
151  double pa;
152  } slew;
153 
157  struct {
158  unsigned long seq;
159  } halt;
160 
164  struct {
165  unsigned long mjdDays;
166  unsigned long mjdSeconds;
167  } tick;
168 
172  struct {
173  unsigned long mjdDays;
174  unsigned long mjdSeconds;
175  } strobe;
176 
180  struct {
181  unsigned long seq;
182  char source[SRC_LEN];
183  double mjd; // The Terrestrial Time at which ra,dec are
184  // valid, expressed as a Modified Julian Day
185  // number
186  double ra; // The desired apparent Right Ascension
187  // (0...360 degrees in radians)
188  double dec; // The desired apparent Declination
189  // (-180..180 degrees in radians)
190  double dist; // The distance to the source if it is near
191  // enough for parallax to be
192  // significant. Specify the distance in
193  // AU. Send 0 for distant sources.
194  } track;
195 
199  struct {
200  unsigned long seq; // The sequence number of this request
201  gcp::util::OffsetMsg offset; // A message containg the
202  // offset (see OffsetMsg.h)
203  } offset;
204 
210  struct {
211  double angle; // The PA angle at which the camera image is
212  // upright (radians)
213  } tvAngle;
214 
219  struct {
220  gcp::util::PointingMode::Type mode; // Which refraction mode are we
221  // updating? (radio | optical)
222  double a; // The A term of the refraction correction
223  double b; // The B term of the refraction correction
224  } refraction;
225 
253  struct {
254  double mjd; // The UTC to which this command refers as
255  // a Modified Julian Day number
256  double ut1utc; // The value of ut1 - utc (seconds)
257  } extendUt1Utc;
258 
262  struct {
263  double mjd; // The Terrestrial Time to which this
264  // command refers, as a Modified Julian
265  // day
266  double eqneqx; // The equation of the equinoxes (radians)
267  } extendEqnEqx;
268 
274  struct {
275  unsigned long seq; // The tracker sequence number of this command
276  gcp::util::Axis::Type axes; // A bitwise union of
277  // Axis::Type enumerated
278  // bits, used to specify
279  // which of the following
280  // axis rates are to be
281  // applied.
282  long az; // Azimuth slew rate (0-100)
283  long el; // Elevation slew rate (0-100)
284  long dk; // Deck slew rate (0-100)
285  } slewRate;
286 
290  struct {
291  unsigned long seq; // The tracker sequence number of this command
292  double ha; // The hour-angle component of the
293  // azimuth-axis tilt (mas)
294  double lat; // The latitude component of the
295  // azimuth-axis tilt (mas)
296  double el; // The tilt of the elevation axis
297  // perpendicular to the azimuth ring,
298  // measured clockwise around the
299  // direction of the azimuth std::vector
300  // (mas)
301  } tilts;
302 
306  struct {
307  unsigned long seq; // The tracker sequence number of this
308  // command
309  gcp::util::PointingMode::Type mode; // A PointingMode
310  // enumeration
311  // (optical|radio)
312 
313  double sFlexure; // Gravitational flexure (radians per
314  // sine elevation)
315  double cFlexure; // Gravitational flexure (radians per
316  // cosine elevation)
317  gcp::util::PointingTelescopes::Ptel ptelMask;
318  } flexure;
319 
323  struct {
324  unsigned long seq; // The tracker sequence number of this
325  // command
326  gcp::util::PointingMode::Type mode; // Which collimation?
327  // (optical|radio)
328  double x; // The magnitude of the horizonatl
329  // collimation offset
330  double y; // The magnitude of the vertical
331  // collimation offset
332  gcp::util::Collimation::Type type; // FIXED or POLAR?
333 
334  double magnitude; // The magnitude of the polar
335  // collimation offset
336  double direction; // The direction of the polar
337  // collimation offset
338 
339  gcp::util::OffsetMsg::Mode addMode; // ADD or SET?
340  gcp::util::PointingTelescopes::Ptel ptelMask;
341  } collimation;
342 
346  struct {
347  unsigned long seq; // The sequence number of this command
348  long az;
349  long el;
350  long dk;
352 
357  struct {
358  unsigned long seq; // The tracker sequence number of this command
359  long az_min; // The lower azimuth limit (encoder counts)
360  long az_max; // The upper azimuth limit (encoder counts)
361  long el_min; // The lower elevation limit (encoder counts)
362  long el_max; // The upper elevation limit (encoder counts)
363  long pa_min; // The lower deck limit (encoder counts)
364  long pa_max; // The upper deck limit (encoder counts)
365  } encoderLimits;
366 
372  struct {
373  unsigned long seq; // The sequence number of this command
374  double az; // Azimuth encoder angle at zero azimuth,
375  // measured in the direction of increasing
376  // azimuth (radians)
377  double el; // Elevation encoder angle at zero elevation,
378  // measured in the direction of increasing
379  // elevation (radians)
380  double dk; // Deck encoder angle at the deck reference
381  // position, measured clockwise when looking
382  // towards the sky (radians)
383  } encoderZeros;
384 
388  struct {
389  unsigned long seq; // The tracker sequence number of this
390  // command
391  gcp::util::PointingMode::Type mode; // A PointingMode enumeration
392  gcp::util::PointingTelescopes::Ptel ptelMask;
393  } selectModel;
394 
400  struct {
401  short year; // The current Gregorian year
402  } year;
403 
408  struct {
409  double lon; // The SZA longitude (east +ve) [-pi..pi] (radians)
410  double lat; // The SZA latitude [-pi/2..pi/2] (radians)
411  double alt; // The SZA altitude (meters)
412  } site;
413 
418  struct {
419  double north; // The antenna offset N (meters)
420  double east; // The antenna offset E (meters)
421  double up; // The antenna offset Up (meters)
422  } location;
423 
427  struct {
428  unsigned short board; // The register map index of the
429  // board to un/flag
430  bool flag; // True to flag, false to unflag
431  } flagBoard;
432 
433  struct {
434  double airTemperatureInK;
435  double relativeHumidityInMax1;
436  double pressureInMbar;
437  } weather;
438 
439  struct {
440  unsigned int seq;
441  double y1;
442  double y2;
443  double y3;
444  double x4;
445  double x5;
446  double z6;
447  } benchZeroPosition;
448 
449  struct {
450  unsigned int seq;
451  double y1;
452  double y2;
453  double y3;
454  double x4;
455  double x5;
456  double z6;
457  } benchOffset;
458 
459  struct {
460  unsigned int seq;
461  bool use_brakes;
462  } benchUseBrakes;
463 
464  struct {
465  unsigned int seq;
466  double threshold;
467  } benchSetAcquiredThreshold;
468 
469  struct {
470  unsigned int seq;
471  double focus;
472  } benchSetFocus;
473 
474  struct {
475  bool enable;
476  } tilt_meter_correction;
477 
478  struct {
479  double x; // x tilt meter offset (degrees)
480  double y; // y tilt meter offset (degrees)
481  } tilt_meter_offset;
482 
483  struct {
484  double angle; // x tilt meter direction relative to 0 azimuth (degrees)
485  } tilt_meter_angle;
486 
487  struct {
488  double maxAngle; // max allowed tilt meter reading (degrees)
489  } tilt_meter_range;
490 
491  struct {
492  double interval; // tilt meter moving average interval (seconds)
493  } tilt_meter_moving_average_interval;
494 
495  struct {
496  bool enable;
497  } linear_sensor_correction;
498 
499  struct {
500  double L1; // Left sensor 1 offset (millimeters)
501  double L2; // Left sensor 2 offset (millimeters)
502  double R1; // Right sensor 1 offset (millimeters)
503  double R2; // Right sensor 2 offset (millimeters)
504  } linear_sensor_offset;
505 
506  struct {
507  double maxDistance; // max allowed linear sensor reading (millimeters)
508  } linear_sensor_range;
509 
510  struct {
511  double interval; // linear sensor moving average interval (seconds)
512  } linear_sensor_moving_average_interval;
513 
514  struct {
515  unsigned sec;
516  unsigned msec;
517  } testTrackTime;
518 
519  struct {
520  unsigned cmdId;
521  int intVal;
522  float fltVal;
523  float fltVals[10];
524  } servoCmd;
525 
526 
527  } body;
528 
529  //------------------------------------------------------------
530  // Methods for packing message to the tracker task.
531  //
532  // We explicitly initialize genericMsgType_ in each method,
533  // since we cannot do this in a constructor, since objects
534  // with explicit constructors apparently can't be union
535  // members.
536  //------------------------------------------------------------
537 
538  inline void packBenchZeroPositionMsg(unsigned int seq, double y1, double y2, double y3,
539  double x4, double x5, double z6)
540  {
542  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
543 
544  type = BENCH_ZERO_POSITION;
545 
546  body.benchZeroPosition.seq = seq;
547  body.benchZeroPosition.y1 = y1;
548  body.benchZeroPosition.y2 = y2;
549  body.benchZeroPosition.y3 = y3;
550  body.benchZeroPosition.x4 = x4;
551  body.benchZeroPosition.x5 = x5;
552  body.benchZeroPosition.z6 = z6;
553  }
554 
555  inline void packBenchOffsetMsg(unsigned int seq, double y1, double y2, double y3, double x4, double x5, double z6)
556  {
558  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
559 
560  type = BENCH_OFFSET;
561 
562  body.benchOffset.seq = seq;
563  body.benchOffset.y1 = y1;
564  body.benchOffset.y2 = y2;
565  body.benchOffset.y3 = y3;
566  body.benchOffset.x4 = x4;
567  body.benchOffset.x5 = x5;
568  body.benchOffset.z6 = z6;
569  }
570 
571  inline void packBenchUseBrakesMsg(unsigned int seq, bool use_brakes)
572  {
574  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
575 
576  type = BENCH_USE_BRAKES;
577 
578  body.benchUseBrakes.seq = seq;
579  body.benchUseBrakes.use_brakes = use_brakes;
580  }
581 
582  inline void packBenchSetAcquiredThresholdMsg(unsigned int seq, double threshold)
583  {
585  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
586 
587  type = BENCH_SET_ACQUIRED_THRESHOLD;
588 
589  body.benchSetAcquiredThreshold.seq = seq;
590  body.benchSetAcquiredThreshold.threshold = threshold;
591  }
592 
593  inline void packBenchSetFocusMsg(unsigned int seq, double focus)
594  {
596  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
597 
598  type = BENCH_SET_FOCUS;
599 
600  body.benchSetFocus.seq = seq;
601  body.benchSetFocus.focus = focus;
602  }
603 
607  inline void packConnectDriveMsg() {
608  genericMsgType_ =
609  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
610 
611  type = CONNECT_DRIVE;
612  }
613 
617  inline void packTickMsg(gcp::util::TimeVal& time)
618  {
619  genericMsgType_ =
620  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
621 
622  type = TICK;
623 
624  body.tick.mjdDays = time.getMjdDays();
625  body.tick.mjdSeconds = time.getMjdSeconds();
626  }
627 
628 
632  inline void packDisconnectDriveMsg() {
633  genericMsgType_ =
634  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
635 
636  type = DISCONNECT_DRIVE;
637  }
638 
639  inline void packRebootDriveMsg(unsigned long seq)
640  {
641  genericMsgType_ =
642  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
643 
644  type = REBOOT_DRIVE;
645  body.rebootDrive.seq = seq;
646  }
647 
648  inline void packTiltMeterCorrectionMsg(bool enable)
649  {
651  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
652 
653  type = TILT_METER_CORRECTION;
654 
655  body.tilt_meter_correction.enable = enable;
656  }
657 
658  inline void packTiltMeterOffsetMsg(double x, double y)
659  {
661  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
662 
663  type = TILT_METER_OFFSET;
664 
665  body.tilt_meter_offset.x = x;
666  body.tilt_meter_offset.y = y;
667  }
668 
669  inline void packTiltMeterAngleMsg(double angle)
670  {
672  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
673 
674  type = TILT_METER_ANGLE;
675 
676  body.tilt_meter_angle.angle = angle;
677  }
678 
679  inline void packTiltMeterRangeMsg(double maxAngle)
680  {
682  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
683 
684  type = TILT_METER_RANGE;
685 
686  body.tilt_meter_range.maxAngle = maxAngle;
687  }
688 
689  inline void packTiltMeterMovingAverageIntervalMsg(double interval)
690  {
692  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
693 
694  type = TILT_METER_MOVING_AVERAGE_INTERVAL;
695 
696  body.tilt_meter_moving_average_interval.interval = interval;
697  }
698 
699  inline void packLinearSensorCorrectionMsg(bool enable)
700  {
702  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
703 
704  type = LINEAR_SENSOR_CORRECTION;
705 
706  body.linear_sensor_correction.enable = enable;
707  }
708 
709  inline void packLinearSensorOffsetMsg(double L1, double L2, double R1, double R2)
710  {
712  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
713 
714  type = LINEAR_SENSOR_OFFSET;
715 
716  body.linear_sensor_offset.L1 = L1;
717  body.linear_sensor_offset.L2 = L2;
718  body.linear_sensor_offset.R1 = R1;
719  body.linear_sensor_offset.R2 = R2;
720  }
721 
722  inline void packLinearSensorRangeMsg(double maxDistance)
723  {
725  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
726 
727  type = LINEAR_SENSOR_RANGE;
728 
729  body.linear_sensor_range.maxDistance = maxDistance;
730  }
731 
732  inline void packLinearSensorMovingAverageIntervalMsg(double interval)
733  {
735  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
736 
737  type = LINEAR_SENSOR_MOVING_AVERAGE_INTERVAL;
738 
739  body.linear_sensor_moving_average_interval.interval = interval;
740  }
741 
742  inline void packScanMsg(std::string name,
743  int seq,
744  unsigned nreps,
745  unsigned istart,
746  unsigned ibody,
747  unsigned iend,
748  unsigned npt,
749  unsigned msPerSample,
750  unsigned* index,
751  unsigned* flag,
752  int* azoff,
753  int* eloff,
754  bool add)
755  {
756  genericMsgType_ =
757  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
758 
759  type = SCAN;
760 
761  if(name.size() > SCAN_LEN)
762  ThrowError("scan name is too long");
763 
764  if(npt > SCAN_NET_NPT)
765  ThrowError("scan npt > " << SCAN_NET_NPT);
766 
767  strncpy(body.scan.name, name.c_str(), SCAN_LEN);
768 
769  body.scan.seq = seq;
770  body.scan.nreps = nreps;
771  body.scan.istart = istart;
772  body.scan.ibody = ibody;
773  body.scan.iend = iend;
774  body.scan.npt = npt;
775  body.scan.msPerSample = msPerSample;
776 
777  for(unsigned i=0; i < npt; i++) {
778  body.scan.index[i] = index[i];
779  body.scan.flag[i] = flag[i];
780  body.scan.azoff[i] = azoff[i];
781  body.scan.eloff[i] = eloff[i];
782  }
783 
784  body.scan.add = add;
785  }
786 
787  inline void packStopMsg()
788  {
789  genericMsgType_ =
790  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
791 
792  type = STOP;
793  }
794 
795  inline void packShutdownDriveMsg()
796  {
797  genericMsgType_ =
798  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
799 
800  type = SHUTDOWN;
801  }
802 
803  inline void packSlewMsg(unsigned long seq,
804  std::string source,
805  gcp::util::Axis::Type axes,
806  gcp::util::Tracking::SlewType slewType,
807  double az, double el, double pa)
808  {
809  genericMsgType_ =
810  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
811 
812  type = SLEW;
813  body.slew.seq = seq;
814  body.slew.axes = axes;
815  body.slew.slewType = slewType;
816 
817  if(source.size() > SRC_LEN)
818  ThrowError("source name is too long.\n");
819 
820  strncpy(body.slew.source, source.c_str(), SRC_LEN);
821 
822  body.slew.az = az;
823  body.slew.el = el;
824  body.slew.pa = pa;
825  }
826  inline void packHaltMsg(unsigned long seq)
827  {
828  genericMsgType_ =
829  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
830 
831  type = HALT;
832  body.halt.seq = seq;
833  }
834 
835  inline void packTrackMsg(unsigned long seq,
836  std::string source,
837  double mjd, double ra,
838  double dec, double dist)
839  {
840  genericMsgType_ =
841  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
842 
843  type = TRACK;
844  body.track.seq = seq;
845 
846  if(source.size() > SRC_LEN)
847  ThrowError("source name is too long.\n");
848 
849  strncpy(body.track.source, source.c_str(), SRC_LEN);
850 
851  body.track.mjd = mjd;
852  body.track.ra = ra;
853  body.track.dec = dec;
854  body.track.dist = dist;
855  }
856 
857  inline void packOffsetMsg(unsigned long seq,
858  gcp::util::OffsetMsg offset)
859  {
860  genericMsgType_ =
861  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
862 
863  type = OFFSET;
864  body.offset.seq = seq;
865  body.offset.offset = offset;
866  }
867 
868  inline void packTvAngleMsg(double angle)
869  {
870  genericMsgType_ =
871  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
872 
873  type = TV_ANGLE;
874  body.tvAngle.angle = angle;
875  }
876 
877  inline void packEncoderZerosMsg(unsigned long seq,
878  double az, double el, double dk)
879  {
880  genericMsgType_ =
881  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
882 
883  type = ENCODER_ZEROS;
884  body.encoderZeros.seq = seq;
885  body.encoderZeros.az = az;
886  body.encoderZeros.el = el;
887  body.encoderZeros.dk = dk;
888  }
889 
890  inline void packEncoderCountsPerTurnMsg(unsigned long seq,
891  long az, long el, long dk)
892  {
893  genericMsgType_ =
894  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
895 
896  type = ENCODER_CALS;
897  body.encoderCountsPerTurn.seq = seq;
898  body.encoderCountsPerTurn.az = az;
899  body.encoderCountsPerTurn.el = el;
900  body.encoderCountsPerTurn.dk = dk;
901  }
902 
903  inline void packRefractionMsg(gcp::util::PointingMode::Type mode, double a,
904  double b)
905  {
906  genericMsgType_ =
907  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
908 
909  type = REFRACTION;
910  body.refraction.mode = mode;
911  body.refraction.a = a;
912  body.refraction.b = b;
913  }
914 
915  inline void packRestartMsg()
916  {
917  genericMsgType_ =
918  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
919 
920  type = RESTART;
921  }
922 
923  inline void packExtendUt1UtcMsg(double mjd, double ut1utc)
924  {
925  genericMsgType_ =
926  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
927 
928  type = EXTEND_UT1UTC;
929  body.extendUt1Utc.mjd = mjd;
930  body.extendUt1Utc.ut1utc = ut1utc;
931  }
932 
933  inline void packExtendEqnEqxMsg(double mjd, double eqneqx)
934  {
935  genericMsgType_ =
936  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
937 
938  type = EXTEND_EQNEQX;
939  body.extendEqnEqx.mjd = mjd;
940  body.extendEqnEqx.eqneqx = eqneqx;
941  }
942 
943  inline void packSlewRateMsg(unsigned long seq,
944  gcp::util::Axis::Type axes,
945  long az, long el, long dk)
946  {
947  genericMsgType_ =
948  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
949 
950  type = SLEWRATE;
951  body.slewRate.seq = seq;
952  body.slewRate.axes = axes;
953  body.slewRate.az = az;
954  body.slewRate.el = el;
955  body.slewRate.dk = dk;
956  }
957 
958  inline void packStrobeMsg(gcp::util::TimeVal& time)
959  {
960  genericMsgType_ =
961  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
962 
963  type = STROBE_SERVO;
964 
965  body.strobe.mjdDays = time.getMjdDays();
966  body.strobe.mjdSeconds = time.getMjdSeconds();
967  }
968 
969  inline void packTiltsMsg(unsigned long seq, double ha, double lat,
970  double el)
971  {
972  genericMsgType_ =
973  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
974 
975  type = TILTS;
976  body.tilts.seq = seq;
977  body.tilts.ha = ha;
978  body.tilts.lat = lat;
979  body.tilts.el = el;
980  }
981 
982  inline void packFlexureMsg(unsigned long seq,
984  double sFlexure,
985  double cFlexure,
986  gcp::util::PointingTelescopes::Ptel ptelMask)
987  {
988  genericMsgType_ =
989  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
990 
991  type = FLEXURE;
992  body.flexure.seq = seq;
993  body.flexure.mode = mode;
994  body.flexure.sFlexure = sFlexure;
995  body.flexure.cFlexure = cFlexure;
996  body.flexure.ptelMask = ptelMask;
997  }
998 
999  inline void packCollimationMsg(unsigned long seq,
1001  double x, double y,
1002  gcp::util::Collimation::Type collType,
1003  double mag, double dir,
1005  gcp::util::PointingTelescopes::Ptel ptelMask)
1006 
1007  {
1008  genericMsgType_ =
1009  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1010 
1011  type = COLLIMATION;
1012  body.collimation.seq = seq;
1013  body.collimation.mode = mode;
1014  body.collimation.x = x;
1015  body.collimation.y = y;
1016  body.collimation.type = collType;
1017  body.collimation.magnitude = mag;
1018  body.collimation.direction = dir;
1019  body.collimation.addMode = addMode;
1020  body.collimation.ptelMask = ptelMask;
1021  }
1022 
1023  inline void packEncoderLimitsMsg(unsigned long seq,
1024  long az_min, long az_max,
1025  long el_min, long el_max,
1026  long pa_min, long pa_max)
1027  {
1028  genericMsgType_ =
1029  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1030 
1031  type = ENCODER_LIMITS;
1032  body.encoderLimits.seq = seq;
1033  body.encoderLimits.az_min = az_min;
1034  body.encoderLimits.az_max = az_max;
1035  body.encoderLimits.el_min = el_min;
1036  body.encoderLimits.el_max = el_max;
1037  body.encoderLimits.pa_min = pa_min;
1038  body.encoderLimits.pa_max = pa_max;
1039  }
1040 
1041  inline void packSelectModelMsg(unsigned long seq,
1043  gcp::util::PointingTelescopes::Ptel ptelMask)
1044  {
1045  genericMsgType_ =
1046  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1047 
1048  type = SELECT_MODEL;
1049  body.selectModel.seq = seq;
1050  body.selectModel.mode = mode;
1051  body.selectModel.ptelMask = ptelMask;
1052  }
1053 
1054  inline void packYearMsg(short year)
1055  {
1056  genericMsgType_ =
1057  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1058 
1059  type = YEAR;
1060  body.year.year = year;
1061  }
1062 
1063  inline void packSiteMsg(double lon, double lat, double alt)
1064  {
1065  genericMsgType_ =
1066  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1067 
1068  type = SITE;
1069  body.site.lon = lon;
1070  body.site.lat = lat;
1071  body.site.alt = alt;
1072  }
1073 
1074  inline void packLocationMsg(double north, double east, double up)
1075  {
1076  genericMsgType_ =
1077  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1078 
1079  type = LOCATION;
1080  body.location.north = north;
1081  body.location.east = east;
1082  body.location.up = up;
1083  }
1084 
1085  inline void packFlagBoardMsg(unsigned short board, bool flag)
1086  {
1087  genericMsgType_ =
1088  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1089 
1090  type = FLAG_BOARD;
1091  body.flagBoard.board = board;
1092  body.flagBoard.flag = flag;
1093  }
1094 
1099  inline void packWeatherMsg(double airTempInK, double relHumidityInMax1, double pressureInMbar)
1100  {
1101  genericMsgType_ =
1102  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1103 
1104  type = WEATHER;
1105 
1106  body.weather.airTemperatureInK = airTempInK;
1107  body.weather.relativeHumidityInMax1 = relHumidityInMax1;
1108  body.weather.pressureInMbar = pressureInMbar;
1109  }
1110 
1111  inline void packTestTrackTimeMsg(unsigned sec, unsigned msec)
1112  {
1113  genericMsgType_ =
1114  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1115 
1116  type = TEST_TRACK_TIME;
1117  body.testTrackTime.sec = sec;
1118  body.testTrackTime.msec = msec;
1119  }
1120 
1121  inline void packServoCmdMsg(unsigned cmdId, float fltVal, int intVal, float* fltVals)
1122  {
1123 
1124  genericMsgType_ =
1125  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
1126  type = SPECIFIC_SERVO_COMMAND;
1127  body.servoCmd.cmdId = cmdId;
1128  body.servoCmd.intVal = intVal;
1129  body.servoCmd.fltVal = fltVal;
1130  for (unsigned i=0; i<7; i++){
1131  body.servoCmd.fltVals[i] = fltVals[i];
1132  };
1133  }
1134 
1135  inline friend std::ostream& operator<<(std::ostream& os, const TrackerMsg& msg)
1136  {
1137  os << "TrackerMsg ";
1138  switch (msg.type) {
1139  case COLLIMATION: os << "COLLIMATION"; break;
1140  case CONNECT_DRIVE: os << "CONNECT_DRIVE"; break;
1141  case DISCONNECT_DRIVE: os << "DISCONNECT_DRIVE"; break;
1142  case ENCODER_CALS: os << "ENCODER_CALS"; break;
1143  case ENCODER_LIMITS: os << "ENCODER_LIMITS"; break;
1144  case ENCODER_ZEROS: os << "ENCODER_ZEROS"; break;
1145  case EXTEND_EQNEQX: os << "EXTEND_EQNEQX"; break;
1146  case EXTEND_UT1UTC: os << "EXTEND_UT1UTC"; break;
1147  case FLAG_BOARD: os << "FLAG_BOARD"; break;
1148  case FLEXURE: os << "FLEXURE"; break;
1149  case HALT: os << "HALT"; break;
1150  case LOCATION: os << "LOCATION"; break;
1151  case SITE: os << "SITE"; break;
1152  case OFFSET: os << "OFFSET"; break;
1153  case REBOOT_DRIVE: os << "REBOOT_DRIVE"; break;
1154  case REFRACTION: os << "REFRACTION"; break;
1155  case RESTART: os << "RESTART"; break;
1156  case SELECT_MODEL: os << "SELECT_MODEL"; break;
1157  case SLEW: os << "SLEW"; break;
1158  case SLEWRATE: os << "SLEWRATE"; break;
1159  case START_TIMER: os << "START_TIMER"; break;
1160  case STOP_TIMER: os << "STOP_TIMER"; break;
1161  case STROBE_SERVO: os << "STROBE_SERVO"; break;
1162  case TICK: os << "TICK"; break;
1163  case TILTS: os << "TILTS"; break;
1164  case TRACK: os << "TRACK"; break;
1165  case TV_ANGLE: os << "TV_ANGLE"; break;
1166  case YEAR: os << "YEAR"; break;
1167  case WEATHER: os << "WEATHER"; break;
1168  case RX: os << "RX"; break;
1169  }
1170  os << std::endl;
1171  }
1172 
1173  }; // End class TrackerMsg
1174 
1175  }; // End namespace control
1176  }; // End namespace antenna
1177 } // End namespace gcp
1178 
1179 #endif // End #ifndef
Definition: GenericTaskMsg.h:31
void packDisconnectDriveMsg()
Definition: TrackerMsg.h:632
struct gcp::antenna::control::TrackerMsg::@27::@51 flagBoard
void packConnectDriveMsg()
Definition: TrackerMsg.h:607
struct gcp::antenna::control::TrackerMsg::@27::@44 encoderCountsPerTurn
struct gcp::antenna::control::TrackerMsg::@27::@40 slewRate
struct gcp::antenna::control::TrackerMsg::@27::@33 strobe
SpecMsgType
Definition: TrackerMsg.h:96
struct gcp::antenna::control::TrackerMsg::@27::@31 halt
Mode
Definition: OffsetMsg.h:30
struct gcp::antenna::control::TrackerMsg::@27::@47 selectModel
struct gcp::antenna::control::TrackerMsg::@27::@42 flexure
MsgType
Definition: TrackerMsg.h:41
struct gcp::antenna::control::TrackerMsg::@27::@45 encoderLimits
struct gcp::antenna::control::TrackerMsg::@27::@32 tick
void packTickMsg(gcp::util::TimeVal &time)
Definition: TrackerMsg.h:617
struct gcp::antenna::control::TrackerMsg::@27::@46 encoderZeros
MsgType type
Definition: TrackerMsg.h:106
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
Definition: OffsetMsg.h:14
struct gcp::antenna::control::TrackerMsg::@27::@41 tilts
struct gcp::antenna::control::TrackerMsg::@27::@28 rebootDrive
struct gcp::antenna::control::TrackerMsg::@27::@38 extendUt1Utc
struct gcp::antenna::control::TrackerMsg::@27::@34 track
Definition: TimeVal.h:55
Type
Definition: PointingMode.h:25
void packWeatherMsg(double airTempInK, double relHumidityInMax1, double pressureInMbar)
Definition: TrackerMsg.h:1099
struct gcp::antenna::control::TrackerMsg::@27::@30 slew
struct gcp::antenna::control::TrackerMsg::@27::@29 scan
Definition: TrackerMsg.h:33
Type
Definition: Axis.h:24
struct gcp::antenna::control::TrackerMsg::@27::@36 tvAngle
struct gcp::antenna::control::TrackerMsg::@27::@50 location
unsigned int getMjdDays()
Definition: TimeVal.cc:749
struct gcp::antenna::control::TrackerMsg::@27::@37 refraction
struct gcp::antenna::control::TrackerMsg::@27::@49 site
struct gcp::antenna::control::TrackerMsg::@27::@39 extendEqnEqx
struct gcp::antenna::control::TrackerMsg::@27::@43 collimation
union gcp::antenna::control::TrackerMsg::@27 body
unsigned int getMjdSeconds()
Definition: TimeVal.cc:757