Save and Restore Internal Guider Calibrations. Tests. Refactor Calibration Code.
Added the (optional) ability to the internal guider to save and restore its calibration so that the user does not need to recalibrate every time they slew or meridian flip, or even on a new guiding session.
It may be that a well done calibration that is saved across session would lead to better guiding than recalibrating (quickly) every session.
There are two important new user-parameters set in the Guider options menu:
- checkbox to re-use guiding calibration if one is available.
- checkbox to decide if DEC is reversed on pier-side change when reusing calibration. This latter bool is a characteristic of the mount, and must be determined by the user. Also modified the calibration options menu to add the current calibration values. Here's a picture of the new menu window: https://photos.app.goo.gl/Mrm6rdYEQDnDohKy8
Continued my refactor of the internal guider. Moved the calibration estimation code into the Calibration class. At this point almost all of the calibration calculations are in that class and are tested in the unit test. Its variables (e.g. ROT_Z) are hidden from the rest of the code, to facilitate testing and future experimentation. The main remaining calibration-related item not yet refactored is the state-machine that orchestrates the calibraiton. It too could be refactored and tested, but that's for another day.
Main changes are in calibration.cpp/h
- import code to compute the calibration from gmath.cpp
- compute RA/DEC drift given two image positions
- serialize and read-back the calibration
- modify calibration for the other pier side
- adjust RA pulse rate based on the guide and current declinations.
- Extensive unit testing for the Calibration class.
kstars/ekos/guide/guideinterface.cpp kstars/ekos/guide/guideinterface.h kstars/ekos/mount/mount.cpp kstars/ekos/mount/mount.h
- Plumbing to allow pier side to the internal guider.
kstars/ekos/guide/guide.cpp/h kstars/ekos/guide/internalguide/gmath.cpp/h kstars/ekos/guide/internalguide/internalguider.cpp/h refactoring, moving code to calibration.cc/h
- Support for restoring the calibration.
- two new checkboxes and new display for the current calibration values.
- removed a problematic line (at the end of the file) that sets the reticle. This has set that reticle on me several times when I set other parameters.
- two new checkboxes and serialized calibration storage
- Could someday have a way to store multiple calibrations, or calibrations for different configuration. This is not part of this MR. I think we should start simple, and extend if necessary.
- Calibration is stored in a kstars.kcfg option variable. Seems to work well!
You can start testing this using the simulator as follows.
Start up EKOS with the internal guider.
Move the simulated telescope position away from the pole (so that guiding can work)
In the guider's options menu, select Calibration, and
uncheck "Reset Guide Calibration After Each Mount Slew"
check "Store and re-use guide calibration when possible"
check "Reverse DEC on pier-side change when reusing calibration" The latter check is needed with the simulator. If you test with a telescope/mount, you need to experiment to find the right value--wrong value will have a DEC run-off when using a calibration computed on one side of the pier for the other side.
At this point start guiding. Assuming you don't have a stored calibration, it should calibrate and the start guiding.
You can then slew the telescope elsewhere, and click guide again, and
it should start up without calibration. This would apply anywhere (even on the other side of the meridian).
Repeat. Again, guiding doesn't work very close to the pole, so testing there won't prove much.
Can simulate a meridian flip. That should also pick up guiding without calibration.
You can turn off KStars and restart, and guiding should be able to start-up without calibration.
If you clear the calibration, then it should re-calibrate on the next start of guiding.
You can see the current calibration values in the Guide Options menu under Calibration (if you haven't cleared them).
When testing with a telescope, it's a good idea to have your stored calibration done well, near the meridian and equator, but not absolutely necessary.
Of course, you should recalibrate if the optics rotate relative to the telescope.