Thanks Reyalp, I will try the glue script as you suggest. This seems like a neat way to do it. I like the options in your script.
This is diverging off-topic, but one of the reasons I want to use the CHDKptp is so that I can set the focus, take a picture, then set the focus at a slightly different point, and take another picture... and see where the focus is sharpest. But I am getting confused by all the different units. Is there a way to interrogate the camera to determine what the focus point is set to? Then I can focus at infinity or set it to scene mode, and see what value it reports. I'd use that as a starting value and bracket around it.
I've found that 'luar set_focus(-1)' does not result in consistently focused images. But I am not sure how the camera knows to translate '-1' to "infinity". It seems to me to be more robust to set_focus(xxxx), but first I need to determine what value of xxxx corresponds to true focus at infinity.
(I'm also making another assumption here, that the lens is generally capable of going beyond infinity. It must be able to for optical focus of a distant subject to be able to work. So I am not sure what "set the focus to infinity" means, unless the camera is somehow taught at what point the lens should be set.)
But upon some more thought overnight, it makes sense. The lens equation is 1/i + 1/o = 1/f where i, o and f are the image distance, object distance and focal length respectively. If you write it as o = 1/(1/f - 1/i) you can take the derivative do/dx to see how the "object position" (i.e. the value returned by get_focus()) varies with change in image position (i.e. the actual position of the lens above the sensor), and it blows up when i=f. So that makes sense. When you are focusing the lens at "infinity", any very small change in the lens position results in a huge change in calculated "object" position. So I am not sure there is anything useful to be learned from the returned object position.
Is there a way to set the lens in a more raw fashion - i.e. native camera "clicks" or whatever it is? Then we could possibly command the lens to go out *past* infinity focus and come *in* to the desired point. Not sure that would work any better, but it would be nice to be able to try it.
P.s. and yes, also same thing on the G16. The Manual Focus bar goes to full at infinity focus, but there is a little arrow at the top of it. I can click the focus position 11 times more and then the arrow goes away. But is the focus really "beyond infinity" when clicking beyond the full bar? I need to try that.
We really need a set_lens_position() command rather than a set_focus() command.