@Garry23
I am back

(thanks g3gg0) !
Say I zero out focus_pos
note that you cannot change the value of focus_pos as it is only a "returned" value.
If I then say attempt to move back using, say, step size 1, this time how does knowing I moved y micro units help me control the lens return position, as I can not position the lens using the finer units.
I think of focus_pos as a higher resolution ruler which gives (returns) you a finer value of the lens position, the ‘micro units’ position as you call it.
Till now, the only way to have an idea of the lens focus position was to question for the lens.focus_distance which is in the « object field » and which is not so precise as there are only few values, i.e.:
(m) 0,3…..1…..3…..10…..infinity depending on the lens, as can be seen on the lens barrel.
The focus_pos ruler is now in the image field, it has a lot of graduations (ticks ?) but you can only move the lens as before using lens.focus commands with step sizes 1,2 and 3.
Nevertheless, it is a great tool to know where the lens has moved (relative information, after a move) or where it is (absolute info - only known after you have found the ruler position (offset) when the camera was switched on and the total number of micro units for that lens from macro to infinity).
You can add or subtract micro units as you use lens.focus commands :
Let’s take a simplified example:
To simplify, let’s assume that all the moves of
- step size 1 with lens.focus are equal to 7 micro units in length in the image field.
- step size 2 … moves are equal to 30 micro units in length….
Let’s assume there is no hysteresis.
We can then compute the position of the lens in micro units.
If the starting position = 0 micro units
If I ask, say, 7 times a move of step size 2 towards infinity, the position of the lens should be
0 + 7 x 30 = 210 micro units (or -210, if it is negative towards infinity, depending on the lens)
The returned value of focus_pos should then also be 210 micro units.
If I then ask a move of step size 1 towards macro end, the position of the lens should be
210 - 7 = 203 micro units.
Lest’s now imagine I want to go to the very precise position of 150 micro units.
I have to go towards macro end by
203 - 150 = 53 micro units.
53 is not a multiple of 7 and
53 is lower than the Lowest Common Multiple (LCM) (in french « plus petit common multiple » PPCM) of 7 and 30
the remainder of the integer division of 53 by 7 is not 0
53 < LCM(7,30)
So it is impossible to go directly to position 150 exactly without changing the direction (the hysteresis would have an effect here because the direction of the move would have to be changed)
I can decide to make a move of 7 or 8 stepsize 1 steps towards macro end.
The position should then be
203 - 7 x 7 = 154 micro units (error = 4 micro units from the target of 150)
or
203 - 8 x 7 = 147 micro units (error = 3 micro units from the target of 150 : better solution)
IMHO those errors are « normal » for such a lens (to be confirmed).
I also think this example is a typical move when autofocusing in liveview.
The lens makes a big move in one direction and then comes back, one step at a time, in the opposite direction until it "crosses" the maximum contrast and then stops.
This avoids the hysteresis problems.
As you can see, because lens.focus_pos is a returned value, the only way to go to a position given in 'micro units’ is by "trial and error" especially as the stepsize can change more or less in the general case (more constant with L lenses).
With a trial and error algorithm, it should be possible to develop a goto function in Lua.
IMHO the number of micro units crossed when moving might be given by a sensor: say some Canon lenses have optical sensors (I am speculating here: light emitted, reflected or not, and sensed back); magnetic sensors (GMR) are present in Nikon lenses (AF-S DX NIKKOR 18-105mm f/ 3.5-5.6G ED VR) and even Tamron, Tokina.
As one might think, it is necessary to measure a few impulses from such sensors to get a precise enough move of the lens barrel.