https://bugs.kde.org/show_bug.cgi?id=400128
Bug ID: 400128 Summary: Ekos plate solving angle difference doesn't normalize for 360 degrees Product: kstars Version: unspecified Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: mutla...@ikarustech.com Reporter: hymu...@gmail.com Target Milestone: --- SUMMARY I downloaded and compiled and am running KStars -- I believe I grabbed it on Sept 24, and when I run it it says it is version 3.0.0. In kstars/ekos/align.cpp in the method Align::solverFinished(), when determining if the plate solving process might be done, the code computes an angle difference between the target position (e.g. double raDiff = ...; double decDiff = ...;) This difference does not take into account the fact that angles repeat every 360 degrees, and thus the difference between 359 and 1 is not 358, but rather 2 degrees. [Further, angles there are not limited to the range of 0-360--e.g. I saw an angle of 370 degrees when looking into this--though this in itself may not cause a problem]. The lack of normalization of the angle difference can cause the plate solver to never complete. So solve this, you could, e.g. define the function normalizeAngleDiff(double, double) shown below, and replace these (buggy) lines (taken from Align::solverFinished() double raDiff = (alignCoord.ra().Degrees() - targetCoord.ra().Degrees()) * 3600; double deDiff = (alignCoord.dec().Degrees() - targetCoord.dec().Degrees()) * 3600; with something like this: double raDiff = normalizedAngleDiff( alignCoord.ra().Degrees(), targetCoord.ra().Degrees()) * 3600; double deDiff = normalizedAngleDiff( alignCoord.dec().Degrees(), targetCoord.dec().Degrees()) * 3600; Here's an implementation for a normalizedAngleDiff function: // Computes the difference of two angles (in degrees), taking into account // the fact that angles repeat every 360 degrees. double normalizedAngleDiff(double degrees1, double degrees2) { double angleDiff = degrees1 - degrees2; // Put in the range of [-360,360] while (angleDiff > 360) { angleDiff -= 360; } while (angleDiff < -360) { angleDiff += 360; } if (angleDiff > 180) { // angleDiff in the range [180,360] return 360 - angleDiff; } else if (angleDiff < -180) { // angleDiff in the range [-360,-180] return -(360 + angleDiff); } else { // angleDiff in the range [-180,180] return angleDiff; } } You likely also have this same problem elsewhere in the file--e.g. where you implement astrometryDifferentialSlewing. To reproduce this, you need to e.g. set the plate solve solution (alignCoord) and the target (targetCoord) to e.g. 0.001 and 359.999. This is a real issue, not theoretical. Happened to me while tracking/aligning last night. Aligner had solved the problem, but still thought it was far off. It output the following: org.kde.kstars.ekos.align: "Solution coordinates: RA (00h 43m 48s) DEC ( 41° 22' 11\") Telescope Coordinates: RA (00h 43m 48s) DEC ( 41° 22' 23\")" org.kde.kstars.ekos.align: "Target is within 359° 59' 53\" degrees of solution coordinates." -- You are receiving this mail because: You are watching all bug changes.