Telescope Control Library
EquatorialMount.h@2:2ee28add0821, 2018-08-20 (annotated)
- Committer:
- caoyuan9642
- Date:
- Mon Aug 20 23:42:21 2018 +0000
- Revision:
- 2:2ee28add0821
- Parent:
- 0:6cb2eaf8b133
- Child:
- 4:b8ad57bbf9e1
Guiding status
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
caoyuan9642 | 0:6cb2eaf8b133 | 1 | #ifndef EQUATORIALMOUNT_H_ |
caoyuan9642 | 0:6cb2eaf8b133 | 2 | #define EQUATORIALMOUNT_H_ |
caoyuan9642 | 0:6cb2eaf8b133 | 3 | |
caoyuan9642 | 0:6cb2eaf8b133 | 4 | class EquatorialMount; |
caoyuan9642 | 0:6cb2eaf8b133 | 5 | |
caoyuan9642 | 0:6cb2eaf8b133 | 6 | #include "Axis.h" |
caoyuan9642 | 0:6cb2eaf8b133 | 7 | #include "Mount.h" |
caoyuan9642 | 0:6cb2eaf8b133 | 8 | #include "UTCClock.h" |
caoyuan9642 | 0:6cb2eaf8b133 | 9 | #include "LocationProvider.h" |
caoyuan9642 | 0:6cb2eaf8b133 | 10 | #include "CelestialMath.h" |
caoyuan9642 | 0:6cb2eaf8b133 | 11 | |
caoyuan9642 | 0:6cb2eaf8b133 | 12 | #define MAX_AS_N 10 // Max number of alignment stars |
caoyuan9642 | 0:6cb2eaf8b133 | 13 | |
caoyuan9642 | 0:6cb2eaf8b133 | 14 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 15 | * Direction of nudge |
caoyuan9642 | 0:6cb2eaf8b133 | 16 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 17 | typedef enum |
caoyuan9642 | 0:6cb2eaf8b133 | 18 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 19 | NUDGE_NONE = 0, |
caoyuan9642 | 0:6cb2eaf8b133 | 20 | NUDGE_EAST = 1, |
caoyuan9642 | 0:6cb2eaf8b133 | 21 | NUDGE_WEST = 2, |
caoyuan9642 | 0:6cb2eaf8b133 | 22 | NUDGE_NORTH = 4, |
caoyuan9642 | 0:6cb2eaf8b133 | 23 | NUDGE_SOUTH = 8, |
caoyuan9642 | 0:6cb2eaf8b133 | 24 | |
caoyuan9642 | 0:6cb2eaf8b133 | 25 | NUDGE_NORTHWEST = NUDGE_NORTH | NUDGE_WEST, |
caoyuan9642 | 0:6cb2eaf8b133 | 26 | NUDGE_SOUTHWEST = NUDGE_SOUTH | NUDGE_WEST, |
caoyuan9642 | 0:6cb2eaf8b133 | 27 | NUDGE_NORTHEAST = NUDGE_NORTH | NUDGE_EAST, |
caoyuan9642 | 0:6cb2eaf8b133 | 28 | NUDGE_SOUTHEAST = NUDGE_SOUTH | NUDGE_EAST, |
caoyuan9642 | 0:6cb2eaf8b133 | 29 | } nudgedir_t; |
caoyuan9642 | 0:6cb2eaf8b133 | 30 | |
caoyuan9642 | 0:6cb2eaf8b133 | 31 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 32 | * Direction of guide |
caoyuan9642 | 0:6cb2eaf8b133 | 33 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 34 | typedef enum |
caoyuan9642 | 0:6cb2eaf8b133 | 35 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 36 | GUIDE_EAST = 1, GUIDE_WEST = 2, GUIDE_NORTH = 3, GUIDE_SOUTH = 4, |
caoyuan9642 | 0:6cb2eaf8b133 | 37 | } guidedir_t; |
caoyuan9642 | 0:6cb2eaf8b133 | 38 | |
caoyuan9642 | 0:6cb2eaf8b133 | 39 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 40 | * Object that represents an equatorial mount with two perpendicular axis called RA and Dec. |
caoyuan9642 | 0:6cb2eaf8b133 | 41 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 42 | class EquatorialMount: public Mount |
caoyuan9642 | 0:6cb2eaf8b133 | 43 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 44 | |
caoyuan9642 | 0:6cb2eaf8b133 | 45 | protected: |
caoyuan9642 | 0:6cb2eaf8b133 | 46 | Axis &ra; /// RA Axis |
caoyuan9642 | 0:6cb2eaf8b133 | 47 | Axis &dec; /// DEC Axis |
caoyuan9642 | 0:6cb2eaf8b133 | 48 | |
caoyuan9642 | 0:6cb2eaf8b133 | 49 | UTCClock &clock; /// Clock |
caoyuan9642 | 0:6cb2eaf8b133 | 50 | |
caoyuan9642 | 0:6cb2eaf8b133 | 51 | Mutex mutex_update; /// Mutex to lock position updating |
caoyuan9642 | 0:6cb2eaf8b133 | 52 | Mutex mutex_execution; /// Mutex to lock motion related functions |
caoyuan9642 | 0:6cb2eaf8b133 | 53 | |
caoyuan9642 | 0:6cb2eaf8b133 | 54 | LocationCoordinates location; /// Current location (GPS coordinates) |
caoyuan9642 | 0:6cb2eaf8b133 | 55 | bool south; /// If we are in south semisphere |
caoyuan9642 | 0:6cb2eaf8b133 | 56 | MountCoordinates curr_pos; /// Current Position in mount coordinates (offset from the index positions) |
caoyuan9642 | 0:6cb2eaf8b133 | 57 | EquatorialCoordinates curr_pos_eq; /// Current Position in the equatorial coordinates (absolute pointing direction in the sky) |
caoyuan9642 | 0:6cb2eaf8b133 | 58 | nudgedir_t curr_nudge_dir; |
caoyuan9642 | 0:6cb2eaf8b133 | 59 | double nudgeSpeed; |
caoyuan9642 | 0:6cb2eaf8b133 | 60 | |
caoyuan9642 | 0:6cb2eaf8b133 | 61 | pierside_t pier_side; /// Side of pier. 1: East |
caoyuan9642 | 0:6cb2eaf8b133 | 62 | EqCalibration calibration; |
caoyuan9642 | 0:6cb2eaf8b133 | 63 | AlignmentStar alignment_stars[MAX_AS_N]; |
caoyuan9642 | 0:6cb2eaf8b133 | 64 | int num_alignment_stars; |
caoyuan9642 | 0:6cb2eaf8b133 | 65 | |
caoyuan9642 | 0:6cb2eaf8b133 | 66 | public: |
caoyuan9642 | 0:6cb2eaf8b133 | 67 | |
caoyuan9642 | 0:6cb2eaf8b133 | 68 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 69 | * Create an EquatorialMount object which controls two axis |
caoyuan9642 | 0:6cb2eaf8b133 | 70 | * @param ra RA Axis |
caoyuan9642 | 0:6cb2eaf8b133 | 71 | * @param dec DEC Axis |
caoyuan9642 | 0:6cb2eaf8b133 | 72 | * @note cone_value, ma_alt, ma_azi,off_ra, off_dec will be init to zero, i.e. assuming a perfectly aligned mount pointing at RA=DEC=0 |
caoyuan9642 | 0:6cb2eaf8b133 | 73 | * @note This class assumes that the rotating direction of both axis are correct. |
caoyuan9642 | 0:6cb2eaf8b133 | 74 | * This should be done using the invert option when initializing the RotationAxis objects |
caoyuan9642 | 0:6cb2eaf8b133 | 75 | * @sa RotationAxis |
caoyuan9642 | 0:6cb2eaf8b133 | 76 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 77 | EquatorialMount(Axis &ra, Axis &dec, UTCClock &clk, |
caoyuan9642 | 0:6cb2eaf8b133 | 78 | LocationCoordinates loc); |
caoyuan9642 | 0:6cb2eaf8b133 | 79 | virtual ~EquatorialMount() |
caoyuan9642 | 0:6cb2eaf8b133 | 80 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 81 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 82 | |
caoyuan9642 | 0:6cb2eaf8b133 | 83 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 84 | * Perform a Go-To to specified equatorial coordinates in the sky |
caoyuan9642 | 0:6cb2eaf8b133 | 85 | * @param ra_dest RA coordinate in degree. |
caoyuan9642 | 0:6cb2eaf8b133 | 86 | * @return osOK if no error |
caoyuan9642 | 0:6cb2eaf8b133 | 87 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 88 | osStatus goTo(double ra_dest, double dec_dest); |
caoyuan9642 | 0:6cb2eaf8b133 | 89 | osStatus goTo(EquatorialCoordinates dest); |
caoyuan9642 | 0:6cb2eaf8b133 | 90 | osStatus goToMount(MountCoordinates mc, bool withCorrection = true); |
caoyuan9642 | 0:6cb2eaf8b133 | 91 | osStatus goToIndex() |
caoyuan9642 | 0:6cb2eaf8b133 | 92 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 93 | return goToMount(MountCoordinates(0, 0)); |
caoyuan9642 | 0:6cb2eaf8b133 | 94 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 95 | |
caoyuan9642 | 0:6cb2eaf8b133 | 96 | osStatus startNudge(nudgedir_t); |
caoyuan9642 | 0:6cb2eaf8b133 | 97 | osStatus stopNudge(); |
caoyuan9642 | 0:6cb2eaf8b133 | 98 | |
caoyuan9642 | 0:6cb2eaf8b133 | 99 | osStatus startTracking(); |
caoyuan9642 | 0:6cb2eaf8b133 | 100 | osStatus stopTracking(); |
caoyuan9642 | 0:6cb2eaf8b133 | 101 | |
caoyuan9642 | 2:2ee28add0821 | 102 | mountstatus_t getStatus(); |
caoyuan9642 | 0:6cb2eaf8b133 | 103 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 104 | * Guide on specified direction for specified time |
caoyuan9642 | 0:6cb2eaf8b133 | 105 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 106 | osStatus guide(guidedir_t dir, int ms); |
caoyuan9642 | 0:6cb2eaf8b133 | 107 | |
caoyuan9642 | 0:6cb2eaf8b133 | 108 | /*Calibration related functions*/ |
caoyuan9642 | 0:6cb2eaf8b133 | 109 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 110 | * Clear calibration, use current latitude for the polar axis |
caoyuan9642 | 0:6cb2eaf8b133 | 111 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 112 | void clearCalibration() |
caoyuan9642 | 0:6cb2eaf8b133 | 113 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 114 | num_alignment_stars = 0; |
caoyuan9642 | 0:6cb2eaf8b133 | 115 | calibration = EqCalibration(); |
caoyuan9642 | 0:6cb2eaf8b133 | 116 | calibration.pa.alt = location.lat; |
caoyuan9642 | 0:6cb2eaf8b133 | 117 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 118 | |
caoyuan9642 | 0:6cb2eaf8b133 | 119 | const EqCalibration &getCalibration() const |
caoyuan9642 | 0:6cb2eaf8b133 | 120 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 121 | return calibration; |
caoyuan9642 | 0:6cb2eaf8b133 | 122 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 123 | |
caoyuan9642 | 0:6cb2eaf8b133 | 124 | int getNumAlignmentStar() |
caoyuan9642 | 0:6cb2eaf8b133 | 125 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 126 | return num_alignment_stars; |
caoyuan9642 | 0:6cb2eaf8b133 | 127 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 128 | |
caoyuan9642 | 0:6cb2eaf8b133 | 129 | osStatus addAlignmentStar(AlignmentStar as) |
caoyuan9642 | 0:6cb2eaf8b133 | 130 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 131 | if (num_alignment_stars < MAX_AS_N) |
caoyuan9642 | 0:6cb2eaf8b133 | 132 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 133 | alignment_stars[num_alignment_stars++] = as; |
caoyuan9642 | 0:6cb2eaf8b133 | 134 | return recalibrate(); |
caoyuan9642 | 0:6cb2eaf8b133 | 135 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 136 | else |
caoyuan9642 | 0:6cb2eaf8b133 | 137 | return osErrorResource; |
caoyuan9642 | 0:6cb2eaf8b133 | 138 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 139 | |
caoyuan9642 | 0:6cb2eaf8b133 | 140 | osStatus removeAlignmentStar(int index) |
caoyuan9642 | 0:6cb2eaf8b133 | 141 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 142 | if (index < 0 || index >= num_alignment_stars) |
caoyuan9642 | 0:6cb2eaf8b133 | 143 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 144 | return osErrorParameter; |
caoyuan9642 | 0:6cb2eaf8b133 | 145 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 146 | for (; index < num_alignment_stars - 1; index++) |
caoyuan9642 | 0:6cb2eaf8b133 | 147 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 148 | alignment_stars[index] = alignment_stars[index + 1]; |
caoyuan9642 | 0:6cb2eaf8b133 | 149 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 150 | num_alignment_stars--; |
caoyuan9642 | 0:6cb2eaf8b133 | 151 | return recalibrate(); |
caoyuan9642 | 0:6cb2eaf8b133 | 152 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 153 | |
caoyuan9642 | 0:6cb2eaf8b133 | 154 | AlignmentStar *getAlignmentStar(int index) |
caoyuan9642 | 0:6cb2eaf8b133 | 155 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 156 | if (index < 0 || index >= num_alignment_stars) |
caoyuan9642 | 0:6cb2eaf8b133 | 157 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 158 | return NULL; |
caoyuan9642 | 0:6cb2eaf8b133 | 159 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 160 | return &alignment_stars[index]; |
caoyuan9642 | 0:6cb2eaf8b133 | 161 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 162 | |
caoyuan9642 | 0:6cb2eaf8b133 | 163 | osStatus replaceAlignmentStar(int index, AlignmentStar as) |
caoyuan9642 | 0:6cb2eaf8b133 | 164 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 165 | if (index < 0 || index >= num_alignment_stars) |
caoyuan9642 | 0:6cb2eaf8b133 | 166 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 167 | return osErrorParameter; |
caoyuan9642 | 0:6cb2eaf8b133 | 168 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 169 | alignment_stars[index] = as; |
caoyuan9642 | 0:6cb2eaf8b133 | 170 | return recalibrate(); |
caoyuan9642 | 0:6cb2eaf8b133 | 171 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 172 | |
caoyuan9642 | 0:6cb2eaf8b133 | 173 | /*Utility functions to convert between coordinate systems*/ |
caoyuan9642 | 0:6cb2eaf8b133 | 174 | MountCoordinates convertToMountCoordinates(const EquatorialCoordinates &eq) |
caoyuan9642 | 0:6cb2eaf8b133 | 175 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 176 | LocalEquatorialCoordinates leq = |
caoyuan9642 | 0:6cb2eaf8b133 | 177 | CelestialMath::equatorialToLocalEquatorial(eq, clock.getTime(), |
caoyuan9642 | 0:6cb2eaf8b133 | 178 | location); |
caoyuan9642 | 0:6cb2eaf8b133 | 179 | // Apply PA misalignment |
caoyuan9642 | 0:6cb2eaf8b133 | 180 | leq = CelestialMath::applyMisalignment(leq, calibration.pa, location); |
caoyuan9642 | 0:6cb2eaf8b133 | 181 | // Apply Cone error |
caoyuan9642 | 0:6cb2eaf8b133 | 182 | leq = CelestialMath::applyConeError(leq, calibration.cone); |
caoyuan9642 | 0:6cb2eaf8b133 | 183 | // Convert to Mount coordinates. Automatically determine the pier side, then apply offset |
caoyuan9642 | 0:6cb2eaf8b133 | 184 | return CelestialMath::localEquatorialToMount(leq, PIER_SIDE_AUTO) |
caoyuan9642 | 0:6cb2eaf8b133 | 185 | + calibration.offset; |
caoyuan9642 | 0:6cb2eaf8b133 | 186 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 187 | |
caoyuan9642 | 0:6cb2eaf8b133 | 188 | EquatorialCoordinates convertToEqCoordinates(const MountCoordinates &mc) |
caoyuan9642 | 0:6cb2eaf8b133 | 189 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 190 | LocalEquatorialCoordinates leq = CelestialMath::mountToLocalEquatorial( |
caoyuan9642 | 0:6cb2eaf8b133 | 191 | mc - calibration.offset); |
caoyuan9642 | 0:6cb2eaf8b133 | 192 | leq = CelestialMath::deapplyConeError(leq, calibration.cone); |
caoyuan9642 | 0:6cb2eaf8b133 | 193 | leq = CelestialMath::deapplyMisalignment(leq, calibration.pa, location); |
caoyuan9642 | 0:6cb2eaf8b133 | 194 | return CelestialMath::localEquatorialToEquatorial(leq, clock.getTime(), |
caoyuan9642 | 0:6cb2eaf8b133 | 195 | location); |
caoyuan9642 | 0:6cb2eaf8b133 | 196 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 197 | |
caoyuan9642 | 0:6cb2eaf8b133 | 198 | osStatus recalibrate(); |
caoyuan9642 | 0:6cb2eaf8b133 | 199 | |
caoyuan9642 | 0:6cb2eaf8b133 | 200 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 201 | * Call emergency stop of the Axis objects |
caoyuan9642 | 0:6cb2eaf8b133 | 202 | * @note This function can be called from any context (including ISR) to perform a hard stop of the mount |
caoyuan9642 | 0:6cb2eaf8b133 | 203 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 204 | void emergencyStop(); |
caoyuan9642 | 0:6cb2eaf8b133 | 205 | |
caoyuan9642 | 0:6cb2eaf8b133 | 206 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 207 | * Call stop of the Axis objects |
caoyuan9642 | 0:6cb2eaf8b133 | 208 | * @note This function can be called from any context (including ISR) to perform a soft stop of the mount |
caoyuan9642 | 0:6cb2eaf8b133 | 209 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 210 | void stopAsync(); |
caoyuan9642 | 0:6cb2eaf8b133 | 211 | |
caoyuan9642 | 0:6cb2eaf8b133 | 212 | /** BLOCKING. Cannot be called in ISR. |
caoyuan9642 | 0:6cb2eaf8b133 | 213 | * Call stop of the Axis objects and wait until they are stopped. |
caoyuan9642 | 0:6cb2eaf8b133 | 214 | * @note This function can be called from any context (including ISR) to perform a soft stop of the mount |
caoyuan9642 | 0:6cb2eaf8b133 | 215 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 216 | void stopSync(); |
caoyuan9642 | 0:6cb2eaf8b133 | 217 | |
caoyuan9642 | 0:6cb2eaf8b133 | 218 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 219 | * Get current equatorial coordinates |
caoyuan9642 | 0:6cb2eaf8b133 | 220 | * @return current equatorial coordinates |
caoyuan9642 | 0:6cb2eaf8b133 | 221 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 222 | const EquatorialCoordinates &getEquatorialCoordinates() |
caoyuan9642 | 0:6cb2eaf8b133 | 223 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 224 | updatePosition(); |
caoyuan9642 | 0:6cb2eaf8b133 | 225 | return curr_pos_eq; |
caoyuan9642 | 0:6cb2eaf8b133 | 226 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 227 | |
caoyuan9642 | 0:6cb2eaf8b133 | 228 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 229 | * Get current mount coordinates |
caoyuan9642 | 0:6cb2eaf8b133 | 230 | * @return current mount coordinates |
caoyuan9642 | 0:6cb2eaf8b133 | 231 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 232 | const MountCoordinates &getMountCoordinates() |
caoyuan9642 | 0:6cb2eaf8b133 | 233 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 234 | updatePosition(); |
caoyuan9642 | 0:6cb2eaf8b133 | 235 | return curr_pos; |
caoyuan9642 | 0:6cb2eaf8b133 | 236 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 237 | |
caoyuan9642 | 0:6cb2eaf8b133 | 238 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 239 | * Make an alignment star object using the provided reference star, current mount position, and current time |
caoyuan9642 | 0:6cb2eaf8b133 | 240 | * @param star_ref Reference star position |
caoyuan9642 | 0:6cb2eaf8b133 | 241 | * @return AlignmentStar object representing the alignment star |
caoyuan9642 | 0:6cb2eaf8b133 | 242 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 243 | AlignmentStar makeAlignmentStar(const EquatorialCoordinates star_ref) |
caoyuan9642 | 0:6cb2eaf8b133 | 244 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 245 | updatePosition(); |
caoyuan9642 | 0:6cb2eaf8b133 | 246 | return AlignmentStar(star_ref, curr_pos, clock.getTime()); |
caoyuan9642 | 0:6cb2eaf8b133 | 247 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 248 | |
caoyuan9642 | 0:6cb2eaf8b133 | 249 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 250 | * Align the current mount using an array of alignment stars. Support up to 10 stars. |
caoyuan9642 | 0:6cb2eaf8b133 | 251 | * @note If n=1, will only correct for Index offset |
caoyuan9642 | 0:6cb2eaf8b133 | 252 | * If n=2, will correct for index offset and polar misalignment |
caoyuan9642 | 0:6cb2eaf8b133 | 253 | * If n>=3, will correct for index offset, pa misalignment and cone error |
caoyuan9642 | 0:6cb2eaf8b133 | 254 | * @param n # of alignment stars to use |
caoyuan9642 | 0:6cb2eaf8b133 | 255 | * @param as Array of alignment stars |
caoyuan9642 | 0:6cb2eaf8b133 | 256 | * @return osOK if successfully converged and updated the values |
caoyuan9642 | 0:6cb2eaf8b133 | 257 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 258 | osStatus align(int n, const AlignmentStar as[]); |
caoyuan9642 | 0:6cb2eaf8b133 | 259 | |
caoyuan9642 | 0:6cb2eaf8b133 | 260 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 261 | * Set slew rate of both axis |
caoyuan9642 | 0:6cb2eaf8b133 | 262 | * @param rate new speed |
caoyuan9642 | 0:6cb2eaf8b133 | 263 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 264 | void setSlewSpeed(double rate); |
caoyuan9642 | 0:6cb2eaf8b133 | 265 | double getSlewSpeed(); |
caoyuan9642 | 0:6cb2eaf8b133 | 266 | |
caoyuan9642 | 0:6cb2eaf8b133 | 267 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 268 | * Set tracking speed of RA axis |
caoyuan9642 | 0:6cb2eaf8b133 | 269 | * @param rate new speed in sidereal rate |
caoyuan9642 | 0:6cb2eaf8b133 | 270 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 271 | void setTrackSpeedSidereal(double rate); |
caoyuan9642 | 0:6cb2eaf8b133 | 272 | double getTrackSpeedSidereal(); |
caoyuan9642 | 0:6cb2eaf8b133 | 273 | |
caoyuan9642 | 0:6cb2eaf8b133 | 274 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 275 | * Set guiding speed of RA axis |
caoyuan9642 | 0:6cb2eaf8b133 | 276 | * @param rate new speed in sidereal rate |
caoyuan9642 | 0:6cb2eaf8b133 | 277 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 278 | void setGuideSpeedSidereal(double rate); |
caoyuan9642 | 0:6cb2eaf8b133 | 279 | double getGuideSpeedSidereal(); |
caoyuan9642 | 0:6cb2eaf8b133 | 280 | |
caoyuan9642 | 0:6cb2eaf8b133 | 281 | /** |
caoyuan9642 | 0:6cb2eaf8b133 | 282 | * Print current position to STDOUT. Should call updatePosition to update the current position |
caoyuan9642 | 0:6cb2eaf8b133 | 283 | */ |
caoyuan9642 | 0:6cb2eaf8b133 | 284 | void printPosition(FILE *stream = stdout) |
caoyuan9642 | 0:6cb2eaf8b133 | 285 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 286 | fprintf(stream, "Mount: RA=%7.2f, DEC=%7.2f %c\n", curr_pos.ra_delta, |
caoyuan9642 | 0:6cb2eaf8b133 | 287 | curr_pos.dec_delta, |
caoyuan9642 | 0:6cb2eaf8b133 | 288 | (curr_pos.side == PIER_SIDE_WEST) ? 'W' : 'E'); |
caoyuan9642 | 0:6cb2eaf8b133 | 289 | fprintf(stream, "EQ: RA=%7.2f, DEC=%7.2f\n", curr_pos_eq.ra, |
caoyuan9642 | 0:6cb2eaf8b133 | 290 | curr_pos_eq.dec); |
caoyuan9642 | 0:6cb2eaf8b133 | 291 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 292 | |
caoyuan9642 | 0:6cb2eaf8b133 | 293 | void updatePosition(); |
caoyuan9642 | 0:6cb2eaf8b133 | 294 | |
caoyuan9642 | 0:6cb2eaf8b133 | 295 | UTCClock& getClock() const |
caoyuan9642 | 0:6cb2eaf8b133 | 296 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 297 | return clock; |
caoyuan9642 | 0:6cb2eaf8b133 | 298 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 299 | |
caoyuan9642 | 0:6cb2eaf8b133 | 300 | const LocationCoordinates& getLocation() const |
caoyuan9642 | 0:6cb2eaf8b133 | 301 | { |
caoyuan9642 | 0:6cb2eaf8b133 | 302 | return location; |
caoyuan9642 | 0:6cb2eaf8b133 | 303 | } |
caoyuan9642 | 0:6cb2eaf8b133 | 304 | |
caoyuan9642 | 0:6cb2eaf8b133 | 305 | }; |
caoyuan9642 | 0:6cb2eaf8b133 | 306 | |
caoyuan9642 | 0:6cb2eaf8b133 | 307 | #endif /*EQUATORIALMOUNT_H_*/ |
caoyuan9642 | 0:6cb2eaf8b133 | 308 |