×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Canon DSLR auto focus issues

  • Posts: 71
  • Thank you received: 2
Your Idea
100 - far3
10 - far2
1 - far1

is better - it reflects the actual ratios between far1 / 2 /3 ...
5 years 1 month ago #36156

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

  • Posts: 989
  • Thank you received: 161

Replied by Alfred on topic Canon DSLR auto focus issues


Yes, we should test and tweak it. I hope to get to test it on a real star this evening but chances are dim.

What bothers me is why didn't the autofocus routine continue in order to detect the other side of the V and why does it fail to find best focus (and report it as a success)?

I agree with chengel, far1 doesn't make any sense unless you're VERY close to focus. I also believe a non-linear scaling could be in order here. It might depend on the individual lense though. What's best for a 50mm lense might turn out to be inappropriate for a 300mm lense.

From what I hear during the focusing process I assume you activate liveview for every far/near command separately. This means during my focussing attempt (screenshot) the mirrorf flipped 80x up and down. One for every photo taken and another one for issuing the far/near command afterwards. I believe we could prevent that by issuing viewfinder=1 at the beginning of the autofocus routine and issuing viewfinder=0 at the end when it either succeeds or terminates.
Last edit: 5 years 1 month ago by Alfred.
5 years 1 month ago #36157

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

  • Posts: 989
  • Thank you received: 161

Replied by Alfred on topic Canon DSLR auto focus issues

Regarding aperture I have no clue.

But in order to find out the correlation between far1/2/3 I did a simple test. I moved 3x near3 and counted how many steps it would take to get back to the starting point. Result:

3x near3 = ~22x near2 = ~140x near1

It was difficult to tell when exactly the starting position was reached. But a factor of 7 between near2/near1 and also between near3/near2 appears reasonable. Of course we could enter an exact value, too. In any case we should test whether this is independent from the lense that is being used.
Last edit: 5 years 1 month ago by Alfred.
5 years 1 month ago #36158

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

  • Posts: 1309
  • Thank you received: 226

Replied by Andrew on topic Canon DSLR auto focus issues

The Magiclantern project for Canon has features to control focus. It enables back button focus, follow focus and rack focusing. They too use a timer based procedure with 3 speeds and can count steps. Their back button controls also allow for big steps and small steps without me changing the speed. It might be worthwhile reviewing their source code to see how they manage to do that.
That being said because lenses do not know their absolute position, one can not expect to reliably return to the same position, as is discussed here . I wish I could contribute more.
5 years 1 month ago #36174

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

  • Posts: 71
  • Thank you received: 2
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)
5 years 1 month ago #36189

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

  • Posts: 989
  • Thank you received: 161

Replied by Alfred on topic Canon DSLR auto focus issues


This is EXACLTY what I had experienced before. Are you 100% sure you are running the latest software?
5 years 1 month ago #36191

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

  • Posts: 71
  • Thank you received: 2
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.
5 years 1 month ago #36208

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

Ok, I just ordered an artificial star so I can test these things. At any rate, I add the fake "steps" now, so give that a go and see if it improves the behavior over the older method. Currently in gphoto_ccd.h you will see two constants here:

FOCUS_HIGH_MED_RATIO = 7.33
FOCUS_MED_LOW_RATIO = 6.36

Maybe these can be configurable later, but test with these value and change if necessary. Report back.
5 years 1 month ago #36213

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

  • Posts: 71
  • Thank you received: 2
One idea:
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?
5 years 1 month ago #36220

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

  • Posts: 71
  • Thank you received: 2
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.
5 years 1 month ago #36244

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

  • Posts: 71
  • Thank you received: 2
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.
The following user(s) said Thank You: Jasem Mutlaq
5 years 1 month ago #36296
Attachments:

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

  • Posts: 71
  • Thank you received: 2
Here comes the zipped excel.

File Attachment:

File Name: focuser_test.zip
File Size:28 KB
5 years 1 month ago #36298
Attachments:

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

Time to create page: 0.899 seconds