Maybe you can interpolate the distances with it.When i find time, i would log this values together with upper/lower on my M3M10M100_Focus.lua script.
... 0 after a shoot_half.
Quote from: Caefix on 28 / June / 2022, 12:10:52... 0 after a shoot_half. With AF : EFLens FocusPosition : always 0, from near to infinity...Edit: Btw, the [cm] unit of _upper | _lower is probably canonmeter, not centimeter.
Quote from: c_joerg on 29 / June / 2022, 14:12:58Maybe you can interpolate the distances with it.When i find time, i would log this values together with upper/lower on my M3M10M100_Focus.lua script.I interpolate between Canon distances already, by counting myself, ie moving 1 step at a time. I’ll carry on thinking about it ;-)
call_event_proc("EFLensCom.FocusSearchNear")call_event_proc('FA.Create')call_event_proc('InitializeAdjustmentSystem')
I seem to have got the EFLens FocusPosition feedback stably working, the 'secret' is to set the lens to the maco end before calling FA.create, ie on script start up:Code: [Select]call_event_proc("EFLensCom.FocusSearchNear")call_event_proc('FA.Create')call_event_proc('InitializeAdjustmentSystem')Once this is done, changing focal length keeps 0 at the macro end.
Quote from: pigeonhill on 30 / June / 2022, 01:09:21I seem to have got the EFLens FocusPosition feedback stably working, the 'secret' is to set the lens to the maco end before calling FA.create, ie on script start up:Code: [Select]call_event_proc("EFLensCom.FocusSearchNear")call_event_proc('FA.Create')call_event_proc('InitializeAdjustmentSystem')Once this is done, changing focal length keeps 0 at the macro end.Interesting. That also explains why I kept getting different results.Nice finding
function set_up_lens() -- create Steps & Focus LUTs-- This function may take a while to run for some lenses, ie with lots of steps-- However, as long as you don't change focal length, you only need to run this once-- You will need to call this function after any focal length change call_event_proc("EFLensCom.FocusSearchNear") call_event_proc("EFLensCom.FocusSearchNear") -- just in case ;-) sleep(100) step_count = {} x_at_count ={} local i = 1 local j = 1-- Note this function doesn't require the step count at MFD to be zero-- It does assume, however, the LUTs don't change; other than explicity when focal length is changed step_count[j] = call_event_proc('GetEFLensFocusPositionWithLensCom') -- doesn't seem to be different to calling 'GetEFLensFocusPositionWithoutLensCom' x_at_count[j] = get_focus_distance_lower() local last_lower = get_focus_distance_lower() print("Inialising Lens") while get_focus_distance_upper() < inf do i = i + 1 call_event_proc("EFLensCom.MoveFocus", 1, 1) sleep(25) -- this could be changed, but only through testing if get_focus_distance_lower() > last_lower then -- just gone through a Canon focus step change j = j + 1 step_count[j] = call_event_proc('GetEFLensFocusPositionWithLensCom') last_lower = get_focus_distance_lower() x_at_count[j] = last_lower end end if log == 1 then -- print of LUTs print("Steps LUT") for i = 1, #step_count do print(step_count[i]) end print("Focus LUT") for i = 1, #step_count do print(x_at_count[i]) end end call_event_proc("EFLensCom.FocusSearchNear") sleep(100) print("Lens ready")end
function get_x_based_on_step_pos() -- estimate of focus distance in mm from the sensor plane-- This function uses a Lagrange estimation scheme, based on a 2nd order three point interpolation assumption local n = #step_count local t = call_event_proc('GetEFLensFocusPositionWithLensCom') -- step value at current focus sleep(25) local j = 1 for i = 2, n do j = i - 1 if t <= step_count[i] then break end end if j >= (n-1) then j = n - 2 end -- handle being at the end of the LUT tables if get_focus_distance_lower() > 81000 then -- at/beyond any useful lens data return get_focus_distance_upper() end local t1 = step_count[j] local t2 = step_count[j+1] local t3 = step_count[j+2] local pt = fmath.new(0) pt = pt + (x_at_count[j]*(t-t2)*(t-t3))/((t1-t2)*(t1-t3)) pt = pt + (x_at_count[j+1]*(t-t1)*(t-t3))/((t2-t1)*(t2-t3)) pt = pt + (x_at_count[j+2]*(t-t1)*(t-t2))/((t3-t1)*(t3-t2)) return pt:int() -- focus position in mmend
-540 150-444 160-372 170-336 180-309 190-280 210-252 220-227 240-201 250-179 280-163 300-146 330-127 360-114 400-101 450-90 500-79 560-71 630-62 710-56 810-49 930-43 1080-37 1270-32 1540-26 1940-22 2590-17 3840-13 7600
Started by adcz « 1 2 3 » Forum related topics (including issues)
Started by acseven General Chat
Started by mattkime LUA Scripting
Started by masplin « 1 2 3 4 » General Discussion and Assistance
Started by rpriegu Script Writing