×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

AlignmentSubsystemForDrivers

  • Posts: 216
  • Thank you received: 120
I'm trying to implement the AlignmentSubsystemForDrivers for a telescope driver I'm working on, but I seem to not quite understand how to work with it.

To test things out, I'm making a few assumptions that may or may not be correct, so I'd like some help understanding it if possible.

The main assumption I'm making is that if I do all syncs as perfect syncs (actual RA/Dec is what we thought we were at), then when calculating the RA/Dec for a GOTO should be exactly the same as the original target RA/Dec.

Sync:
    INDI::AlignmentSubsystem::AlignmentDatabaseEntry NewEntry;
    struct ln_equ_posn RaDec;
    RaDec.ra = (ra * 360.0) / 24.0; // normally, this would be the ra/dec the mount thinks it's at, but for testing, use the same value as what we received
    RaDec.dec = dec;
    NewEntry.ObservationJulianDate = ln_get_julian_from_sys();
    NewEntry.RightAscension = ra;
    NewEntry.Declination = dec;
    NewEntry.TelescopeDirection = TelescopeDirectionVectorFromEquatorialCoordinates(RaDec);
    NewEntry.PrivateDataSize = 0;
 
    if (!CheckForDuplicateSyncPoint(NewEntry))
    {
        GetAlignmentDatabase().push_back(NewEntry);
        UpdateSize();
        Initialise(this);
        ReadScopeStatus();
    }

Slew:
        INDI::AlignmentSubsystem::TelescopeDirectionVector TDV;
        ln_equ_posn RaDec; // Decimal Degrees for RA and Dec
 
        // ra is decimal hours
        if (TransformCelestialToTelescope(ra, dec, 0, TDV))
        {
            // The alignment subsystem has successfully transformed my coordinate
            EquatorialCoordinatesFromTelescopeDirectionVector(TDV, RaDec);
 
            targetRa = (RaDec.ra * 24.0) / 360.0; // convert to decimal hours
            targetDec = RaDec.dec;
        }

Since I am making a "perfect" sync every time, I would expect targetRa and targetDec to match ra and dec in my slew calculation, but they don't.

As I said, I'm sure I just misunderstand how to use this, but any help would be greatly appreciated.
3 years 3 months ago #65055

Please Log in or Create an account to join the conversation.

I presume you checked out the documentation here: www.indilib.org/api/md_libs_indibase_ali...ent_white_paper.html

There are multiple plugins to handle this, and by default "Basic Math Plugin" is utilized.
3 years 3 months ago #65057

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
Yeah, I looked through that and the whitepaper committed to the repo. I'm still missing something apparently.
3 years 3 months ago #65058

Please Log in or Create an account to join the conversation.

I can't say I fully understand the alignment sub system either, but a single sync point, how off are the alignment results from yours?
3 years 3 months ago #65060

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
Dec is really close, just off by a few seconds, which might just be rounding errors somewhere. RA is off by minutes. To debug, I also added a number field to the driver to show both what the mount thinks RA/Dec are, and what the alignment subsystem thinks they are. Immediately after a sync they match up, but the alignment subsystem's RA is slowly changing (even though I'm tracking) when the mount's RA is holding steady. It feels like it's using an hour angle instead of ra somewhere. I'll keep digging into it. If I manage to get it working, I'll try to draw up some additional documentation.
3 years 3 months ago #65062

Please Log in or Create an account to join the conversation.

  • Posts: 64
  • Thank you received: 9
If I do the following steps:
1.
       // set mount type to alignment subsystem
        SetApproximateMountAlignmentFromMountType(EQUATORIAL);
        // tell the alignment math plugin to reinitialise
        Initialise(this);
2. manually move the scope to HA/Dec 0/0
3. SYNC to 0/0
4. slew HA from 0 to -3h with arrows.
5. slew Dec upward with goto.
At point 5 I see the scope Dec axis slewing upward as requested, but at the same time the HA axis rotates CCW. It seems that the scope believes to be altazimuth mounted and the HA rotation is needed to follow an equatorial meridian (dec only slew) that is tilted with respect to the horizontal plane (I set latitude to 45 deg).
3 years 3 months ago #65094

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
To make things easier to discuss, I created a fork of the main indi repo and started adding tests for the alignment subsystem:

github.com/rickbassham/indi/blob/test/al...t/test_alignment.cpp

The Test_ThreeSyncPoints test succeeds if we check the alignment with accuracy down to 2 decimal places, but fails at 3 decimal places.
3 years 3 months ago #65100

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
to run the tests from the repo root:
sudo apt install libgmock-dev libgtest-dev
 
git checkout test/alignment_subsystem
 
mkdir -p build/indi
cd build/indi
cmake -DINDI_BUILD_UNITTESTS=ON -DCMAKE_BUILD_TYPE=Debug ../../indi
make
cd test
 
ctest -V -R test-alignment
3 years 3 months ago #65101

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
Okay, so I just pushed up a change to the test that seems much more stable. The accuracy is still off from what I would expect, but the values don't seem to change over time, which is a plus.

The main change is to use the HourAngle versions of the TDV functions.
TelescopeDirectionVectorFromLocalHourAngleDeclination

The Equatorial versions don't seem to work that well.
3 years 3 months ago #65105

Please Log in or Create an account to join the conversation.

  • Posts: 216
  • Thank you received: 120
Fabrizio, I think I've successfully added the alignment subsystem to my CGX driver (eventually I want to bring all this into your celestron_aux driver, but wanted to do my own testing and playing separately until I could get it working). It seems to work when bench testing locally, but a night under the stars will really tell.

github.com/rickbassham/indi-celestron-cgx/pull/1/files
github.com/rickbassham/indi-celestron-cg.../alignment_subsystem

The trick as I said above is avoiding the Equatorial functions. They don't seem to work well. The HourAngle functions seem to work fine.
The following user(s) said Thank You: Jasem Mutlaq, Fabrizio, Jim S.
3 years 3 months ago #65116

Please Log in or Create an account to join the conversation.

  • Posts: 64
  • Thank you received: 9
Rick, that's great! I will look forward to your results with great interest.
3 years 3 months ago #65117

Please Log in or Create an account to join the conversation.


That's awesome! Great to know! Did you find out exactly what's behind the equatorial function issues? Is there something we need to do about this? Might as well fix all the issues of the alignment subsystem if it is possible.
3 years 3 months ago #65123

Please Log in or Create an account to join the conversation.

Time to create page: 0.951 seconds