pyroboplan.ik package
Inverse kinematics module.
This module contains solvers and utilities for inverse kinematics (IK).
Submodules
pyroboplan.ik.differential_ik module
Utilities for differential IK.
- class pyroboplan.ik.differential_ik.DifferentialIk(model, collision_model=None, data=None, collision_data=None, visualizer=None, options=<pyroboplan.ik.differential_ik.DifferentialIkOptions object>)
Bases:
objectDifferential IK solver.
This is a numerical IK solver that uses the manipulator’s Jacobian to take first-order steps towards a solution. It contains several of the common options such as damped least squares (Levenberg-Marquardt), random restarts, and nullspace projection.
- Some good resources:
- solve(target_frame, target_tform, init_state=None, nullspace_components=[], verbose=False)
Solves an IK query.
- Parameters:
target_frame (str) – The name of the target frame in the model.
target_tform (pinocchio.SE3) – The desired transformation of the target frame in the model.
init_state (array-like, optional) – The initial state to solve from. If not specified, a random initial state will be selected.
nullspace_components (list[function], optional) – An optional list of nullspace components to use when solving. These components must take the form lambda model, q: component(model, q, <other_args>).
verbose (bool, optional) – If True, prints additional information to the console.
- Returns:
A list of joint configuration values with the solution, if one was found. Otherwise, returns None.
- Return type:
array-like or None
- class pyroboplan.ik.differential_ik.DifferentialIkOptions(max_iters=200, max_retries=10, max_translation_error=0.001, max_rotation_error=0.001, damping=0.001, min_step_size=0.1, max_step_size=0.5, ignore_joint_indices=[], joint_weights=None, rng_seed=None)
Bases:
objectOptions for differential IK.
pyroboplan.ik.nullspace_components module
Library of common nullspace components for inverse kinematics.
- pyroboplan.ik.nullspace_components.collision_avoidance_nullspace_component(model, data, collision_model, collision_data, q, dist_padding=0.05, gain=1.0)
Returns a collision avoidance nullspace component.
- These calculations are based off the following resources:
- Parameters:
model (pinocchio.Model) – The model from which to generate a random state.
data (pinocchio.Data) – The model data to use for collision distance checks.
collision_model (pinocchio.GeometryModel) – The model with which to check collision distances.
collision_data (pinocchio.GeometryData) – The collision model data to use for collision distance checks.
q (array-like) – The joint configuration for the model.
dist_padding (float) – The distance padding, in meters, on the collision distances. For example, a distance padding of 0.1 means collisions have an influence 10 cm away from actual collision..
gain (float, optional) – A gain to modify the relative weight of this term.
- Returns:
An array containing the collision avoidance nullspace terms.
- Return type:
array-like
- pyroboplan.ik.nullspace_components.joint_center_nullspace_component(model, q, gain=1.0)
Returns a joint centering nullspace component.
- Parameters:
model (pinocchio.Model) – The model from which to generate a random state.
q (array-like) – The joint configuration for the model.
gain (float, optional) – A gain to modify the relative weight of this term.
- Returns:
An array containing the joint centering nullspace terms.
- Return type:
array-like
- pyroboplan.ik.nullspace_components.joint_limit_nullspace_component(model, q, gain=1.0, padding=0.0)
Returns a joint limits avoidance nullspace component.
- Parameters:
model (pinocchio.Model) – The model from which to generate a random state.
q (array-like) – The joint configuration for the model.
gain (float, optional) – A gain to modify the relative weight of this term.
padding (float, optional) – Optional padding around the joint limits.
- Returns:
An array containing the joint space avoidance nullspace terms.
- Return type:
array-like
- pyroboplan.ik.nullspace_components.zero_nullspace_component(model, q)
Returns a zero nullspace component, which is effectively a no-op.
- Parameters:
model (pinocchio.Model) – The model from which to generate a random state.
q (array-like) – The joint configuration for the model. Not used, but required to match the function interface.
- Returns:
An array of zeros whose length is the number of joint variables in the model.
- Return type:
array-like