newton.ik.IKObjectivePosition#
- class newton.ik.IKObjectivePosition(link_index, link_offset, target_positions, weight=1.0)[source]#
Bases:
IKObjectiveMatch the world-space position of a point on a link.
- Parameters:
- __init__(link_index, link_offset, target_positions, weight=1.0)#
- compute_jacobian_analytic(body_q, joint_q, model, jacobian, joint_S_s, start_idx)#
Fill the position Jacobian block from the analytic motion subspace.
- Parameters:
body_q (wp.array(dtype=wp.transformf, ndim=2)) – Batched body transforms for the evaluation rows, shape [n_batch, body_count].
joint_q (wp.array(dtype=wp.float32, ndim=2)) – Batched joint coordinates, shape [n_batch, joint_coord_count]. Present for interface compatibility and not used directly by this objective.
model (Model) – Shared articulation model.
jacobian (wp.array(dtype=wp.float32, ndim=3)) – Global Jacobian buffer to update, shape [n_batch, total_residual_count, joint_dof_count].
joint_S_s (wp.array(dtype=wp.spatial_vectorf, ndim=2)) – Batched motion-subspace columns, shape [n_batch, joint_dof_count].
start_idx (int) – First residual row reserved for this objective.
- compute_jacobian_autodiff(tape, model, jacobian, start_idx, dq_dof)#
Fill the position Jacobian block using Warp autodiff.
- Parameters:
tape (Tape) – Recorded Warp tape whose output is the global residual buffer.
model (Model) – Shared articulation model.
jacobian (wp.array(dtype=wp.float32, ndim=3)) – 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 (wp.array(dtype=wp.float32, ndim=2)) – 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 position errors into the global residual buffer.
- Parameters:
body_q (wp.array(dtype=wp.transformf, ndim=2)) – Batched body transforms for the evaluation rows, shape [n_batch, body_count].
joint_q (wp.array(dtype=wp.float32, ndim=2)) – Batched joint coordinates, shape [n_batch, joint_coord_count]. Present for interface compatibility and not used directly by this objective.
model (Model) – Shared articulation model. Present for interface compatibility.
residuals (wp.array(dtype=wp.float32, ndim=2)) – Global residual buffer to update, shape [n_batch, total_residual_count].
start_idx (int) – First residual row reserved for this objective.
problem_idx (wp.array(dtype=wp.int32, ndim=1)) – Mapping from evaluation rows to base problem indices, shape [n_batch], used to fetch
target_positions.
- init_buffers(model, jacobian_mode)#
Initialize caches used by analytic or autodiff Jacobian evaluation.
- Parameters:
model (Model) – Shared articulation model.
jacobian_mode (IKJacobianType) – Jacobian backend selected for this objective.
- residual_dim()#
Return the three translational residual rows for this objective.
- set_target_position(problem_idx, new_position)#
Update the target position for a single base IK problem.
- set_target_positions(new_positions)#
Replace the target positions for all base IK problems.
- Parameters:
new_positions (wp.array(dtype=wp.vec3f, ndim=1)) – Target positions [m], shape [problem_count].
- supports_analytic()#
Return
Truebecause this objective has an analytic Jacobian.