Inverse Kinematics

Compute joint configurations to achieve an end-effector pose

Libraries:
Robotics System Toolbox / Manipulator Algorithms

Description

The Inverse Kinematics block uses an inverse kinematic (IK) solver to calculate joint configurations for a desired end-effector pose based on a specified rigid body tree model. Create a rigid body tree model for your robot using the `rigidBodyTree` class. The rigid body tree model defines all the joint constraints that the solver enforces.

Specify the `RigidBodyTree` parameter and the desired end effector inside the block mask. You can also tune the algorithm parameters in the Solver Parameters tab.

Input the desired end-effector Pose, the Weights on pose tolerance, and an InitialGuess for the joint configuration. The solver outputs a robot configuration, Config, that satisfies the end-effector pose within the tolerances specified in the Solver Parameters tab.

Ports

Input

expand all

End-effector pose, specified as a 4-by-4 homogeneous transform. This transform defines the desired position and orientation of the rigid body specified in the End effector parameter.

Data Types: `single` | `double`

Weights for pose tolerances, specified as a six-element vector. The first three elements of the vector correspond to the weights on the error in orientation for the desired pose. The last three elements of the vector correspond to the weights on the error in the xyz position for the desired pose.

Data Types: `single` | `double`

Initial guess of robot configuration, specified as a vector of joint positions. The number of positions is equal to the number of nonfixed joints in the Rigid body tree parameter. Use this initial guess to help guide the solver to a desired robot configuration. However, the solution is not guaranteed to be close to this initial guess.

Data Types: `single` | `double`

Output

expand all

Robot configuration that solves the desired end-effector pose, specified as a vector. A robot configuration is a vector of joint positions for the rigid body tree model. The number of positions is equal to the number of nonfixed joints in the Rigid body tree parameter.

Data Types: `single` | `double`

Solution information, returned as a bus. The solution information bus contains these elements:

• `Iterations` — Number of iterations run by the algorithm.

• `PoseErrorNorm` — The magnitude of the error between the pose of the end effector in the solution and the desired end-effector pose.

• `ExitFlag` — Code that gives more details on the algorithm execution and what caused it to return. For the exit flags of each algorithm type, see Exit Flags.

• `Status` — Character vector describing whether the solution is within the tolerance (`1`) or is the best possible solution the algorithm could find (`2`).

Parameters

expand all

Block Parameters

Rigid body tree model, specified as a `rigidBodyTree` object. Create the robot model in the MATLAB® workspace before specifying in the block mask.

End-effector name for desired pose. To see a list of bodies on the `rigidBodyTree` object, specify the Rigid body tree parameter, then click .

Select to enable the Info port and get diagnostic info for the solver solution.

Solver Parameters

Algorithm for solving inverse kinematics, specified as either `'BFGSGradientProjection'` or `'LevenbergMarquardt'`. For details of each algorithm, see Inverse Kinematics Algorithms.

Select to enforce the joint limits specified in the Rigid body tree model.

Maximum number of iterations to optimize the solution, specified as a positive integer. Increasing the number of iterations can improve the solution at the cost of execution time.

Maximum number of seconds that the algorithm runs before timing out, specified as a positive scalar. Increasing the maximum time can improve the solution at the cost of execution time.

Threshold on the gradient of the cost function, specified as a positive scalar. The algorithm stops if the magnitude of the gradient falls below this threshold. A low gradient magnitude usually indicates that the solver has converged to a solution.

Threshold on the magnitude of the error between the end-effector pose generated from the solution and the desired pose, specified as a positive scalar. The `Weights` specified for each component of the pose are included in this calculation.

Minimum step size allowed by the solver, specified as a positive scalar. Smaller step sizes usually mean that the solution is close to convergence.

Threshold on the change in end-effector pose error between iterations, specified as a positive scalar. The algorithm returns if the changes in all elements of the pose error are smaller than this threshold.

Dependencies

This parameter is enabled when the Solver is `Levenberg-Marquadt`.

Select the check box to enable error damping, then specify the ```Damping bias``` parameter.

Dependencies

This parameter is enabled when the Solver is `Levenberg-Marquadt`.

Damping on cost function, specified as a positive scalar. The Levenberg-Marquadt algorithm has a damping feature controlled by this scalar that works with the cost function to control the rate of convergence.

Dependencies

This parameter is enabled when the Solver is `Levenberg-Marquadt` and Use error damping is `on`.

• `Interpreted execution` — Simulate model using the MATLAB interpreter. This option shortens startup time but has a slower simulation speed than `Code generation`. In this mode, you can debug the source code of the block.

• `Code generation` — Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time, but the speed of the subsequent simulations is comparable to `Interpreted execution`.

Tunable: No

References

[1] Badreddine, Hassan, Stefan Vandewalle, and Johan Meyers. "Sequential Quadratic Programming (SQP) for Optimal Control in Direct Numerical Simulation of Turbulent Flow." Journal of Computational Physics. 256 (2014): 1–16. doi:10.1016/j.jcp.2013.08.044.

[2] Bertsekas, Dimitri P. Nonlinear Programming. Belmont, MA: Athena Scientific, 1999.

[3] Goldfarb, Donald. "Extension of Davidon’s Variable Metric Method to Maximization Under Linear Inequality and Equality Constraints." SIAM Journal on Applied Mathematics. Vol. 17, No. 4 (1969): 739–64. doi:10.1137/0117067.

[4] Nocedal, Jorge, and Stephen Wright. Numerical Optimization. New York, NY: Springer, 2006.

[5] Sugihara, Tomomichi. "Solvability-Unconcerned Inverse Kinematics by the Levenberg–Marquardt Method." IEEE Transactions on Robotics. Vol. 27, No. 5 (2011): 984–91. doi:10.1109/tro.2011.2148230.

[6] Zhao, Jianmin, and Norman I. Badler. "Inverse Kinematics Positioning Using Nonlinear Programming for Highly Articulated Figures." ACM Transactions on Graphics. Vol. 13, No. 4 (1994): 313–36. doi:10.1145/195826.195827.

Version History

Introduced in R2018b