pycram.external_interfaces.pinocchio_ik#

Functions#

create_joint_configuration(→ numpy.ndarray[float])

Create a joint configuration vector (q) from the current joint positions of the robot.

compute_ik(→ typing_extensions.Dict[str, float])

Compute the inverse kinematics for a given target link and pose.

inverse_kinematics_logarithmic(...)

Compute the inverse kinematics for a given target transformation. Using a logarithmic error metric.

inverse_kinematics_translation(...)

Compute the inverse kinematics for a given target transformation. Using the distance of the translation as error metric.

parse_configuration_vector_to_joint_positions(...)

Takes the configuration vector from pinocchio and the robot model and returns a dictionary with joint names and

clip_joints_to_limits(→ numpy.ndarray[float])

Clip the joint positions to the joint limits.

Module Contents#

pycram.external_interfaces.pinocchio_ik.create_joint_configuration(robot: pycram.world_concepts.world_object.Object, model) numpy.ndarray[float]#

Create a joint configuration vector (q) from the current joint positions of the robot.

Parameters:
  • robot – The robot object.

  • model – The Pinocchio model.

Returns:

The joint configuration vector.

pycram.external_interfaces.pinocchio_ik.compute_ik(target_link: str, target_pose: pycram.datastructures.pose.PoseStamped, robot: pycram.world_concepts.world_object.Object) typing_extensions.Dict[str, float]#

Compute the inverse kinematics for a given target link and pose.

Parameters:
  • target_link – The target link.

  • target_pose – The target pose.

  • robot – The robot object.

Returns:

The joint configuration as a dictionary with joint names and joint values.

pycram.external_interfaces.pinocchio_ik.inverse_kinematics_logarithmic(model, configuration, data, target_joint_id, target_transformation, eps=0.0001, max_iter=1000, dt=0.1, damp=1e-12) typing_extensions.Tuple[numpy.ndarray[float], bool]#

Compute the inverse kinematics for a given target transformation. Using a logarithmic error metric.

Parameters:
  • model – The Pinocchio model.

  • configuration – The initial joint configuration.

  • data – The Pinocchio data.

  • target_joint_id – The target joint ID.

  • target_transformation – The target transformation.

  • eps – The error threshold.

  • max_iter – The maximum number of iterations.

  • dt – The time step.

  • damp – The damping factor.

Returns:

The final joint configuration and a boolean indicating if the computation was successful.

pycram.external_interfaces.pinocchio_ik.inverse_kinematics_translation(model, configuration, data, target_joint_id, target_transformation, eps=0.0001, max_iter=1000, dt=0.1, damp=1e-12) typing_extensions.Tuple[numpy.ndarray[float], bool]#

Compute the inverse kinematics for a given target transformation. Using the distance of the translation as error metric.

Parameters:
  • model – The Pinocchio model.

  • configuration – The initial joint configuration.

  • data – The Pinocchio data.

  • target_joint_id – The target joint ID.

  • target_transformation – The target transformation.

  • eps – The error threshold.

  • max_iter – The maximum number of iterations.

  • dt – The time step.

  • damp – The damping factor.

Returns:

The final joint configuration and a boolean indicating if the computation was successful.

pycram.external_interfaces.pinocchio_ik.parse_configuration_vector_to_joint_positions(configuration: numpy.ndarray[float], model) typing_extensions.Dict[str, float]#

Takes the configuration vector from pinocchio and the robot model and returns a dictionary with joint names and joint values.

Parameters:
  • configuration – The configuration vector.

  • model – The robot model.

Returns:

The joint configuration as a dictionary with joint names and joint values.

pycram.external_interfaces.pinocchio_ik.clip_joints_to_limits(joint_positions: typing_extensions.List[float], lower_limits: typing_extensions.List[float], upper_limits: typing_extensions.List[float]) numpy.ndarray[float]#

Clip the joint positions to the joint limits.

Parameters:
  • joint_positions – The joint positions to clip.

  • lower_limits – A List of lower joint limits.

  • upper_limits – A List of upper joint limits.

Returns:

The clipped joint positions.