Meridian Flip, a thought experiment

Forum dedicated to INDIGO Script know-how exchange
JohanB
Posts: 268
Joined: Thu Apr 21, 2016 5:55 pm

Meridian Flip, a working script

Post by JohanB »

Hi all,

Even though Peter is building a better solution for server side Plate Solving, i made the script working on the client side anyway; it was a good exercise in scripting :-)

Peter made a new build of AI for this, that contains the driver for the scripting agent; http://download.cloudmakers.eu/AstroImager_4.0_555.dmg
The MeridianFlip script runs on the client side in the AI Scripting Agent, so you need this AI version for it.

The script:
MeridianFLip_AI.js
(9.55 KiB) Downloaded 28 times
The output of the script:

21:17:04.282 Meridian flip: Script started, monitoring commences...
21:17:09.271 Meridian flip: Monitoring
21:17:14.274 Meridian flip: Slew initiated...
21:17:14.522 Slewing...
21:17:14.523 Slewing...
21:17:14.524 Guiding finished
21:17:14.625 Batch 1 failed
21:17:14.625 Sequence failed
21:17:59.554 Performing accurate HA slew...
21:18:01.777 HA slew complete.
21:18:04.085 Tracking started.
21:18:04.183 DEC slew complete.
21:18:04.272 Performing accurate DEC slew...
21:18:04.702 DEC slew complete.
21:18:04.703 Slew complete.
21:18:04.703 Meridian flip: Slew complete
21:18:04.704 Meridian flip: Preview initiated
21:18:04.926 Meridian flip: Preview in progress...
21:18:15.107 Meridian flip: Preview complete
21:18:15.107 Meridian flip: Plate solve initiated
21:18:15.109 Meridian flip: Plate solve in progress...
21:18:25.271 Meridian flip: Plate solve complete
21:18:25.271 Meridian flip: Sync & Center initiated
21:18:25.444 Slewing...
21:18:25.445 Slewing...
21:18:43.014 Performing accurate HA slew...
21:18:43.214 HA slew complete.
21:18:47.096 Tracking started.
21:18:47.214 DEC slew complete.
21:18:47.327 Performing accurate DEC slew...
21:18:47.686 DEC slew complete.
21:18:47.687 Slew complete.
21:18:47.687 Meridian flip: Sync & Center completed
21:18:47.687 Meridian flip: Calibration intiated
21:18:47.754 Calibration started
21:18:48.736 Clearing DEC backlash
21:18:53.254 Clearing RA backlash
21:18:56.826 Backlash cleared
21:18:57.757 Moving north
21:19:16.588 Moving south
21:19:33.585 Moving west
21:19:54.214 Moving east
21:20:12.079 Calibration done
21:20:12.112 Meridian flip: Calibration completed
21:20:12.113 Meridian flip: Resume guiding
21:20:12.181 Meridian flip: Waiting for guiding to settle
21:20:12.181 Meridian flip: Guiding settled down
21:20:12.182 Meridian flip: Resume imaging sequence
21:20:12.182 Meridian flip: Flip completed!
21:20:12.182 Guiding started

It was tested with the AZ-EQ6, CCD Simulator, CCD Guider simulator. It can not be tested with Mount Simulator, since this driver has no Mount_side_of_pier property :-(

Here is how it was tested:

Enable Scripting Agent in (the v4 build 555 of) AI (preferences -> Indigo Drivers -> Scripting Agent)

Start indigo_server on the RPi (or use the web interface on IndigoSky to minimally select the drivers listed here):
- indigo_server -v indigo_agent_guider indigo_agent_mount indigo_agent_imager indigo_mount_synscan indigo_ccd_simulator

Start Astrometry on the mac:
- Select Tycho-2 index-4107 (needed to solve the CCD Simulator image of Rosette)

Start AI:
- Agent -> Imager Agent
- CCD -> CCD Simulator
- Related mount agent set
- Related guider agent set
- Take single preview
- Plate solve preview in AI (to test indexes)
- - Use local service
- - Turn convert to JPEG OFF (doesn’t work very well with the simulator image for some reason)
- - Test plate solve
- Setup a sequence (has to keep running for minimally the duration of the test..)
- Start Sequence

Start AT:
- Agent -> Mount Agent
- Mount -> Mount Synscan (with real EQ6, no scope(!!) The mount may go everywhere...)
- Related imager agent set
- Related guider agent set
- Delete any existing alignment point via control panel

Start AG:
- Agent -> Mount Agent
- CCD -> CCD Guider Simulator
- Guider -> CCD Guider Simulator
- Select “Donuts”
- Calibrate and start guiding

Start Indigo Script Editor:
- Select “AstroImager”
- New script -> “Set”
- Copy MeridianFlip_AI script -> “Set”
- Change “var server_suffix” on the first line of the script to match your RPi Server name, e.g. “ @ IndigoSky” (note the leading space)

In AT, select a star (any) just left of the meridian and slew there (HA must still be under 23:59).
Next, lookup Rosette and select it, but do not slew there (this were the plate solve of the preview will sync to)
Execute script!
Wait for the HA to be past 00:00...

NOTE1:
The sync & Center in this test setup upsets AT/Synscan behaviour. After deleting the alignment point, all is normal again.
I assume this is because of a “random” position on the other side of the meridian, is being synced to Rosette.
This will have to proof itself under the sky, but this may take another few months give past experience :-)

NOTE2:
On two occasions (of many) i had AstroMetry report a conversion error while converting a xsif format to fits format.
Not sure why. I selected fits as output format in AI to avoid conversion.

NOTE3:
The script is not very defensively programmed yet and assumes a LOT (Sequence setup, all running, related agents set, etc.) :-)

Any feedback is welcome! Have fun!

Regards, Johan
Last edited by JohanB on Thu Jan 07, 2021 10:27 pm, edited 5 times in total.
User avatar
aaron
Posts: 114
Joined: Thu Apr 09, 2020 11:47 pm
Location: Upstate New York, US
Contact:

Re: Meridian Flip, a thought experiment

Post by aaron »

Johan this is fantastic. Looking forward to testing shortly!!
JohanB
Posts: 268
Joined: Thu Apr 21, 2016 5:55 pm

Re: Meridian Flip, a thought experiment

Post by JohanB »

Noticed a minor bug in the GUIDING_handler event handler; had misplaced a bracket. Fixed in the attached file;
MeridianFLip_AI.js
(9.57 KiB) Downloaded 36 times
Regards, Johan
rumen
Posts: 156
Joined: Wed Feb 22, 2017 7:31 pm

Re: Meridian Flip, a thought experiment

Post by rumen »

i am impressed :)
JohanB
Posts: 268
Joined: Thu Apr 21, 2016 5:55 pm

Re: Meridian Flip, a thought experiment

Post by JohanB »

Thnx Rumen, it was good fun to build! It started slowly and took some getting used to the event based approach, but after a while things sped up as the understanding of the scripting language and the indigo inner workings grew. Scripting has huge potential; you can make what ever you need on the platform! :D
rumen
Posts: 156
Joined: Wed Feb 22, 2017 7:31 pm

Re: Meridian Flip, a thought experiment

Post by rumen »

Yes it is really nice! I like it a lot! And so far you are the one who writes the most complex scripts :) What comes to event based approach - INDIGO is all about events as it is fully asynchronous...
User avatar
aaron
Posts: 114
Joined: Thu Apr 09, 2020 11:47 pm
Location: Upstate New York, US
Contact:

Re: Meridian Flip, a thought experiment

Post by aaron »

Clear skies, and I'm testing the script. I hope it doesn't smash my scope. Wish me luck!

Edit: The HA Limit was reached and the mount parked before the script noticed anything. I guess I'm confused how the script is supposed to work with an HA Limit...?
JohanB
Posts: 268
Joined: Thu Apr 21, 2016 5:55 pm

Re: Meridian Flip, a thought experiment

Post by JohanB »

Hi Aaron,

Not sure what happened; did you have a HA limit configured in the mount agent configuration? (other than 24:00:00). If so, maybe the standard agent functionality acted just ahead of the script and parked the mount.

In order for the script to work, the HA limit in agent settings should be 24:00:00, so the mount agent doesn't park. The script logic is to check whether the mount is at the East side of pier, while the HA is switching from 23:59->00:00, i.e. when the mount crosses the meridian.

Regards, johan
User avatar
aaron
Posts: 114
Joined: Thu Apr 09, 2020 11:47 pm
Location: Upstate New York, US
Contact:

Re: Meridian Flip, a thought experiment

Post by aaron »

Ah thanks. I did have a smaller limit set. I need that limit, to prevent my filter wheel from crashing into my tripod. I'll take a look at the script to see if I can make it work with the user-defined limit.
JohanB
Posts: 268
Joined: Thu Apr 21, 2016 5:55 pm

Re: Meridian Flip, a thought experiment

Post by JohanB »

Hi Aaron,

That should be fairly easy;

In the first function "function test_hour_angle()", there is this line;

if ( east_of_pier && hour_angle < 12 && !flip_in_progress) {

It now checks for the HA to flip from 23:59 to 00:00 (which would make it smaller than 12). If would want to flip earlier, like when HA is larger than 23:30, this line would have to be something like (where part behind the dot of the HA value is a decimal hour, as in 0.5 for 00:30:00);

if ( east_of_pier && hour_angle > 23.5 && !flip_in_progress) {

You have to set the agent controlled HA_Limit to 24:00:00 to deactivate it and you have to watch the mount very close and carefully to not loose your filter wheel :-D

Regards, Johan
Post Reply