File indexing completed on 2024-05-12 15:23:41
0001 /* 0002 SPDX-FileCopyrightText: 2020 Hy Murveit <hy@murveit.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "vect.h" 0010 #include "indi/indicommon.h" 0011 #include "MPI_IS_gaussian_process/src/gaussian_process_guider.h" 0012 #include "ekos_guide_debug.h" 0013 class GuideStars; 0014 class GaussianProcessGuider; 0015 class Calibration; 0016 0017 // This is a wrapper class around the GaussianProcessGuider contributed class 0018 // to make integration with EKos easier. 0019 class GPG 0020 { 0021 public: 0022 GPG(); 0023 ~GPG() {} 0024 0025 // Reads parameters from Options, and updates the GPG. 0026 void updateParameters(); 0027 0028 // Restarts the gpg. 0029 void reset(); 0030 0031 // Should be called when dithering starts. 0032 // Inputs are pixel offsets in camera coordinates. 0033 void startDithering(double dx, double dy, const Calibration &cal); 0034 0035 // Should be called after dithering is done. 0036 // Indicated whether dithering settled or not. 0037 void ditheringSettled(bool success); 0038 0039 // Should be called while suspended, at the point when 0040 // guiding would normally occur. GPG gets updated but does not 0041 // emit a pulse. 0042 void suspended(const GuiderUtils::Vector &guideStarPosition, 0043 const GuiderUtils::Vector &reticlePosition, 0044 GuideStars *guideStars, 0045 const Calibration &cal); 0046 0047 // Compute the RA pulse for guiding. 0048 // Returns false if it chooses not to compute a pulse. 0049 bool computePulse(double raArcsecError, GuideStars *guideStars, 0050 int *pulseLength, GuideDirection *pulseDir, 0051 const Calibration &cal, Seconds timeStep); 0052 0053 double predictionContribution(); 0054 0055 0056 // Compute dark guiding RA pulse. 0057 // Returns false if it chooses not to compute a pulse. 0058 bool darkGuiding(int *pulseLength, GuideDirection *pulseDir, 0059 const Calibration &cal, Seconds timeStep); 0060 0061 private: 0062 std::unique_ptr<GaussianProcessGuider> gpg; 0063 int gpgSamples = 0; 0064 int gpgSkippedSamples = 0; 0065 // Converts the gpg output to pulse milliseconds 0066 double convertCorrectionToPulseMilliseconds(const Calibration &cal, int *pulseLength, GuideDirection *pulseDir, const double gpgResult); 0067 };