AstroImager autofocus failure stops a Sequence

Questions, bug reports, requests for enhancements, etc.
User avatar
elmore
Posts: 79
Joined: Tue Dec 04, 2018 2:34 am

Re: AstroImager autofocus failure stops a Sequence

Post by elmore »

Thanks Peter, in the new versions I see the new dialogue (in Imaging Agent as well).
Next good night I'll give this a try.
User avatar
elmore
Posts: 79
Joined: Tue Dec 04, 2018 2:34 am

Re: AstroImager autofocus failure stops a Sequence

Post by elmore »

Set up a sequence with 3 filters, and autofocus at each.
The first cycle through the three filters came to correct focus at each.
The second cycle failed on the first filter. There was a message that focus failed and 'restoring initial position'. The focus position that was restored was far away from any position encountered in the autofocus runs, so far out of focus the autofocus routine did not come to a focus at all, though it reported 'autofocus finished' and went on to the next filter. Again it was so far out of focus that it did not converge, yet reported 'autofocus finished' and continued on. The sequence was manually stopped at this point.

Summary: One big problem, restoring initial position moved the focuser far away from any focus it had achieved and was never able to autofocus again.

The log file was too large to upload so the first half was deleted.
Attachments
AstroImager-1634616893_edited.txt
(737.39 KiB) Downloaded 9 times
rumen
Posts: 156
Joined: Wed Feb 22, 2017 7:31 pm

Re: AstroImager autofocus failure stops a Sequence

Post by rumen »

Well, I see some configuration problems as well as some software issues :)
The message "Focusing finished" when it is not in focus is not reached is not correct. I checked the code and it is a bug which i am going to fix.

Also I miss the first part of the log where some initial settings are visible.
So based on FWHM and HFD values I can judge your selection radius to be around 25px, and with your scale 380mm fl on a 3.76um pizel is is 2.04"/px
Which means your system is under sampled and your HFD of a bright star should be several pixels so your selection should not be more than 8px otherwise both HFD and FWHM will be inaccurate and this is clearly seen. FWHM=1px and HFD = 31 while peak value is only 71 counts over the background of 505 counts. Also there is a chance that you have a second star in the selection which will break the metrics. So your selection radius should be way smaller. Try something around 8px.

What comes to 'restoring initial position', I had the suspicion that this may not work well happen as your backlash of 120 steps is significantly larger than the final step of 20 steps. Also there may be some bug in overshoot related to restoring initial position. I will check that and come back you. But in any case you should expect error 120 steps which could be way off... Will check that too.
User avatar
elmore
Posts: 79
Joined: Tue Dec 04, 2018 2:34 am

Re: AstroImager autofocus failure stops a Sequence

Post by elmore »

Thanks for looking into this.

The routine had in fact achieved a good focus when it quit and restored initial value.

In the future with a large log I will include the beginning and end.
Yes you were right I used a very large Radius since I was not having success with a small value such as 8. I will do more testing against Radius.

The 'restored' focusing position was a thousand or more steps off.
User avatar
Peter Polakovic
Posts: 2740
Joined: Thu Apr 21, 2016 9:38 am

Re: AstroImager autofocus failure stops a Sequence

Post by Peter Polakovic »

Just one notice - I changed logging in the recent builds. It is not stored in the memory but in the temporary file and only the last 200 lines is shown in the log pane. So the log can be of any length and it will not slow down the application anymore....
rumen
Posts: 156
Joined: Wed Feb 22, 2017 7:31 pm

Re: AstroImager autofocus failure stops a Sequence

Post by rumen »

elmore wrote: Tue Oct 19, 2021 5:57 pm Thanks for looking into this.

The routine had in fact achieved a good focus when it quit and restored initial value.

In the future with a large log I will include the beginning and end.
Yes you were right I used a very large Radius since I was not having success with a small value such as 8. I will do more testing against Radius.

The 'restored' focusing position was a thousand or more steps off.
The first problem is fixed. It will now correctly report when focus is failed.

And yes, I saw there is some problem with restoring the initial position when backlash is configured :( if BL is zero it works OK. I guess there is some issue with calculating the total offset. We are looking in to this...

About the radius: This radius is way too large for your setup. And if it fails with smaller radius, most likely you were too far from the focus and HFD was not measurable.
rumen
Posts: 156
Joined: Wed Feb 22, 2017 7:31 pm

Re: AstroImager autofocus failure stops a Sequence

Post by rumen »

I think returning to the original position on failure with Peak/HFD is fixed. However it may return to the original position with error of 1 backlash. This is because we do not know if the backlash was cleared or not at start. There is no way around this, unless it is not the first focus run and you are using backlash overshoot which always clears be backlash inwards when finishes.

I need to test it a bit more and Peter will build test binaries.
User avatar
elmore
Posts: 79
Joined: Tue Dec 04, 2018 2:34 am

Re: AstroImager autofocus failure stops a Sequence

Post by elmore »

AstroImager 625.

I was unable to get the RMS Contrast to stick. As soon as I started a sequence or manual autofocus the selection went back to Peak/HFD. I went directly to the indigo server within AstroImager and set RMS contrast in the Imager Agent > Agent and set RMS contrast and saw it became set in AI, but as soon as I manually started autofocus (or ran a sequence with an autofocus) the selection reverted to RMS Contrast.

Focus was on occasion too far off initially for radius of 8 to converge (previously I was using 20). If starting from near focus, 8 was reliable.

There was an autofocus failure shown in the attached log. Focus appeared to be converging to a good focus when the Failed to reach focus, restoring initial position error occurred. The focuser did return to what looked like the initial position.

It would have been better to have been tracking focus quality and gone to the "best" focus.
Attachments
AstroImager-1634616893_edited.txt
(612.93 KiB) Downloaded 6 times
User avatar
Peter Polakovic
Posts: 2740
Joined: Thu Apr 21, 2016 9:38 am

Re: AstroImager autofocus failure stops a Sequence

Post by Peter Polakovic »

I was unable to get the RMS Contrast to stick. As soon as I started a sequence or manual autofocus the selection went back to Peak/HFD.
Hm, it looks like my mistake, it was intended as a temporary security feature :( While RMS contrast is not completely tested, AI should set mode to Peak/HFD before sequence execution, but it looks it does it also for manual execution :(

I'll fix it and rebuild it... Sorry!
Post Reply