Phylliade / ikpy

IKPy, an Universal Inverse Kinematics library
http://phylliade.github.io/ikpy
Apache License 2.0
761 stars 154 forks source link

max_iter argument no longer works #157

Open ss2562 opened 1 month ago

ss2562 commented 1 month ago

I wonder why the max_iter argument no longer functions in inverse_kinematics.inverse_kinematic_optimization(). There is this line:

if max_iter is not None:
   logs.logger.info("max_iter is not used anymore in the IK, using it as a parameter will raise an exception in the future")

Yet both optimisation functions have a max iterations argument: scipy.optimize.minimize() has options={"maxiter":max_iter} scipy.optimize.least_squares() has max_nfev=max_iter

It would be useful to have this feature again.

Phylliade commented 1 month ago

Hello @ss2562, what would be thé use case for max_iter?

ss2562 commented 1 month ago

For real-time applications, I am finding that if the joints are close to their limits then calculation greatly slows down. I'd like to exit after a specified number of iterations, then take some other action (e.g. reposition the robot, activate another joint, change the target point, ...) to maintain a fast update rate in joint positions.

Phylliade commented 1 month ago

This argument was deactivated because it can harm the quality of the ik results. Is it a problem for you?

Le mer. 25 sept. 2024 à 11:31, ss2562 @.***> a écrit :

For real-time applications, I am finding that if the joints are close to their limits then calculation greatly slows down. I'd like to exit after a specified number of iterations, then take some other action (e.g. reposition the robot, activate another joint, change the target point, ...) to maintain a fast update rate in joint positions.

— Reply to this email directly, view it on GitHub https://github.com/Phylliade/ikpy/issues/157#issuecomment-2373556615, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2EAX347YGHFDCZ6NTKSTZYJ7F7AVCNFSM6AAAAABOSHWOKKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTGU2TMNRRGU . You are receiving this because you commented.Message ID: @.***>

wly2014 commented 1 month ago

As mentioned in the readme.md:

IKPy is precise (up to 7 digits): the only limitation being your underlying model's precision, and fast: from 7 ms to 50 ms (depending on your precision) for a complete IK computation.

it may be better to provide the interface of all arguments of scipy.optimize.minimize() and scipy.optimize.least_squares(), such as the maxiter and tol, in order to balance the accuracy and time of the solution by the user?

Phylliade commented 1 month ago

Agreed, will do!