Pivot calibration: erroneous mixing algorithms by recursion
Lecrapouille opened this issue · comments
Hello, I'm not a good Python programmer, but it seems that the pivot_calibration_with_ransac function is calling badly its recursion:
will call
that will call
that will call
with implicitconfiguration=None
as parameter that will call
and
but since
the
is not calledI've not traced calls (as noob in Python is this kind of tool exists ?), this is a simple "manual" code review, I may be wrong. I guess you have forgotten to pass configuration in the recursive calls. Finally, your recursive algorithm is complex to understand: I think pivot_calibration_with_ransac shall only call pivot_calibration_with_ransac but not the base function pivot_calibration.
Thanks for raising this. I'm away this week so have assigned @mxochicale to take a look first. @mxochicale can you please take a look? @MattClarkson might be able to help too as I think he was the main author on this.
I've had a look at this now. I think it is confusion caused by our overly complex recursion (which I don't think is actually recursion). My understanding is that pivot_calibration is a wrapper that will call one of three methods (pivot_calibration_aos, pivot_calibration_ransac, or pivot_calibration_sphere_fitting).
pivot_calibration_ransac calls pivot_calibration_aos multiple times to iteratively find an optimal solution (i.e. pivot_calibration_ransac is not meant to call itself (recurse)).
I've clarified that in the code see
I hope that makes sense. If so I'll create a pull request for it.
My understanding is that pivot_calibration is a wrapper that will call one of three methods (pivot_calibration_aos, pivot_calibration_ransac, or pivot_calibration_sphere_fitting).
I agree with you.
pivot_calibration_ransac calls pivot_calibration_aos multiple times to iteratively find an optimal solution (i.e. pivot_calibration_ransac is not meant to call itself (recurse)).
I agree with you.
I hope that makes sense. If so I'll create a pull request for it.
The fix looks good to me. Probably you will have to also update unit tests.