Skip to content

novaphy.ik.solve_ik_pose_best_of_seeds

Multi-seed wrapper around solve_ik_pose(). Runs the LM solver from several randomized seeds and returns the lowest-cost solution; helps escape local minima for redundant manipulators or when q0 is far from a feasible configuration.

def solve_ik_pose_best_of_seeds(
    art,
    q0,
    target_position,
    target_orientation,
    *,
    n_seeds: int,
    seed_scale: float,
    rng=None,
    **solve_ik_pose_kwargs,
) -> tuple[np.ndarray, bool]

Parameters

Parameter Description
art JointBodyBundle or compatible.
q0 Anchor initial positions; seeds are sampled around it.
target_position, target_orientation Pose targets.
n_seeds Number of randomized seeds, including the anchor q0.
seed_scale Scale of additive uniform noise applied to seeds.
rng Optional numpy.random.Generator.
**solve_ik_pose_kwargs Forwarded to solve_ik_pose() (tol_pos, tol_orient, max_iter, lambda_damp, step_size, weight_orientation, joint_limits, ee_link_index, local_offset).

Returns

(best_q, best_converged) — the seed solution with the lowest pose cost, plus its convergence flag.

See Also