I just upgraded to the latest nightly build.
I cannot confirm the problems you report. Here everything is running like yesterday....
Thank you, Jasem. I am looking forward to that.
Herrhausen, I would like to help, but I am afraid I don‘t know any new advice. When I experienced the autofocus routine wouldn‘t move the lense, I could solve this by manually enableing the view finder mode in indi AND select an arbitrary focus move from the drop down menu on the same panel.
I noticed that after a live view window is closed, view finder mode is being disabled. In the inidi panel it remains checked as enabled, though. Then I had to re-enable viewfinder mode by unchecking and rechecking it in the indi panel.
I didn‘t upgrade today ...
Try to enable view finder mode in the action panel of the indi dirver and select an item from the far3...near3 drop down menu (no matter which item you choose). This worked for me.
Maybe the existing algorithm could be made working correctly if we introduce a backlash on every turnaraound, which might be adjustable. For my tamron the backlash would be 8 medium steps.
Here comes the zipped excel.
File Attachment:File Name: focuser_test.zip
File Size: 28 KB
Let me report some encouraging results:
I built the v-curve manually. I started in the acual focus position. At iso 800 I got an HFR of 3.9 for the optimal focus. I moved away from the optimal focus position in far3 steps, until I could see a really substancial increase of HFR. One far3 step did not change anything. The second gave a small change. The third step shifted HFR to 11.28. Since I new I had moved in far-direction I started moving inwards in near2 steps. Over the first 8 steps HFR did hardly vary. Then HFR started to decrease almost linearly until it reached a value of 3.91. Then the HFR started to increase almost linearly. I got a beautiful v-curve with a clearly visible minimum.
At HFR 12.36 I turned the direction of movement again and moved outwards again in far2 steps. Again over 8 steps nothing happened and then HFR decreased to the minimum and increased again.
At the next turnaround I tried 1 near3 before moving inward in near2 steps. Now I only had 4 backlash steps before HFR began to decrease.
Continuing this type of systematic variation I found that the change of direction should be done by two big steps in the oposite direction. This has the same effect as a instantaneous turnaround (no backlash) and about 3 steps of medium size in the oposite direction.
One safe way to reach the optimal focus position might therefore be to build the v-curve moving in equidistant steps in one direction. After the minimal HFR has been passed, one should continue at least 3 more medium steps into the same direction. Then make a turnaround with two big steps in the oposite direction and return to the minimal HFR in medium (or small?) steps.
I attach some screenshots and an excel sheet with the data I took. ...no, it won‘t let me attach the excel sheet.
One issue is, that the backlash is probably specific for different lense types.
I just tried the new method.
My overall impression is that it works better than before. A strange thing is that I have to enable viewfinder mode manualle AND to force one focus move using the indi drop-down menu (far..-near..) to get the autofocus work.
I had several runs terminating successful. Some of them really lead to an excellent focus. Most of them either terminated not too far away from the actual focus (but it was still clearly visible that the actual focus had not yet been reached) or they the algorithm was stuck hunting an apparent minimum far away from the actual focus position.
I can see the algorithm is trying to find the minimum of a complete v-curve. The principal problem is that the absolute focuser position is only a fake value, and since the lense does not return to the same position with the exact counter-command, there happen to be more than one HFR at one focus position, which makes it hard (actually impossible) to calculate a slope. Sometimes the algorithm was iterating several steps very near an excellent focus position but did not stop to finally terminate in a far worse position.
The good news is that if I start near the actual focus, it is quite probable to terminate near the actual focus, in several cases nearer to it than initially.
Maybe it is worth trying to use the settle-value that can be adjusted in the focus module to introduce an adjustable time lapse between sending the focus command to the cam and disabeling view finder mode. If it is true, that lenses with slow focusers cannot complete the lense movement if viewfinder ist switched off too soon after the focussing command, this could help. Or one could put a sleep-time into the gphoto_ccd.h?
I think it is the latest version - but I‘ll check tonight to make sure.
I have thought about an explanation, why the focussing worked better with the former timer based version for the tamron and why I can use the far3...far1 selector in the indi panel but cannot use the buttons in the focus module - which are supposed to do literally the same thing.
I think the problem with the Tamron is that the focuser is slow. In the actual version, view finder mode is turned on, the far3...-command in being sent to the cam and viewfinder mode is switched off immediately. The slow focuser does not have enough time to act - maybe the cam needs the view finder mode during the full lens movement and the loss of view finder mode makes it terminate the movement.
In the timer based mode, far/near-commands were sent to the cam every 50ms during e.g.1000ms. So there was time to complete at least some of the far/near movements.
When I do it manually with the indi-panel, I don‘t switch off viewfinder mode at all between the movements and the capturing. There seems to be no problem taking images with the view finder mode turned on.
Maybe it would help (me?) if the viewfinder mode would not be switched on and off before and after everey focussing step but only once when entering the module? Then one has to make sure to re-enable view finder mode after a live preview window has been closed.
I tested the changes on my artificial star.
With my 70-200mm Tamron it was worse than yesterday. Now I had the problems Herrhausen reported before: The focusing commands from the focus module did not reliably lead to a movement of the lense. Sometimes it seemes unpredictable, if the lense would move or not.
When I tried manually from the focus module it was pretty much the same: Sometimes the lens did move, sometimes it didn‘t. There was also a large delay between pressing the button an an audible and visible movement of the lens.
From the indi-panel i can manually focus with the far3/...ner1 selector, vith viewfinder mode turned on. Then the delay vanishes.
I tried to focus manually not looking at the images, only according to the variation of the measured HFR. I was easily able to reach a position not too far away from the actual focus, but the finetuning was impossible. Sometimes it takes 2 far2 to compensate for one near2 ande vice versa. Somtimes you need even three countersteps of the same stepsize. It is rediculous to me how the lense autofocus can find good focus positions...
With the canon 50mm I recieved V-curves resembling those that Herrhausen posted. I tried only twice. The first time the algortihm terminated „unsuccessful“ but really near the actual focus. The second time the algorithm was succeessful and the image really appeared focused.
This is an answer to the question if the behaviour of the focus-algorithm depens strongly on the specific lense type: It does.
I also observed that the amount of the movement one far3 command initiates depends on the focal length of the lense: The tamron moves by a larger distance when put to 70mm than at 200mm. At 70mm this leads to a strong movment of the stellar image itself, which can even move the star out of the subframe - this won‘t happen if you start sufficiently near to the focus position.
After these experiences I am not sure if a universal autofocus module based on the linear focuser module will be possible. There must be a solution because in APT and other apps they exist ...
With respect to actual astroimaging I would appreciate to have an easy way to get to focus quickly. Therefore, my personal wishlist is emphasizes features that make bahtinov-focussing as easy as possible:
- 6 focus buttons in the focus module (far3...near1), that do exactly the same as when I select far3... in the indi panel
- image live-preview with higher resolution in the zoom and with a possibilty to adjust the brightness of the displayed image to be able to see the bahtinov spikes in the live preview; i don‘t care if the preview is loosing fps in exchange for resolution
- view finder mode enabeled only once when entering focus module or a button to enable it
- a possibility to control the image brightness in the fits previewer (bahtinov spikes)
100 - far3
10 - far2
1 - far1
is better - it reflects the actual ratios between far1 / 2 /3 ...
I have not yet tested the last changes - tonight I will.
From my experiences with the timer-based version and with manually focussing with far3/near3 ... far1/near1 I can say the following:
far1/near1 corresponds to really really small steps. If the algorithm makes the focusser change far2 in one direction I would guess it takes more than 10 (20?) far1 steps to balance this move in counter-direction.
maybe one could try something like
<1600 2xfar3 + far2
<1400 far3 + 2x far2
If it turns out that the really small moves should only be used in the very last steps, one can try a non linear scaling between time and step-size.