Robot.iter_inverse_kinematics

Robot.iter_inverse_kinematics(frame_WCF, start_configuration=None, group=None, return_full_configuration=False, use_attached_tool_frame=True, options=None)[source]

Iterate over the inverse kinematic solutions of a robot.

This method exposes the generator-based inverse kinematic solvers. Analytics solvers will return generators that include all possible solutions, hence exhausting the iterator indicates there are no more solutions to be found. Numerical solvers, on the other hand, will keep returning solutions until one fails to be found (usually caused by a timeout rather than infeasibility) or until the user code stops the iteration.

Parameters
  • frame_WCF (compas.geometry.Frame) – The frame to calculate the inverse kinematic for.

  • start_configuration (Configuration, optional) – If passed, the inverse will be calculated such that the calculated joint positions differ the least from the start_configuration. Defaults to the zero configuration.

  • group (str, optional) – The planning group used for calculation. Defaults to the robot’s main planning group.

  • return_full_configuration (bool, optional) – If True, returns a full configuration with all joint values specified, including passive ones if available. Defaults to False.

  • use_attached_tool_frame (bool, optional) – If True and there is a tool attached to the planning group, it will use its TCF instead of the T0CF to calculate IK. Defaults to True.

  • options (dict, optional) – Dictionary containing the key-value pairs of additional options. The valid options are specific to the backend in use. Check the API reference of the IK backend implementation for more details.

Raises

compas_fab.backends.BackendError – If no configuration can be found.

Yields

Configuration – An inverse kinematic solution represented as a configuration.

Examples

>>> frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0])
>>> start_configuration = robot.zero_configuration()
>>> group = robot.main_group_name
>>> next(robot.iter_inverse_kinematics(frame_WCF, start_configuration, group))      
Configuration((4.045, 5.130, -2.174, -6.098, -5.616, 6.283), (0, 0, 0, 0, 0, 0))