Help! Ekos Focus Failure

I’m hoping there is someone here who can help me figure out what’s going on with Ekos Linear 1-pass focusing or Ekos focus logic in general. I have an Arduino MyFocusPro2 updated to the latest firmware. This focuser works perfectly in SGP or just using it manually. I have backlash compensation disabled in the Indi driver.

My problem is Ekos L1P focusing seems to lose it’s mind and comes up with random solutions. It’s trying to take multiple exposures at the same time and seems to move it the wrong direction from time to time. Almost like there are multiple threads running in parallel both trying to focus. Also, the 2-pass linear focus has similar issues but it seems Ekos is able to recover reasonable well and doesn’t leave the focus point in a completely wrong location. I would really like to get the L1P process working. I’m sure it’s some sort of incompatibility between the MyFocusPro2 and Ekos. I would love to correct it but I’m not sure what’s triggering Ekos to go off the rails in a big way.

I have attached a log file of a typical L1P run. All my parameter settings are at the top of the log file. To give you an idea, I’ll paste just the start of the file below and add some annotations. Please review the full log and give me your insight.

Thanks!
Ken

<< Initial position 1600. I know this for a fact as this is my normal starting point very close to focus >>
[2024-08-12T21:10:30.099 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Linear: Travel 500 initStep 20 pos 1600 min 0 max 15000 maxIters 51 tolerance 0.05 minlimit 1100 maxlimit 2100 init#steps 5 algo 3 backlash 0 curvefit 1 useweights 0”
<< Ekos says initial position is 1700? Ok? >>
[2024-08-12T21:10:30.099 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Linear: initialPosition 1700 sized 20”
[2024-08-12T21:10:30.099 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Linear: extending outward movement by overscan 100”
[2024-08-12T21:10:30.100 Atlantic Daylight Time INFO ][ org.kde.kstars.ekos.focus] - “Focusing outward by 200 steps…”
[2024-08-12T21:10:30.211 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - MyFocuserPro2 : "[INFO] Focuser is moving to position 1800 "
<< Ok 100 for overscan (not sure where to set this) and 100 for 5 * 20 steps is 200. Move to out to 1800. Perfect. >>
[2024-08-12T21:10:30.252 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Restarting focus motion timer, state Busy
[2024-08-12T21:10:30.252 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “autoFocusProcessPositionChange called with state 2 (Busy), focuserAdditionalMovement=100, inAutoFocus=1, m_captureInProgress=0, currentPosition=1600”
[2024-08-12T21:10:31.399 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Abs Focuser position changed to 1601 State: Ok
<< It moved to 1601 and stopped? State = Ok. It should be moving to 1800 as is logged above. This seems to be the major issue. It knows it’s looking for 1800, why stop just 1 count from the start? Right here Ekos could have detected the error but it’s downhill from here. >>
[2024-08-12T21:10:31.400 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Undoing overscan extension. Moving back in by 100 ticks in 0s”
[2024-08-12T21:10:31.400 Atlantic Daylight Time INFO ][ org.kde.kstars.ekos.focus] - “Focusing inward by 100 steps…”
[2024-08-12T21:10:31.403 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - MyFocuserPro2 : "[INFO] Focuser reached requested position. "
[2024-08-12T21:10:31.457 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - MyFocuserPro2 : "[INFO] Focuser is moving to position 1501 "
<< Now take the 100 overscan away and we’re at 1501. It should be looking for 1700 here. 1600 + 200 - 100 >>
[2024-08-12T21:10:31.499 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Restarting focus motion timer, state Busy
[2024-08-12T21:10:31.499 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “autoFocusProcessPositionChange called with state 2 (Busy), focuserAdditionalMovement=0, inAutoFocus=1, m_captureInProgress=0, currentPosition=1601”
[2024-08-12T21:10:32.456 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Abs Focuser position changed to 1565 State: Busy
<< It’s moving in to 1501 apparently. Here it’s at 1565 and still busy >>
[2024-08-12T21:10:32.457 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Restarting focus motion timer, state Busy
[2024-08-12T21:10:32.458 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “autoFocusProcessPositionChange called with state 2 (Busy), focuserAdditionalMovement=0, inAutoFocus=1, m_captureInProgress=0, currentPosition=1565”
[2024-08-12T21:10:33.605 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Focus positioning error: requested position 1700, current position 1565”
[2024-08-12T21:10:33.606 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Focus position reached at 1565, starting capture in 1 seconds.”
<< Ah ha! Something knows it should be at 1700 but it reached 1565 and is still in busy state so it’s still on it’s way to 1501 . Regardless, it decides to take an image. >>
[2024-08-12T21:10:33.653 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - MyFocuserPro2 : "[INFO] Focuser reached requested position. "
<< Focuser has reached requested position. I assume this is 1501? Not sure why it thinks that’s the requested position. Should be 1700. >>
[2024-08-12T21:10:33.791 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - SBIG CCD : "[INFO] Temperature set to +4.4C "
[2024-08-12T21:10:34.595 Atlantic Daylight Time INFO ][ org.kde.kstars.ekos.focus] - “Capturing image…”
[2024-08-12T21:10:34.620 Atlantic Daylight Time INFO ][ org.kde.kstars.indi] - SBIG CCD : "[INFO] Taking 5.00s exposure on main camera… "
[2024-08-12T21:10:34.705 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - Abs Focuser position changed to 1501 State: Ok
<< Now it finally reaches 1501 for some reason and it’s already started taking a photo. >>
[2024-08-12T21:10:34.706 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Focus positioning error: requested position 1700, current position 1501”
[2024-08-12T21:10:34.706 Atlantic Daylight Time DEBG ][ org.kde.kstars.ekos.focus] - “Focus position reached at 1501, starting capture in 1 seconds.”
[2024-08-12T21:10:34.706 Atlantic Daylight Time WARN ][ org.kde.kstars.ekos.focus] - Capture called while already in progress. Capture is ignored.
<< Finally, it again says it’s not at 1700 but has reached 1501 and tries to take another photo while the first one is still in progress. >>

EkosFocusIssueL1P.txt (47.4 KB)

I should also mention that at the end of the focus run it selected these points for the curve which do not match the actual focuser position. Then settled on 1527 as the focus point which is completely out of focus. It appears to be using “theoretical” positions rather than the actual position reported by the focuser. I’m pretty sure I’m dealing with some sort of race condition but where to start looking?

Linear: points=[(1700, 0.991997, 1), (1680, 0.958589, 1), (1660, 0.890479, 1), (1640, 0.938845, 1), (1620, 1.08277, 1), (1600, 1.15129, 1), (1580, 1.43183, 1), (1560, 1.70612, 1), (1540, 2.05459, 1), (1520, 2.36188, 1)]

Thanks

Hi Ken,

There have been issues with the MyFocuserPro2 in the past. If you search the forum you’ll see some threads. Here’s one for example:
https://www.indilib.org/forum/general/13289-linear-focusing-strangenss-again.html?start=0#92263

What I suggest is:

  1. Make sure you are on the latest MyFocuserPro2 firmware. This has fixed issues in the past.
  2. If 1. does not fix things then set AF Overscan = 0 and see if that fixes the issue. If it does then we may be able to optimise things a bit better but lets see if that fixes the issue first.

Hope this helps.

Thanks John. I am on the latest firmware but I did not try the AF Overscan setting. I will try that and report back.

Your analysis of the log file in the thread you provided is exactly what I am seeing. Since this spans so many firmware revisions I’m thinking the issue may be in the Indi driver which hasn’t been updated in a very long time - if at all.

Ken

[quote]
Hi Ken,

There have been issues with the MyFocuserPro2 in the past. If you search the forum you’ll see some threads. Here’s one for example:
https://www.indilib.org/forum/general/13289-linear-focusing-strangenss-again.html?start=0#92263

What I suggest is:

  1. Make sure you are on the latest MyFocuserPro2 firmware. This has fixed issues in the past.
  2. If 1. does not fix things then set AF Overscan = 0 and see if that fixes the issue. If it does then we may be able to optimise things a bit better but lets see if that fixes the issue first.

Hope this helps.[/quote]

I fixed it. See here for details.

myFocuserPro2 Driver Fix for Ekos - INDI Forum (indilib.org)