tinyrobotics
|
Contains inverse kinematics algorithms. More...
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <nlopt.hpp>
#include <unsupported/Eigen/AutoDiff>
#include "kinematics.hpp"
#include "math.hpp"
#include "model.hpp"
Go to the source code of this file.
Classes | |
struct | tinyrobotics::InverseKinematicsOptions< Scalar, nq > |
Options for inverse kinematics solver. More... | |
Typedefs | |
template<typename Scalar , int nv> | |
using | tinyrobotics::ObjectiveFunction = std::function< Scalar(const Eigen::Matrix< Scalar, nv, 1 > &, Eigen::Matrix< Scalar, nv, 1 > &, void *)> |
Type definition for an objective function that takes an Eigen vector as input and returns a scalar value. | |
Enumerations | |
enum class | tinyrobotics::InverseKinematicsMethod { JACOBIAN , NLOPT , LEVENBERG_MARQUARDT , PARTICLE_SWARM , BFGS } |
Solver methods for inverse kinematics. More... | |
Functions | |
template<typename Scalar , int n> | |
void | tinyrobotics::eigen_to_nlopt (const Eigen::Matrix< Scalar, n, 1 > &eigen_vec, std::vector< Scalar > &nlopt_vec) |
Converts an Eigen vector to an std::vector. | |
template<typename Scalar , int n> | |
void | tinyrobotics::nlopt_to_eigen (const std::vector< Scalar > &nlopt_vec, Eigen::Matrix< Scalar, n, 1 > &eigen_vec) |
Converts an std::vector to an Eigen vector. | |
template<typename Scalar , int nv> | |
Scalar | tinyrobotics::eigen_objective_wrapper (unsigned n, const Scalar *x, Scalar *grad, void *data) |
Wrapper function that converts input and output between NLopt and Eigen formats for an objective function. | |
template<typename Scalar , int nq> | |
Scalar | tinyrobotics::cost (const Eigen::Matrix< Scalar, nq, 1 > &q, Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > &q0, Eigen::Matrix< Scalar, nq, 1 > &gradient, const InverseKinematicsOptions< Scalar, nq > &options) |
Cost function for general inverse kinematics with analytical jacobian. | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics_nlopt (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using NLopt. | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics_jacobian (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using the Jacobian method. | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics_levenberg_marquardt (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using the Levenberg-Marquardt method. | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics_pso (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using Particle Swarm Optimization. | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics_bfgs (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using Broyden-Fletcher-Goldfarb-Shanno (BFGS). | |
template<typename Scalar , int nq> | |
Eigen::Matrix< Scalar, nq, 1 > | tinyrobotics::inverse_kinematics (Model< Scalar, nq > &model, const std::string &target_link_name, const std::string &source_link_name, const Eigen::Transform< Scalar, 3, Eigen::Isometry > &desired_pose, const Eigen::Matrix< Scalar, nq, 1 > q0, const InverseKinematicsOptions< Scalar, nq > &options) |
Solves the inverse kinematics problem between two links using user specified method. | |
Contains inverse kinematics algorithms.
using tinyrobotics::ObjectiveFunction = typedef std::function<Scalar(const Eigen::Matrix<Scalar, nv, 1>&, Eigen::Matrix<Scalar, nv, 1>&, void*)> |
Type definition for an objective function that takes an Eigen vector as input and returns a scalar value.
Scalar | The scalar type of the Eigen vector and the scalar return value. |
nv | The size of the Eigen vector. |
|
strong |
Scalar tinyrobotics::cost | ( | const Eigen::Matrix< Scalar, nq, 1 > & | q, |
Model< Scalar, nq > & | model, | ||
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > & | q0, | ||
Eigen::Matrix< Scalar, nq, 1 > & | gradient, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Cost function for general inverse kinematics with analytical jacobian.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | Initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
|
inline |
Wrapper function that converts input and output between NLopt and Eigen formats for an objective function.
n | The size of the input vector. |
x | The input vector in NLopt format. |
grad | The gradient vector in NLopt format. |
data | Pointer to additional data that is passed to the objective function. |
Scalar | The scalar type of the Eigen vector and the scalar return value. |
nv | The size of the Eigen vector. |
|
inline |
Converts an Eigen vector to an std::vector.
eigen_vec | The Eigen vector to convert. |
nlopt_vec | The resulting std::vector. |
Scalar | The scalar type of the Eigen vector. |
n | The size of the Eigen vector. |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using user specified method.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics_bfgs | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using Broyden-Fletcher-Goldfarb-Shanno (BFGS).
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics_jacobian | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using the Jacobian method.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics_levenberg_marquardt | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using the Levenberg-Marquardt method.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics_nlopt | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using NLopt.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
Eigen::Matrix< Scalar, nq, 1 > tinyrobotics::inverse_kinematics_pso | ( | Model< Scalar, nq > & | model, |
const std::string & | target_link_name, | ||
const std::string & | source_link_name, | ||
const Eigen::Transform< Scalar, 3, Eigen::Isometry > & | desired_pose, | ||
const Eigen::Matrix< Scalar, nq, 1 > | q0, | ||
const InverseKinematicsOptions< Scalar, nq > & | options | ||
) |
Solves the inverse kinematics problem between two links using Particle Swarm Optimization.
model | tinyrobotics model. |
target_link_name | {t} Link to which the transform is computed. |
source_link_name | {s} Link from which the transform is computed. |
desired_pose | Desired pose of the target link in the source link frame. |
q0 | The initial guess for the configuration vector. |
Scalar | type of the tinyrobotics model. |
nq | Number of configuration coordinates (degrees of freedom). |
|
inline |
Converts an std::vector to an Eigen vector.
nlopt_vec | The std::vector to convert. |
eigen_vec | The resulting Eigen vector. |
Scalar | The scalar type of the Eigen vector. |
n | The size of the Eigen vector. |