Package org.robwork.sdurw
Class JacobianIKSolver
- java.lang.Object
-
- org.robwork.sdurw.InvKinSolver
-
- org.robwork.sdurw.IterativeIK
-
- org.robwork.sdurw.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JacobianIKSolver.JacobianSolverType
the type of jacobian solver
-
Constructor Summary
Constructors Constructor Description JacobianIKSolver(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
static long
getCPtr(JacobianIKSolver obj)
void
setCheckJointLimits(boolean check)
Specifies whether to check joint limits before returning a solution.
void
setClampToBounds(boolean enableClamping)
enables clamping of the solution such that solution always is within joint limits
void
setEnableInterpolation(boolean enableInterpolation)
the solver may fail or be very slow if the the solution is too far from the
initial configuration.void
setInterpolatorStep(double interpolatorStep)
sets the maximal step length that is allowed on the
local search towards the solution.
void
setSolverType(JacobianIKSolver.JacobianSolverType type)
set the type of solver to use for stepping toward a solution
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.boolean
solveLocal(Transform3Dd bTed, double maxError, State state, int maxIter)
performs a local search toward the target bTed.-
Methods inherited from class org.robwork.sdurw.IterativeIK
getCPtr, getMaxError, getMaxIterations, getProperties, makeDefault, setMaxError, setMaxIterations
-
Methods inherited from class org.robwork.sdurw.InvKinSolver
getCPtr, getTCP
-
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(JacobianIKSolver obj)
-
delete
public void delete()
- Overrides:
delete
in classIterativeIK
-
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 classInvKinSolver
- 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 posemaxError
- [in] the maximal allowed errorstate
- [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 classInvKinSolver
- Parameters:
check
- [in] If true the method should perform a check that joints are within bounds.
-
-