Package org.robwork.sdurw_invkin
Class IKMetaSolver
- java.lang.Object
-
- org.robwork.sdurw_invkin.InvKinSolver
-
- org.robwork.sdurw_invkin.IterativeIK
-
- org.robwork.sdurw_invkin.IKMetaSolver
-
public class IKMetaSolver extends IterativeIK
Solve the inverse kinematics problem with respect to joint limits and
collisions.
Given an arbitrary iterative inverse kinematics solver, the IKMetaSolver
attempts to find a collision free solution satisfying joint limits. It
repeatingly calls the iterative solver with new random start configurations
until either a solution is found or a specified max attempts has been
reached.
Usage example:
// create a inverse kinematics solver for your dvs. here we use ResolvedRateSolver ResolvedRateSolver iksolver(&myDevice); // takes a pointer to your device // if we want colision free ik results then create or get the collisiondetector CollisionDetector *detector = NULL; // here we don't care about collisions // now create the meta solver IKMetaSolver mSolver(&iksolver, &myDevice, detector); // the pose that you want the endeffector to be in Transform3D<> pose(Vector3D<>(0,0,1),RPY<>(1,0,0)); // and use it to generate joint configurations std::vector<Q> result; result = mSolver.solve( pose , state, 200, true );
-
-
Constructor Summary
Constructors Constructor Description IKMetaSolver(long cPtr, boolean cMemoryOwn)
IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver.IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device, SWIGTYPE_p_rw__core__PtrT_rw__pathplanning__QConstraint_t constraint)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver.IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device, SWIGTYPE_p_rw__core__PtrT_rw__proximity__CollisionDetector_t collisionDetector)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
static long
getCPtr(IKMetaSolver obj)
FrameCPtr
getTCP()
Returns the Tool Center Point (TCP) used when solving the IK problem.
void
setCheckJointLimits(boolean check)
Specifies whether to check joint limits before returning a solution.
void
setMaxAttempts(long maxAttempts)
Sets up the maximal number of attemptsvoid
setProximityLimit(double limit)
Sets the distance for which two solutions are considered the same.
For distance measure an infinite norm is used.void
setStopAtFirst(boolean stopAtFirst)
Sets whether to stop searching after the first solutionVectorQ
solve(Transform3D baseTend, State state)
Searches for a valid solution using the parameters set in the IKMetaSolverVectorQ
solve(Transform3D baseTend, State state, long cnt, boolean stopatfirst)
Solves the inverse kinematics problem
Tries to solve the inverse kinematics problem using the iterative
inverse kinematics solver provided in the constructor.-
Methods inherited from class org.robwork.sdurw_invkin.IterativeIK
getCPtr, getMaxError, getMaxIterations, getProperties, makeDefault, setMaxError, setMaxIterations
-
Methods inherited from class org.robwork.sdurw_invkin.InvKinSolver
getCPtr
-
-
-
-
Constructor Detail
-
IKMetaSolver
public IKMetaSolver(long cPtr, boolean cMemoryOwn)
-
IKMetaSolver
public IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device, SWIGTYPE_p_rw__core__PtrT_rw__proximity__CollisionDetector_t collisionDetector)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver. The IKMetaSolver
does NOT take ownership of the collisionDetector. To skip testing for
collision use null as collision detector
- Parameters:
iksolver
- [in] The basic iksolver to use. Ownership is takendevice
- [in] Device to solve for
collisionDetector
- [in] CollisionDetector to use. If null no
collision detection used.
-
IKMetaSolver
public IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver. The IKMetaSolver
does NOT take ownership of the collisionDetector. To skip testing for
collision use null as collision detector
- Parameters:
iksolver
- [in] The basic iksolver to use. Ownership is takendevice
- [in] Device to solve for
-
IKMetaSolver
public IKMetaSolver(IterativeIKPtr iksolver, DevicePtr device, SWIGTYPE_p_rw__core__PtrT_rw__pathplanning__QConstraint_t constraint)
Constructs IKMetaSolver
The IKMetaSolver takes ownership of the iksolver. To skip testing for
feasibility set constraint to NULL.
- Parameters:
iksolver
- [in] The basic iksolver to use. Ownership is takendevice
- [in] Device to solve for
constraint
- [in] QConstraint pointer to use. If null no
constraints is applied
-
-
Method Detail
-
getCPtr
public static long getCPtr(IKMetaSolver obj)
-
delete
public void delete()
- Overrides:
delete
in classIterativeIK
-
solve
public VectorQ solve(Transform3D baseTend, State state)
Searches for a valid solution using the parameters set in the IKMetaSolver- Overrides:
solve
in classInvKinSolver
- Parameters:
baseTend
- [in] Desired base to end transformation \robabx{}{desired}{\mathbf{T}}
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.
-
setMaxAttempts
public void setMaxAttempts(long maxAttempts)
Sets up the maximal number of attempts- Parameters:
maxAttempts
- [in] Maximal number of attempts
-
setStopAtFirst
public void setStopAtFirst(boolean stopAtFirst)
Sets whether to stop searching after the first solution- Parameters:
stopAtFirst
- [in] True to stop after first solution has been found
-
setProximityLimit
public void setProximityLimit(double limit)
Sets the distance for which two solutions are considered the same.
For distance measure an infinite norm is used. Default value is set to 1e-5.
Set limit < 0 to allow doublets in the solution.
- Parameters:
limit
- [in] The proximity limit.
-
setCheckJointLimits
public void setCheckJointLimits(boolean check)
Description copied from class:InvKinSolver
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.
-
solve
public VectorQ solve(Transform3D baseTend, State state, long cnt, boolean stopatfirst)
Solves the inverse kinematics problem
Tries to solve the inverse kinematics problem using the iterative
inverse kinematics solver provided in the constructor. It tries at
most cnt times and can either be stopped after the first solution
is found or continue to search for solutions. If multiple solutions
are returned there might be duplicates in the list.
- Parameters:
baseTend
- [in] Desired base to end transformstate
- [in] State of the workcellcnt
- [in] Maximal number of attempts
stopatfirst
- [in] If true the method will return after the first
solution is found. If false it will continue searching for more solution
until the maximal number of attemps is met.
-
getTCP
public FrameCPtr getTCP()
Description copied from class:InvKinSolver
Returns the Tool Center Point (TCP) used when solving the IK problem.
- Overrides:
getTCP
in classInvKinSolver
- Returns:
- The TCP Frame used when solving the IK.
-
-