newton.ik.IKSolver#
- class newton.ik.IKSolver(model, joint_q, objectives, *a, **kw)[source]#
Bases:
object
Modular inverse-kinematics solver.
The solver uses an adaptive Levenberg-Marquardt loop and supports three Jacobian back-ends:
AUTODIFF: Warp’s reverse-mode autodiff for every objective.
ANALYTIC: Objective-specific analytic Jacobians only.
MIXED: Analytic where available, autodiff fallback elsewhere.
- Parameters:
model (newton.Model) – Singleton articulation shared by all problems.
joint_q (wp.array2d(dtype=float)) – Shape (n_problems, model.joint_coord_count). Initial joint coordinates, one row per problem. Modified in place.
objectives (Sequence[IKObjective]) – Ordered list of objectives shared by all problems. Each IKObjective instance can carry arrays of per-problem parameters (e.g., an array of target positions of length n_problems).
jacobian_mode (IKJacobianMode, optional) – Backend used in compute_jacobian. Defaults to IKJacobianMode.AUTODIFF.
lambda_initial (float, optional) – Initial LM damping per problem. Defaults to 0.1.
lambda_factor (float, optional) – Multiplicative update factor for λ. Defaults to 2.0.
lambda_min (float, optional) – Lower clamp for λ. Defaults to 1e-5.
lambda_max (float, optional) – Upper clamp for λ. Defaults to 1e10.
rho_min (float, optional) – Acceptance threshold on predicted vs. actual reduction. Defaults to 1e-3.
- Batch Structure:
The solver handles a batch of independent IK problems that all reference the same articulation (model) and the same list of objective objects. What varies from problem to problem are (1) the corresponding row in joint_q, and (2) any per-problem data stored internally by the objectives, e.g., an array of target positions. Nothing else is duplicated.
- __init__(model, joint_q, objectives, lambda_initial=0.1, jacobian_mode=IKJacobianMode.AUTODIFF, lambda_factor=2.0, lambda_min=1e-5, lambda_max=1e10, rho_min=1e-3)#
Construct a batch IK solver.
See class doc-string for parameter semantics.
- solve(iterations=10, step_size=1.0)#
Runs the Levenberg-Marquardt loop.
- Parameters:
- Side Effects:
Updates self.joint_q in-place with the converged coordinates.