newton.ik.IKObjectiveJointLimit#

class newton.ik.IKObjectiveJointLimit(joint_limit_lower, joint_limit_upper, weight=0.1)[source]#

Bases: IKObjective

Penalize violations of per-DoF joint limits.

Each DoF contributes one residual row whose value is zero inside the valid range and increases linearly once the coordinate exceeds its lower or upper bound.

Parameters:
  • joint_limit_lower (wp.array(dtype=wp.float32)) – Lower joint limits [m or rad], shape [joint_dof_count].

  • joint_limit_upper (wp.array(dtype=wp.float32)) – Upper joint limits [m or rad], shape [joint_dof_count].

  • weight (float) – Scalar multiplier applied to each limit-violation residual row.

__init__(joint_limit_lower, joint_limit_upper, weight=0.1)#
compute_jacobian_analytic(body_q, joint_q, model, jacobian, joint_S_s, start_idx)#

Fill the limit Jacobian block with the piecewise-linear derivative.

Parameters:
  • body_q (array(ndim=2, dtype=transformf)) – Batched body transforms, shape [n_batch, body_count]. Present for interface compatibility and not used directly by this objective.

  • joint_q (array(ndim=2, dtype=float32)) – Batched joint coordinates for the evaluation rows, shape [n_batch, joint_coord_count].

  • model (Model) – Shared articulation model.

  • jacobian (array(ndim=3, dtype=float32)) – Global Jacobian buffer to update, shape [n_batch, total_residual_count, joint_dof_count].

  • joint_S_s (array(ndim=2, dtype=vector(length=6, dtype=float32))) – Batched motion-subspace columns, shape [n_batch, joint_dof_count]. Ignored because the joint-limit derivative is diagonal in joint coordinates.

  • start_idx (int) – First residual row reserved for this objective.

compute_jacobian_autodiff(tape, model, jacobian, start_idx, dq_dof)#

Fill the limit Jacobian block using Warp autodiff.

Parameters:
  • tape (Tape) – Recorded Warp tape whose output is the global residual buffer.

  • model (Model) – Shared articulation model.

  • jacobian (array(ndim=3, dtype=float32)) – Global Jacobian buffer to update, shape [n_batch, total_residual_count, joint_dof_count].

  • start_idx (int) – First residual row reserved for this objective.

  • dq_dof (array(ndim=2, dtype=float32)) – Differentiable joint update variable for the current batch, shape [n_batch, joint_dof_count].

compute_residuals(body_q, joint_q, model, residuals, start_idx, problem_idx)#

Write weighted joint-limit violations into the global residual buffer.

Parameters:
  • body_q (array(ndim=2, dtype=transformf)) – Batched body transforms, shape [n_batch, body_count]. Present for interface compatibility and not used directly by this objective.

  • joint_q (array(ndim=2, dtype=float32)) – Batched joint coordinates for the evaluation rows, shape [n_batch, joint_coord_count].

  • model (Model) – Shared articulation model. Present for interface compatibility.

  • residuals (array(ndim=2, dtype=float32)) – Global residual buffer to update, shape [n_batch, total_residual_count].

  • start_idx (int) – First residual row reserved for this objective.

  • problem_idx (array(ndim=1, dtype=int32)) – Mapping from evaluation rows to base problems, shape [n_batch]. Ignored because joint limits are shared across all problems.

init_buffers(model, jacobian_mode)#

Initialize autodiff seeds and the DoF-to-coordinate lookup table.

Parameters:
  • model (Model) – Shared articulation model.

  • jacobian_mode (IKJacobianType) – Jacobian backend selected for this objective.

residual_dim()#

Return one residual row per joint DoF.

supports_analytic()#

Return True because this objective has an analytic Jacobian.