Solved Sync Home Position Programmatically

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
09 Mar 2023 17:11 #1129 by Samuel
Sync Home Position Programmatically was created by Samuel
Hello,

is there any way to "Sync Home Position" programmatically, e.g. via ASCOM? I wouldn't mind writing a little ASCOM client/script myself.

Some more context: My rig is not permanent, hence I would like to be able to automate this part as I always set up my M-Uno in the CWD position anyways. I use Voyager which takes care of starting and connecting all my devices and I would like to do the same with my M-Uno and "Sync Home Position".

Thanks and best regards,
Samuel

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

More
14 Mar 2023 16:07 - 14 Mar 2023 16:09 #1130 by Schaefer
Replied by Schaefer on topic Sync Home Position Programmatically
Hi Samuel,
I think it is basically just syncing the scope to the celestial north pole. So DEC will be 90 degree and RA can be derived from the local siderial time available from the mount. In CWD position you would need to add 6hrs to it and makes sure to not exceed 24h.
In ASCOM using JScript it could be done like this (no error checking, so the mount should be powered on and connected to your PC and of course be in CWD position);
You can run the script using cscript.exe. No guarantee of course that it actually works and will not brick your mount

var T = new ActiveXObject("ASCOM.AvalonStarGo.NET.Telescope");
T.Connected = true;
T.Tracking = true;
var RA = (T.SiderealTime + 6) % 24;
var DEC = 90;
T.SyncToCoordinates(RA, DEC);
T.Connected = false;


Regards,
Stephan
 
Last edit: 14 Mar 2023 16:09 by Schaefer.

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

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
15 Mar 2023 17:38 - 16 Mar 2023 08:07 #1131 by Samuel
Replied by Samuel on topic Sync Home Position Programmatically
Hi Stephan,

that's great, thank you!

I think I'll make a tiny .NET app from this with proper error checking and so on.

I also noticed that SideOfPier seems to be -1 ("Unknown") until the mount is aligned, so I'll use that to first make sure that the mount wasn't already aligned and also to then afterwards ensure that the alignment was successful.

Regards,
Samuel
Last edit: 16 Mar 2023 08:07 by Stefano82.

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

More
16 Mar 2023 11:17 #1132 by Schaefer
Replied by Schaefer on topic Sync Home Position Programmatically
Hi Samuel,
when playing with it I also found some strange behaviour of the Avalon driver in reaction to the sync command. For instance if you request the current position (RA/DEC) immediately after the sync call returns, it still reports the old position. Only after several seconds it returns the updated value.
I would have expected that upon return from that request, everything has finished, as there is no official way to check if the sync was completed or not. The method is not flagged as being asynchronous, like some of the Slew methods where you can check if it has finished or not.
I also looked at the SideOfPier property and I think it also took a while to be updated, but I'm not sure. Anyway, I think finding ways to check if that call has finished successfully are kind of a hack and should not be necessary if the driver would only return from the command once it is completely done and all internal positions are properly updated. May be Avalon can explain this behavior or explain how to detect if a mount is aligned or not. StarGo needs to do that check, as it indicates it in the user interface. So there must be an 'official' way...

Regards,
Stephan

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

More
14 Jun 2023 10:45 #1186 by Peter_S
Replied by Peter_S on topic Sync Home Position Programmatically
Hi Samuel & Stephan,
I have the same problem (had weird slews because of ?random?  misaligning) and am writing with Ivo of APT in the APT forum. I quoted this thread here -
are there any updates concerning a script "SYNC TO HOME POSITION"?
thanks
Peter

M Uno, M Zero, Esprit APO ED 100, Lacerta MoFoc,
C8 EHD, Lacerta f4 Foto Newton + MoonLite LiteCrawler/Rot., MGEN III, W10 64 Mini-PC,

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

  • Samuel
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
14 Jun 2023 12:21 #1187 by Samuel
Replied by Samuel on topic Sync Home Position Programmatically
Hi Peter,
I've been using my script (derived from Stephan's) for a few times now and so far it has worked reliably.
You can find the source code and a pre-compiled binary here: github.com/TheCyberBrick/Mount-Initializer
To use it you need to have the .NET Framework 4 installed and of course also the ASCOM Platform.
In the README you'll find the command I'm using to automatically set up my M-Uno. First it checks whether the mount was not yet synced since power-on (to prevent accidentally syncing multiple times) and then does a "Sync Home Position". Afterwards it does some sanity checks to ensure that the mount really is in the desired state.

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