Class JacobianIKSolver


  • public class JacobianIKSolver
    extends IterativeIK
    A Jacobian based iterative inverse kinematics algorithm for devices with a single end effector.

    This algorithm does implicitly handle joint limits, however it is possible to force the solution within joint
    limits using clamping in each iterative step. If joint clamping is not enabled then this
    algorithm might contain joint values that are out of bounds.

    The method uses an Newton-Raphson iterative approach and is based on using the inverse of
    the device Jacobian to compute each local solution in each iteration. Several methods for
    calculating/approximating the inverse Jacobian are available, where the SVD method currently is
    the most stable, see the JacobianSolverType option for additional options.
    • Constructor Detail

      • JacobianIKSolver

        public JacobianIKSolver​(long cPtr,
                                boolean cMemoryOwn)
    • Method Detail

      • solve

        public VectorQ solve​(Transform3Dd baseTend,
                             State state)
        Calculates the inverse kinematics

        Given a desired transform
        and the current state, the method solves the inverse kinematics
        problem.

        If the algorithm is able to identify multiple solutions (e.g. elbow
        up and down) it will return all of these. Before returning a solution,
        they may be checked to be within the bounds of the configuration space.
        (See setCheckJointLimits(bool) )

        Overrides:
        solve in class InvKinSolver
        Parameters:
        baseTend - [in] Desired base to end transformation.

        state - [in] State of the device from which to start the
        iterations

        Returns:
        List of solutions. Notice that the list may be empty.

        Note: The targets baseTend must be defined relative to the base of the
        robot/device.
      • setInterpolatorStep

        public void setInterpolatorStep​(double interpolatorStep)
        sets the maximal step length that is allowed on the
        local search towards the solution.

        Parameters:
        interpolatorStep - [in] the interpolation step.
      • setEnableInterpolation

        public void setEnableInterpolation​(boolean enableInterpolation)
        the solver may fail or be very slow if the the solution is too far from the
        initial configuration. This function enables the use of via points generated using
        an interpolation from initial end effector configuration to the goal target.

        Parameters:
        enableInterpolation - [in] set true to enable interpolation, false otherwise
      • solveLocal

        public boolean solveLocal​(Transform3Dd bTed,
                                  double maxError,
                                  State state,
                                  int maxIter)
        performs a local search toward the target bTed. No via points
        are generated to support the convergence and robustness.

        Parameters:
        bTed - [in] the target end pose
        maxError - [in] the maximal allowed error
        state - [in/out] the starting position for the search. The end position will
        also be saved in this state.
        maxIter - [in] max number of iterations
        Returns:
        true if error is below max error

        Note: the result will be saved in state
      • setClampToBounds

        public void setClampToBounds​(boolean enableClamping)
        enables clamping of the solution such that solution always is within joint limits

        Parameters:
        enableClamping - [in] true to enable clamping, false otherwise
      • setSolverType

        public void setSolverType​(JacobianIKSolver.JacobianSolverType type)
        set the type of solver to use for stepping toward a solution

        Parameters:
        type - [in] the type of jacobian solver
      • setCheckJointLimits

        public void setCheckJointLimits​(boolean check)
        Specifies whether to check joint limits before returning a solution.

        Overrides:
        setCheckJointLimits in class InvKinSolver
        Parameters:
        check - [in] If true the method should perform a check that joints are within bounds.