Lens movement/focus control - page 4 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Lens movement/focus control

  • 34 Replies
  • 3576 Views
Re: Lens movement/focus control
« Reply #30 on: 25 / January / 2023, 16:52:02 »
Advertisements
with your script you can actually set the focus to a repeatable position between (re)boots or only when zooming within that session?


The way I successfully do it on the M3 is to move the infinity and take note of the stepper count there, then move to the macro end and take note of that stepper count, I now know the lens throw in stepper counts.


This remains stable as I manually focus, thus I can display a depth of field scale, eg [size=78%]https://photography.grayheron.net/2022/09/qdfs-now-with-more-functionality.html[/size]


If focal length changes I recalibrate.

*

Offline reyalp

  • ******
  • 14085
Re: Lens movement/focus control
« Reply #31 on: 25 / January / 2023, 17:14:35 »
My silly mistake, that gave me false hope, was that I tested the script on my M3
Hmm. That's interesting, actually. I would have expected these functions not to exist at all on M3, or to be dummies that just return, but looking at the M3 firmware MoveFocusLensWithPosition exists, and has similar code to P&S.

As you observed, GetFocusLensMove min/max returns hard-coded -/+ 32000 so does not reflect actual lens limits on M3.

I guess the dofinfo focus being zero you reported was also on M3?

Quote
Reading your sagely advice, and doing a quick test on my G5X, has reluncantly led me to stop this development :-(

If you and others do find a safe way to move the lens in steps. ie not mm, on the P&S cams, then I'll restart my development.
Well, for functions that manipulate hardware, "safe" generally can't be determined by casual inspection of firmware code. Other functions likely exist, likely do similar things under the hood, and their safety relative to MoveFocusLensWithPosition is unknown.

Given elph180 seems to have crash issues related to MF, my earlier warning may have been an overreaction, but I'd still definitely be cautious experimenting on a more expensive camera.

As far as MoveFocusLensWithPosition being absolute rather than relative, I'd say that's a positive, since you can trivially generate a relative movement from the current position.

as far as i could determine, the p&s don't have an actual stepper motor. this results in the step not being at the same focus point between (re)boots or when zooming.
IIRC, Canon is fond of USMs although there's likely variation between models. In any case, there's a lot more going on that just the focus mechanism. A complex zoom lens packed into a small space has lots of room for repeatability to suffer and the "subject distance" values exposed in CHDK add another layer of precision loss.

If you look at the list of functions I posted earlier, there's several involving "Backlash" "SpeedTable" "AccelerationTable"  "SlowdownTable" etc as well as ones referring to "DriveVoltage", "CarrierFrequency" and so on, which suggests that getting the lens quickly to the desired point is quite a complicated affair.
Don't forget what the H stands for.

Re: Lens movement/focus control
« Reply #32 on: 25 / January / 2023, 17:24:12 »
Quote

As far as MoveFocusLensWithPosition being absolute rather than relative, I'd say that's a positive, since you can trivially generate a relative movement from the current position.


The relative observation was on the M3.

*

Offline Mlapse

  • *****
  • 583
  • S95 S110
Re: Lens movement/focus control
« Reply #33 on: 26 / January / 2023, 12:00:31 »

The way I successfully do it on the M3 is to move the infinity and take note of the stepper count there, then move to the macro end and take note of that stepper count, I now know the lens throw in stepper counts.

I tried the same approach on p&s, however infinity (-1) is a few steps initially.
but between (re)boots or lens movement the lens throw might be close to the same, the stepper range could have shifted as much as +/-5 steps.
« Last Edit: 26 / January / 2023, 12:02:30 by Mlapse »
frustration is a key ingredient in progress


Re: Lens movement/focus control
« Reply #34 on: 26 / January / 2023, 12:04:07 »

The way I successfully do it on the M3 is to move the infinity and take note of the stepper count there, then move to the macro end and take note of that stepper count, I now know the lens throw in stepper counts.

I tried the same approach on p&s, however infinity (-1) is a few steps initially.
but between (re)boots or lens movement the lens throw might be close to the same, the stepper range could have shifted as much as +/-5 steps.

At the infinity end I move back until I see the Canon lower distance is sensible. This I define as infinity.

For my use, landscapes, and with suitable CoC choice, ie to ensure focus to focus overlap, I have found things stable.

As I said, if the Cam switches off or the focal length changes, I recalibrate.


 

Related Topics