Re: Auto Focus with overshoot
Posted: Tue Sep 07, 2021 1:28 am
Robin, if you think about it, implementing it should be pretty easy, like having an internal sequence routine. if you have the settings within the Focuser setup to turn this feature on with a check box and also have the ability to enter in a value to overshoot and which direction (Like NINA has), then your sub routine would be just like how I explained it.
If 100 steps is entered in on the IN box, leave Out at zero value. or to make it simple in your software, just have a value box to enter in the steps to overshoot and a drop down box to select the direction (IN or OUT option) The subroutine would be:
Current position (P) is 35000. User commands a position (UCP) of 34500, so before the value is sent to the Focuser, run this logic:
IF Overshoot mode is On and Overshoot type is set to "IN" and value is 100 steps, and UCP < P, then send an absolute Focuser position value to focuser of 34400 (UPC+Overshoot value), then send a following focuser position value of 34500 (relative positive movement = Overshoot value "100").
Lets say user wants to move in a positive direction from 35000 to 35500 in "IN" mode, then:
IF Overshoot is On and Overshoot is set to IN and UPC > P, send focuser to 35500 (send value as you would normally). This mean "IN Overshoot" will always over shoot the commanded IN position direction by a value of 100 each time command and then moves out to position value commanded by user. By doing so, backlash is eliminated because theoretically, all focuser position movements are always moving out.
The "OUT" mode overshoot if selected would be handled like this (Example of a movement from 35000 to 34500):
IF Overshoot mode is On and Overshoot type is set to "OUT" and value is 100 steps, and UCP < P, send focuser to 35500 (send value as you would normally).
Lets say user wants to move from 35000 to 35500 in "OUT" mode which is a positive movement, then:
IF Overshoot mode is On and Overshoot type is set to "OUT" and value is 100 steps, and UCP > P, then send an absolute Focuser position value to focuser of 35600 (UPC+Overshoot value), then send a following focuser position value of 35500 (relative negative movement = Overshoot value "100" ). This mean "OUT Overshoot" will always over shoot the commanded OUT position direction by a value of 100 each time command and then moves in to position value commanded by user. By doing so, backlash is eliminated because theoretically, all focuser position movements are always moving in.
If you wanted to make this more simple, you could leave out the IN/OUT option and always overshoot IN and just use that logic. At the end of the day, backlash is eliminated in either direction you want to move, by you or by the user if you have an option available or not. The reason why NINA has the option to choose IN or OUT is because of their autofocus routine which always move in an IN direction, so when running their autofocus routine with an IN overshoot value of 100, each autofocus movement inward would overshoot 100 steps, which can slow down the autofocus routine, but if you set the overshoot to OUT, the autofocus routine moving inwards and doesn't have to overshoot for each focus location, thus speeding up the routine. Just give us users more control. I do not know how your autofocus routine runs yet, but if you can control the direction of which way it runs, you may want to have the options for user to select In/OUT to help speed up the routine.
So coding should be simple, you add this login in between focuser position change controls to the actual focuser. Hope this helps.
If 100 steps is entered in on the IN box, leave Out at zero value. or to make it simple in your software, just have a value box to enter in the steps to overshoot and a drop down box to select the direction (IN or OUT option) The subroutine would be:
Current position (P) is 35000. User commands a position (UCP) of 34500, so before the value is sent to the Focuser, run this logic:
IF Overshoot mode is On and Overshoot type is set to "IN" and value is 100 steps, and UCP < P, then send an absolute Focuser position value to focuser of 34400 (UPC+Overshoot value), then send a following focuser position value of 34500 (relative positive movement = Overshoot value "100").
Lets say user wants to move in a positive direction from 35000 to 35500 in "IN" mode, then:
IF Overshoot is On and Overshoot is set to IN and UPC > P, send focuser to 35500 (send value as you would normally). This mean "IN Overshoot" will always over shoot the commanded IN position direction by a value of 100 each time command and then moves out to position value commanded by user. By doing so, backlash is eliminated because theoretically, all focuser position movements are always moving out.
The "OUT" mode overshoot if selected would be handled like this (Example of a movement from 35000 to 34500):
IF Overshoot mode is On and Overshoot type is set to "OUT" and value is 100 steps, and UCP < P, send focuser to 35500 (send value as you would normally).
Lets say user wants to move from 35000 to 35500 in "OUT" mode which is a positive movement, then:
IF Overshoot mode is On and Overshoot type is set to "OUT" and value is 100 steps, and UCP > P, then send an absolute Focuser position value to focuser of 35600 (UPC+Overshoot value), then send a following focuser position value of 35500 (relative negative movement = Overshoot value "100" ). This mean "OUT Overshoot" will always over shoot the commanded OUT position direction by a value of 100 each time command and then moves in to position value commanded by user. By doing so, backlash is eliminated because theoretically, all focuser position movements are always moving in.
If you wanted to make this more simple, you could leave out the IN/OUT option and always overshoot IN and just use that logic. At the end of the day, backlash is eliminated in either direction you want to move, by you or by the user if you have an option available or not. The reason why NINA has the option to choose IN or OUT is because of their autofocus routine which always move in an IN direction, so when running their autofocus routine with an IN overshoot value of 100, each autofocus movement inward would overshoot 100 steps, which can slow down the autofocus routine, but if you set the overshoot to OUT, the autofocus routine moving inwards and doesn't have to overshoot for each focus location, thus speeding up the routine. Just give us users more control. I do not know how your autofocus routine runs yet, but if you can control the direction of which way it runs, you may want to have the options for user to select In/OUT to help speed up the routine.
So coding should be simple, you add this login in between focuser position change controls to the actual focuser. Hope this helps.