gphoto2
gphoto2 copied to clipboard
Return position of focus?
Just wondering if there is a command to return the position the lens is focused on. Trying to writeup an autofocus script and I need to know if the command --set-config manualfocusdrive=MODE is actually moving the lens. I need to detect when the lens has reached either end of focus. Using canon 2ti if relevant.
Nikon might return end of drive range as a resuilting error. For canon not sure it reports it. it also seems tricky for non-phyiscal-motor driven lenses to "know" the end.
the ulrtrasound driven ones just emit motor movements but might not have any feedback method?
@John-Doggett I'm trying to control the manual focus on my camera as well, didn't know if you had any pointers/code/psuedo code to share on adjusting focus manually?
As far as I can tell there is no command which sets the focus to an absolute position - indeed (http://www.gphoto.org/doc/remote/) says "fixed positions cannot be driven to". But at least for a Nikon camera, you can take the focus to the limit where the camera will throw an error, then you can bring it back to an absolute position, like so:
gphoto2 --set-config viewfinder=1 --set-config manualfocusdrive=-32767 --wait-event=1s --set-config manualfocusdrive=14000
This line sets the focus position to 1 (actually it tries to overshoot, but an error is thrown), waits 1s, then sets the focus position to 14000 (of 32767)