×

INDI Library v1.9.7 Released (29 Jul 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

New Focus Algorithm in Ekos

  • Posts: 183
  • Thank you received: 12

I could be wrong, but I thought that the backlash number is not used in the linear process. That is why it moves a large amount outward and then moves inward to eliminate backlash.

However, as I've written before, I'm not sure that the "outward/inward" move is effectively removing the backlash in my setup. I don't know how to prove it, but when EKOS sends the outward command it immediately sends an inward command. Based on simple observation, it feels like the focuser hasn't completed the outward move before receiving (and moving) inward. Therefore, the focuser is not at the expected position when it starts the second pass. Just my humble opinion. I wish there was just a brief pause between commands.

I also would really like to see a single pass process. The second pass never improves my focus point and often confuses the process, causing a redo.

Ron
Mounts: Sky-Watcher EQ6-R Pro, Meade LX85, Celestron NexStar Evolution Alt/Az
OTAs: Celestron 8" Edge HD w/Celestron Focus Motor, Meade 80mm APO Triplet Refractor w/ZWO EAF
Cameras: ASI533MC Pro, ASI183MC Pro, ASI224MC, ASI120MC-S, ZWO ASI290MM
Raspberry Pi 4 with Stellarmate OS, MacBook Pro
2 months 1 week ago #83401

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

  • Posts: 913
  • Thank you received: 121
Two (Edit: Three) things:
The Linear method does not depend on a backlash correction. It tries to overcome that by the first-out-then-in movement. But a BL correction in the driver of the focuser will not be deactivated by it, so it will just see a smaller (or non-existing) BL.

As for your issues, one thing might be to verify what is 'in' and what is 'out'. What actually counts is that the element that moves should move against gravity. For classical refractors and SCTs (etc.) with a focuser in the back that is easy.
With an SCT and the internal mirror focusing that gets reverted, as you have to end the move moving the mirror up, which will move the focus point away from the telescope. And with a Newton, it will depend on where the exit is positioned (and might then even change depending on pointing)

Finishing the move - as mentioned here, try to increase the polling time in the driver. If you set that to, e.g., 2000ms, there should be at least 2s between start of the first move and start of the second move. That would at least prove that (also) your focuser works as expected. Also - have you checked the INDI tab of your focuser? IIRC that one should always report that it has reached the requested position before it accepts new commands.

And of course I agree such a 1-pass is a good idea to help those having issues. It's just that I think most of those issues are not with the algorithm itself, but rather with the setup. And finding out what causes the problem is always a good idea - regardless how you're going to handle it :)
openSUSE Tumbleweed KStars git INDI git
GPDX+EQMOD, CEM60EC, ASI2600/1600/290mini+EFW+EAF
2 months 1 week ago #83403

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

  • Posts: 183
  • Thank you received: 12
Peter,

Thanks for the explanations!

Good to hear on the backlash... as you say, it shouldn't really matter with linear.

On focus with a SCT... I can understand the difficulty with the focusing mechanism. For me, it's all the more reason to keep it simple. First form a good curve on the first pass, then move out a large amount and back to that position.

On the polling time... This may be where I'm having issues. Mine is set at 1,000 ms (1 sec). Based on what I hear when it moves out and then moves in, it is nowhere near a 1 second delay. I'll need to check the messaging to see if it reports reaching the position. Next time, I'll try an exaggerated polling time (like 3,000) to see if I can discern a true delay.

Thanks again!

Ron
Mounts: Sky-Watcher EQ6-R Pro, Meade LX85, Celestron NexStar Evolution Alt/Az
OTAs: Celestron 8" Edge HD w/Celestron Focus Motor, Meade 80mm APO Triplet Refractor w/ZWO EAF
Cameras: ASI533MC Pro, ASI183MC Pro, ASI224MC, ASI120MC-S, ZWO ASI290MM
Raspberry Pi 4 with Stellarmate OS, MacBook Pro
2 months 1 week ago #83404

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

  • Posts: 745
  • Thank you received: 85
What I have found is that if the focuser was already near the best focus point to begin with, then the first pass (linear) calculates the best focus point quickly. The second pass is often worse. I don't know why.

But if the focus was off by a little, then the first one will get very close, but not perfect. Then, a second run of the Autofocus will nail it on the first pass.
But this is different than just letting the autofocus run two passes. With two passes in one run, the results are not consistent. Stopping the autofocus, and then restarting it after that first attempt is always better.

In all cases - the current routine always stops AFTER it detects an increase in HFR, but then uses that incorrect focus point instead of simply moving back to the best calculated spot and using that.

iOptron CEM120 EC2 and CEM25P
Celestron C11 EdgeHD
William Optics Star71
ASI 1600Mm Pro, ASI 462MC
Moonlight motorfocus & Esatto focuser
LodeStar X2 and ZWO OAG
DewBuster
NANO PC-T4
2 months 1 week ago #83406

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

  • Posts: 816
  • Thank you received: 133

Replied by Alfred on topic New Focus Algorithm in Ekos


Peter, you nailed it! This is EXACTLY my experience. The 2nd run always stops too far on the "left side" and doesn't return to the point of best focus.

During the first run a vertical line is shown, together with a numerical focus position. Once the first run is complete, the vertical line and number show the best focus position IMO. Often times, after the first run completed, I just hit the STOP button, enter this number in the "desired absolute focus position" field and move the focuser there by clicking at the "go to an absolute focus position" button. Done!
2 months 1 week ago #83412

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

  • Posts: 92
  • Thank you received: 28

Replied by John on topic New Focus Algorithm in Ekos

Just to be clear Linear1Pass (L1P) is a new focus algorithm, so the existing algorithms will operate unchanged when L1P is released. So those happy with Linear or any of the other algorithms will be able to continue using them as they do now.

Linear starts the 2nd pass by going 2 * Initial Step Size further out than it needs to, to start the 2nd pass, then steps back in 2 * Initial Step Size and starts the second pass. If you have more backlash than this 2 * Initial Step Size then you might see a flat line at the start of the second pass whilst the remaining backlash is "taken up". Linear should be able to deal with this though.

L1P will operate like this if you set the Backlash field to zero. If its > 0 then the step out then in movement will use what you enter in the Backlash field, so you'll have a bit more control over it.

L1P will also compare the HFR prediction from the curve fitting process from pass 1 with the HFR measured after the focuser has moved to the solution (and an extra subframe taken and processed). It will put out a log message comparing the expected vs actual HFR. You will also be able to compare the 2 values on screen (the curve fitting prediction on the graph and the measured HFR in the HFR box under the curve.

Before L1P goes live you could compare these values for the existing algos by doing an Autofocus run and getting the HFR at the optimum focus point and noting the HFR. Then when Autofocus finishes, hit the "take a subframe" button, let the processing complete and see what's in the HFR box at the bottom of the graph. There will be some randomness so the numbers will never match exactly but will give you a feel for whether there's an issue or not.
The following user(s) said Thank You: Peter Sütterlin, colin rooney, Rafa Barberá
2 months 1 week ago #83415

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

  • Posts: 92
  • Thank you received: 28

Replied by John on topic New Focus Algorithm in Ekos

The Linear 1 Pass focus algorithm has been merged into the code base and is now available in the nightly builds so if you are able to take the nightlies then you will be able to give it a go.

I have updated the document detailing the changes. It includes a section with suggestions on how to use it.

This browser does not support PDFs. Please download the PDF to view it: Download PDF



I'd be interested in any feedback. If you find a problem please send a log with "focus" messages enabled.
The following user(s) said Thank You: Spartacus, Bernd Limburg, Doug S, Juergen
1 month 4 weeks ago #83671
Attachments:

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

  • Posts: 380
  • Thank you received: 113

Replied by Doug S on topic New Focus Algorithm in Ekos

Nice work! It will be nice to see this included in the baseline. I've sent you a PM on another focus related subject that might be of interest. CS Doug
RASA11, Celestron CGX-L, ASI183mc Pro, 60mm guider + ASI290mm mini, ASI EAF focuser, PPB, Rpi4-4Gb+SSD, Powered USB3 hub, hardwire Ethernet.
1 month 4 weeks ago #83673

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

  • Posts: 745
  • Thank you received: 85
Does anyone know if this nightly update is available for Mac OSX as well?
EDIT: I just saw that it was indeed included in the latest Mac OSX nightly build. I will test it as soon we get a clear night.
It's monsoon season now here in NM. :(

iOptron CEM120 EC2 and CEM25P
Celestron C11 EdgeHD
William Optics Star71
ASI 1600Mm Pro, ASI 462MC
Moonlight motorfocus & Esatto focuser
LodeStar X2 and ZWO OAG
DewBuster
NANO PC-T4
Last edit: 1 month 4 weeks ago by Peter Kennett.
1 month 4 weeks ago #83677

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

  • Posts: 92
  • Thank you received: 28

Replied by John on topic New Focus Algorithm in Ekos

Hi Peter,

This link is helpful for Mac nightly builds:
indilib.org/forum/ekos/11408-announcing-...-on-macos.html#83666

As you're probably aware the nightlies include the latest versions of s/w which may / may not work. I spent a few minutes with Build #1560 which appears to work from an L1P perspective. The latest version Build #1563 has problems with memory allocation somewhere and won't take any subframes so is unusable. Sure this will be fixed quickly.
1 month 4 weeks ago #83680

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

  • Posts: 37
  • Thank you received: 4

Replied by Sergio on topic New Focus Algorithm in Ekos

Wow, this new algorithm fits perfectly what I was proposing here only 4 months ago (and you also had already in your mind by then) and even more that I didn't think of!! (different curves, weighting by HFR stdev, ...) Last night I gave it a try and it went quite smooth! I can afford to make focus exposures longer to get better SNR and even so, autofocus takes way less than before. Thanks so much for your effort, for me this is quite an improvement.

Playing with the parameters I occasionally ended up with a failed autofocus, that was quite expected as I pushed some of them. But although the log reflects the failure, it doesn't show why it failed:
[2022-06-25T23:46:39.443 CEST INFO ][     org.kde.kstars.ekos.focus] - "Linear autofocus algorithm aborted."
[2022-06-25T23:46:39.445 CEST INFO ][     org.kde.kstars.ekos.focus] - "Autofocus failed, moving back to initial focus position 5.448."
In this case, I guess it didn't meet the minimum R2 I configured, but I think it would be desirable if the failure reason gets logged.

Also, the Analyze tab didn't plot any HFR measurements in the graph, and "Iterations: 0" is shown under Details (in the log I see that this particular autofocus run took 9 HFR measurements).

Thanks again!
1 month 3 weeks ago #83833

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

  • Posts: 92
  • Thank you received: 28

Replied by John on topic New Focus Algorithm in Ekos

Thanks very much for the feedback Sergio. If you configure logging like this:


Then you'll get all the focus related messages. For an R2 failure you should get:
2022-06-26 12:49:09.983722+0100 kstars[11402:2349276] [org.kde.kstars.ekos.focus] "Linear Curve Fit check failed R2=0.999893 R2Limit=1 retrying..."

After the rerun you'll get something like this...
2022-06-26 12:50:00.620048+0100 kstars[11402:2349276] [org.kde.kstars.ekos.focus] "Linear Curve Fit check failed R2=0.997972 R2Limit=1, but continuing..."

I suppose your point is that it could be a bit more obvious as to why the rerun happened (as opposed to having to go hunt through a detailed log file). Good point, I'll have a look at this.

In the Analyze tab you should get a focus entry for each autofocus run. If the run is successful it should log all the datapoints. If it fails, it will log the fact that there was an autofocus run but not the datapoints. L1P just fits in with the existing Analyze workflow here. This is how it works for the existing focus algorithms.

If you post the log here I can take a more detailed look.
1 month 3 weeks ago #83835
Attachments:

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

Time to create page: 1.121 seconds