Autofocus - last movement direction


#1

I always thought the autofocus routine approached the final focus position from one direction only i.e., a ‘there and back’ movement so it overshoots and returns to position, thus eliminating any backlash that may reside in the drive connection. Whilst testing a new motorised focuser I made I noticed this didn’t happen, and so the amount of backlash in the motor gearbox (a NEMA11 19:1 planetary gearbox stepper) now becomes significant. The ASCOM driver I’m using does not include any parameter to compensate for this. So, am I mistaken in they way autofocus is supposed to work? Any chance of adding this functionality if it isn’t included?

The way it could work - after the focus run when moving to the focus position it would just move 1 x StepSize parameter past then approach position always moving the focuser inwards.

ChrisH


#2

OK, I rooted about in the settings and found it - pretty well hidden under the ‘Other’ button on the control panel settings sheet! Would be nice if a button also appeared on the Focus Control settings dialog too… :wink:

ChrisH


#3

In practice, the focus controls are normally the things you tweak dynamically - the backlash setting is more of a one-time set and forget for a particular piece of hardware and not affected by target. It may be better to avoid cluttering up the focus control settings dialog.


#4

After spending a couple of days working on this I found an issue:

My focuser has 15500 steps total travel, and I have backlash compensation set to 15 steps.

If I start at 0 (zero) and move (using the goto button) to 5000 steps the move appears successful but communication to the focuser fails immediately the move has completed. Only disconnect/re-connect (after unplugging the USB lead) gets me my connection back. In fact any move >5000 does this, and a move to 15000 in one operation is possible but the connection times out when it gets there.

However, a move less than 5000 (minus (15+1) is OK - i.e., 4984 is fine, and of course I can move the focuser fully out to 15000 by smaller increments.

[11/03/2016 09:38:19] [DEBUG] [Main Thread] Connecting ASCOM focuser…
[11/03/2016 09:38:19] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS complete…
[11/03/2016 09:38:19] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS message received…
[11/03/2016 09:38:19] [DEBUG] [Focuser Thread] Focuser moving to 0
[11/03/2016 09:38:24] [DEBUG] [Focuser Thread] Focuser move call complete
[11/03/2016 09:38:25] [DEBUG] [Main Thread] Focuser supports temperature
[11/03/2016 09:38:25] [DEBUG] [Main Thread] Current temperature reports: 20.25
[11/03/2016 09:38:25] [DEBUG] [Main Thread] Focuser reports max steps as: 15500
[11/03/2016 09:38:25] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS complete…
[11/03/2016 09:38:35] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS message received…
[11/03/2016 09:38:35] [DEBUG] [Focuser Thread] Focuser moving to 4999
[11/03/2016 09:38:35] [DEBUG] [Focuser Thread] Focuser backlash active, modified move to 5014
[11/03/2016 09:38:35] [DEBUG] [Focuser Thread] Focuser move call complete
[11/03/2016 09:38:35] [DEBUG] [Focuser Backlash Thread] Focuser backlash thread has started…
[11/03/2016 09:39:35] [DEBUG] [Focuser Backlash Thread] Backlash thread failed to complete! Timeout!
[11/03/2016 09:39:35] [DEBUG] [Focuser Backlash Thread] Focuser backlash thread has ended…
[11/03/2016 09:40:20] [DEBUG] [Main Thread] Connecting ASCOM focuser…
[11/03/2016 09:40:20] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS complete…
[11/03/2016 09:40:20] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_REL message received…
[11/03/2016 09:40:20] [DEBUG] [Focuser Thread] Focuser moving to -1000
[11/03/2016 09:40:25] [DEBUG] [Focuser Thread] Focuser move call complete
[11/03/2016 09:40:25] [DEBUG] [Main Thread] Focuser supports temperature
[11/03/2016 09:40:25] [DEBUG] [Main Thread] Current temperature reports: 19.75
[11/03/2016 09:40:25] [DEBUG] [Main Thread] Focuser reports max steps as: 15500
[11/03/2016 09:40:25] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_REL complete…
[11/03/2016 09:40:46] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS message received…
[11/03/2016 09:40:46] [DEBUG] [Focuser Thread] Focuser moving to 4984
[11/03/2016 09:40:46] [DEBUG] [Focuser Thread] Focuser backlash active, modified move to 4999
[11/03/2016 09:40:46] [DEBUG] [Focuser Thread] Focuser move call complete
[11/03/2016 09:40:46] [DEBUG] [Focuser Backlash Thread] Focuser backlash thread has started…
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Backlash thread has detected that movement to modified position (4999) is complete…
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Moving focuser to original requested position (4984)…
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Focuser backlash compensation needed. Steps: 15 Direction:IN
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Focuser moving to 4984
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Focuser move call complete
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Backlash thread failed to complete! Timeout!
[11/03/2016 09:41:46] [DEBUG] [Focuser Backlash Thread] Focuser backlash thread has ended…
[11/03/2016 09:41:47] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS complete…
[11/03/2016 09:41:53] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS message received…
[11/03/2016 09:41:53] [DEBUG] [Focuser Thread] Focuser moving to 0
[11/03/2016 09:41:53] [DEBUG] [Focuser Thread] Focuser move call complete
[11/03/2016 09:42:53] [DEBUG] [Focuser Thread] SGM_FOCUSER_MOVE_ABS complete…


#5

I should have mentioned - this only applies to movements OUT, moving the focuser inwards by any increment up to the maximum travel is no problem…

ChrisH


#6

Sounds like an ascom issue with your focuser. For instance my Rigel controller only allows 999 steps per move. The driver understands that.

Any reason you need to make a 5000 step move? Why are you setting it to 0?


#7

er, no. Sounds like a program bug to me - and it concerns the backlash compensation. Moving the focuser IN then all movements of any length are fine.

I start at 0 because that’s where I leave the focuser when I remove the OTA from the mount (actually, I leave it physically a little bit out but it’s set to zero at that point). I need to move it to ~8000 or so when I set up because that’s where I expect focus position to be.

ChrisH


#8

Your focuser likely has a max movement of 5000 steps at one go. We currently don’t check this property in SGP and perhaps we should. I don’t think it has anything to do with backlash compensation, likely just a red herring, just that the requested move is going beyond that amount. It’s interesting that it is only an issue in the out direction.

You can try disabling backlash compensation and testing this hypothesis.

I’ve added some logging for the MaxIncrement that will be out with the next 2.5 beta. Since yours seems asymmetric (works for in, breaks for out) I’m a little hesitant about adding this right now as it’s non-trivial and it might not be the actual issue.

Thanks,
Jared


#9

Movements are fine without backlash compensation enabled, I;ve set my max move to the same as the total movement (15,500 steps). If I ask for a 5000 OUT movement then the focuser stops at 5015 and does not move inwards by the 15 steps of backlash compensation. As said, if I reduce the requested move to 5000 minus the 15 (+1) so 4984 steps then it’s OK, but asking for just one more step (4985) it locks up. 5000 is the critical number.

ChrisH


#10

What we’re getting at is there isn’t a need to make a 5000 step change. It’s a bug, but it doesn’t prevent you from imaging.


#11

Yep, I managed to work that fix out… However it’s a bug and needed reporting.

If running remotely it is a little more inconvenient should you happen to run into this bug - your focuser stops working with no error message and you need to physically go out and power off (or disconnect the USB cable) before you can get control back. Anyway, that’s the way it is.

ChrisH


#12

I run remotely a lot. I don’t know why I would shift my focus 5000 steps. I never move more than the 3-400 required to do an autofocus run.

It’s a bug, it’ll get fixed.


#13

I just changed the MaxMovement to 4900 steps to avoid the problem.

Chris


www.mainsequencesoftware.com