motrixsim.ik#

Classes:

DlsSolver([max_iter, step_size, tolerance, ...])

Use Damped Least Squares (DLS) method to solve inverse kinematics problem.

GaussNewtonSolver([max_iter, step_size, ...])

Use gauss newton iterative method to solve inverse kinematics problem.

IkChain(model, end_link[, start_link, ...])

Represents a kinematic chain for inverse kinematics (IK) solving.

class motrixsim.ik.DlsSolver(max_iter=100, step_size=0.5, tolerance=0.001, damping=0.001)#

基类:object

Use Damped Least Squares (DLS) method to solve inverse kinematics problem.

DLS is a robust optimization method that adds regularization to handle singular configurations and improve numerical stability. It's also known as Levenberg-Marquardt for IK applications.

参数:
  • max_iter (int) -- Maximum number of iterations (default: 100).

  • step_size (float) -- Step size for each iteration (default: 0.5).

  • tolerance (float) -- Tolerance for convergence (default: 1e-3).

  • damping (float) -- Damping parameter for regularization (default: 1e-3). - Small values (1e-6 to 1e-4): Near Gauss-Newton behavior - Medium values (1e-4 to 1e-2): Good balance for most applications - Large values (1e-2 to 1.0): More stable but slower convergence

Methods:

solve(ik_model, data, target_pose)

Solve the IK problem for the given chain and target pose.

solve(ik_model, data, target_pose)#

Solve the IK problem for the given chain and target pose.

参数:
  • ik_model (IkChain) -- The IK model. Currently only IkChain is supported.

  • data (SceneData) -- The scene data containing the current state.

  • target_pose (NDarray[float]) -- The target pose the end effector want to reach. It is a 7-element array with (x, y, z, i, j, k, w) format.

返回:

A numpy array with shape (data.shape, ik_model.num_dof_pos + 2,). For each row, the first element is the number of iterations used, the second element is the final residual, and the remaining elements are the solved DOF positions.

class motrixsim.ik.GaussNewtonSolver(max_iter=100, step_size=0.5, tolerance=0.001)#

基类:object

Use gauss newton iterative method to solve inverse kinematics problem.

参数:
  • max_iter (int) -- Maximum number of iterations (default: 100).

  • step_size (float) -- Step size for each iteration (default: 0.5).

  • tolerance (float) -- Tolerance for convergence (default: 1e-3).

Methods:

solve(ik_model, data, target_pose)

Solve the IK problem for the given chain and target pose.

solve(ik_model, data, target_pose)#

Solve the IK problem for the given chain and target pose.

参数:
  • ik_model (IkChain) -- The IK model. Currently only IkChain is supported.

  • data (SceneData) -- The scene data containing the current state. target_pose (NDarray[float]): The target pose the end effector want to reach. It is a 7-element array with (x, y, z, i, j, k, w) format.

返回:

A numpy array with shape (data.shape, ik_model.num_dof_pos + 2,). For each row, the first element is the number of iterations used, the second element is the final residual, and the remaining elements are the solved DOF positions.

class motrixsim.ik.IkChain(model, end_link, start_link=None, end_effector_offset=None)#

基类:object

Represents a kinematic chain for inverse kinematics (IK) solving.

参数:
  • model (SceneModel) -- The scene model containing the kinematic structure.

  • end_link (str) -- The name of the end link of the IK chain.

  • start_link (Optional[str]) -- The name of the start link of the IK chain. If not provided, the root link will be used.

  • end_effector_offset (Optional[ndarray]) -- A 7-element array representing the end-effector offset as a pose (x, y, z, i, j, k, w) in end link's local space. If not provided, no offset will be applied.

抛出:

RuntimeError -- If the IK chain contains unsupported joint types. (Currently only hinge and slider are supported.)