tinyrobotics
Loading...
Searching...
No Matches
Kinematics.hpp File Reference

Contains functions for computing various kinematic quantities of a tinyrobotics model. More...

#include <Eigen/Core>
#include <Eigen/Geometry>
#include "Math.hpp"
#include "Model.hpp"

Go to the source code of this file.

Functions

template<typename Scalar , int nq, typename TargetLink >
const int tinyrobotics::get_link_idx (const Model< Scalar, nq > &model, const TargetLink &target_link)
 Retrieves the index of the target link in the tinyrobotics model.
 
template<typename Scalar , int nq>
std::vector< Eigen::Transform< Scalar, 3, Eigen::Isometry > > tinyrobotics::forward_kinematics (Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q)
 Computes the transform to all the links in the tinyrobotics model.
 
template<typename Scalar , int nq, typename TargetLink >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link)
 Computes the transform to the target from the base link.
 
template<typename Scalar , int nq, typename TargetLink , typename SourceLink >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link, const SourceLink &source_link)
 Computes the homogeneous transform from a source to target link.
 
template<typename Scalar , int nq>
std::vector< Eigen::Transform< Scalar, 3, Eigen::Isometry > > tinyrobotics::forward_kinematics_com (Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q)
 Computes the transform to centre of mass of all the links in the tinyrobotics model.
 
template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics_com (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link, const SourceLink &source_link=0)
 Computes the transform between source link {s} and target {t} centre of mass (CoM) {c}.
 
template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::translation (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link, const SourceLink &source_link=0)
 Computes the translation of the target link from the source link in the source link frame.
 
template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 3 > tinyrobotics::rotation (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link, const SourceLink &source_link=0)
 Computes the rotation matrix between the target link and the source link in the source link frame.
 
template<typename Scalar , int nq, typename TargetLink >
Eigen::Matrix< Scalar, 6, nq > tinyrobotics::geometric_jacobian (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link)
 Computes the geometric jacobian of the target link from the base link in the base link frame.
 
template<typename Scalar , int nq, typename TargetLink >
Eigen::Matrix< Scalar, 6, nq > tinyrobotics::geometric_jacobian_com (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const TargetLink &target_link)
 Computes the geometric jacobian relative to the base for the specified target link's center of mass.
 
template<typename Scalar , int nq, typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::centre_of_mass (const Model< Scalar, nq > &model, const Eigen::Matrix< Scalar, nq, 1 > &q, const SourceLink &source_link=0)
 Computes the centre of mass expressed in source link frame.
 

Detailed Description

Contains functions for computing various kinematic quantities of a tinyrobotics model.

Function Documentation

◆ centre_of_mass()

template<typename Scalar , int nq, typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::centre_of_mass ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const SourceLink &  source_link = 0 
)

Computes the centre of mass expressed in source link frame.

Parameters
modeltinyrobotics model.
qThe configuration vector of the robot model.
source_linkSource link, which can be an integer (index) or a string (name), from which the centre of mass is expressed.
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
SourceLinkType of source_link parameter, which can be int or std::string.
Returns
The centre of mass position expressed in source link frame.

◆ forward_kinematics() [1/3]

template<typename Scalar , int nq, typename TargetLink >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link 
)

Computes the transform to the target from the base link.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
Returns
Homogeneous transform between the base and the target link.

◆ forward_kinematics() [2/3]

template<typename Scalar , int nq, typename TargetLink , typename SourceLink >
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link,
const SourceLink &  source_link 
)

Computes the homogeneous transform from a source to target link.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
source_linkSource link, which can be an integer (index) or a string (name).
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
SourceLinkType of source_link parameter, which can be int or std::string.
Returns
Homogeneous transform from source {s} to target {t} link.

◆ forward_kinematics() [3/3]

template<typename Scalar , int nq>
std::vector< Eigen::Transform< Scalar, 3, Eigen::Isometry > > tinyrobotics::forward_kinematics ( Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q 
)

Computes the transform to all the links in the tinyrobotics model.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
Returns
Stores the transform to all the links in model.data.forward_kinematics.

◆ forward_kinematics_com() [1/2]

template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Transform< Scalar, 3, Eigen::Isometry > tinyrobotics::forward_kinematics_com ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link,
const SourceLink &  source_link = 0 
)

Computes the transform between source link {s} and target {t} centre of mass (CoM) {c}.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
source_linkSource link, which can be an integer (index) or a string (name).
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
SourceLinkType of source_link parameter, which can be int or std::string.
Returns
Homogeneous transform from source link {s} to target link centre of mass {c}.

◆ forward_kinematics_com() [2/2]

template<typename Scalar , int nq>
std::vector< Eigen::Transform< Scalar, 3, Eigen::Isometry > > tinyrobotics::forward_kinematics_com ( Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q 
)

Computes the transform to centre of mass of all the links in the tinyrobotics model.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
Returns
Stores the transform to all the links in model.data.forward_kinematics.

◆ geometric_jacobian()

template<typename Scalar , int nq, typename TargetLink >
Eigen::Matrix< Scalar, 6, nq > tinyrobotics::geometric_jacobian ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link 
)

Computes the geometric jacobian of the target link from the base link in the base link frame.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
Returns
The geometric jacobian of the target link from the base link in the base link frame.

◆ geometric_jacobian_com()

template<typename Scalar , int nq, typename TargetLink >
Eigen::Matrix< Scalar, 6, nq > tinyrobotics::geometric_jacobian_com ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link 
)

Computes the geometric jacobian relative to the base for the specified target link's center of mass.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
Returns
The geometric jacobian of the target link from the base link in the base link frame.

◆ get_link_idx()

template<typename Scalar , int nq, typename TargetLink >
const int tinyrobotics::get_link_idx ( const Model< Scalar, nq > &  model,
const TargetLink &  target_link 
)

Retrieves the index of the target link in the tinyrobotics model.

Parameters
modeltinyrobotics model.
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
Returns
Index of the target link in the model.
Exceptions
std::invalid_argumentif the TargetLink type is not int or std::string.

◆ rotation()

template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 3 > tinyrobotics::rotation ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link,
const SourceLink &  source_link = 0 
)

Computes the rotation matrix between the target link and the source link in the source link frame.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
source_linkSource link, which can be an integer (index) or a string (name).
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
SourceLinkType of source_link parameter, which can be int or std::string.
Returns
Rotation matrix between the target link and the source link in the source link frame.

◆ translation()

template<typename Scalar , int nq, typename TargetLink , typename SourceLink = int>
Eigen::Matrix< Scalar, 3, 1 > tinyrobotics::translation ( const Model< Scalar, nq > &  model,
const Eigen::Matrix< Scalar, nq, 1 > &  q,
const TargetLink &  target_link,
const SourceLink &  source_link = 0 
)

Computes the translation of the target link from the source link in the source link frame.

Parameters
modeltinyrobotics model.
qJoint configuration of the robot.
source_linkSource link, which can be an integer (index) or a string (name).
target_linkTarget link, which can be an integer (index) or a string (name).
Template Parameters
Scalartype of the tinyrobotics model.
nqNumber of configuration coordinates (degrees of freedom).
TargetLinkType of target_link parameter, which can be int or std::string.
SourceLinkType of source_link parameter, which can be int or std::string.
Returns
Translation of the target link from the source link in the source link frame.