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 (What varies from problem to problem are (1) the corresponding row in) – Initial joint coordinates, one row per problem. Modified in place.

  • objectives ((2) any per-problem data stored internally by the) – 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, default IKJacobianMode.AUTODIFF) – Backend used in compute_jacobian.

  • lambda_initial (float, default 0.1) – Initial LM damping per problem.

  • lambda_factor (float, default 2.0) – Multiplicative update factor for Ξ».

  • lambda_min (float, default 1e-5) – Lower clamp for Ξ».

  • lambda_max (float, default 1e10) – Upper clamp for Ξ».

  • rho_min (float, default 1e-3) – Acceptance threshold on predicted vs. actual reduction.

  • structure (Batch)

  • ------

  • same (The solver handles a batch of independent IK problems that all reference the)

  • objects. (articulation (model) and the same list of objective)

  • joint_q

  • and

  • objectives

  • e.g.

  • array (an)

  • duplicated. (of target positions. Nothing else is)

  • problems (- Shared across)

  • data (- Per-problem)

__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)#

Run the Levenberg-Marquardt loop.

Parameters:
  • iterations (int, default 10) – Maximum number of outer iterations.

  • step_size (float, default 1.0) – Multiplicative scale on deltaq before applying the proposal.

  • Side-effects

  • ------------

  • coordinates. (Updates self.joint_q in-place with the converged)