AUTh-ARL Core Stack  0.7
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Using Eigen and its plugins

In this Module you will find documentation for the Eigen Plugins that we have implemented. The purpose of the plugins is to expand the functionality of Eigen library in order to fit our needs and to be compliant with the syntactic conventions of Eigen.

In order to use the plugins you should include the autharl_core/eigen_plugins.h header before you include any other Eigen header file.

#include <autharl_core/eigen_plugins.h>

You can also include the main header file of the Core which do that for you:

#include <autharl_core>

Eigen Matrix Plugins

Each Eigen Matrix include a constructor from an Armadillo matrix. Thus the following statements will parse an Armadillo matrix to an Eigen Matrix (the same applies for vectors):

Eigen::MatrixXd eigen;
arma::mat arma;
eigen = Eigen::MatrixXd(arma);
eigen = arma; // The = operator is overloaded implicitly.

You can parse an Eigen Matrix or Vector to Armadillo:

Eigen::MatrixXd eigen;
arma::mat arma = eigen.toArma();

Calculate the skew symmetric of a matrix:

Eigen::Vector3d v;
Eigen::Matrix3d skew = v.skewSymmetric();

Calculate the pseudo inverse of a matrix:

Eigen::MatrixXd m;
// Fill matrix ...
Eigen::MatrixXd pinv = m.pinv();

Eigen Quaternion Plugins

Parse an Armadillo 4x1 vector representing a quaternion (w, x, y, z) to Eigen Quaternion:

arma::vec quat;
quat << 1 << 0 << 0 << 0;
Eigen::Quaterniond quat_eigen(quat);

Parse an Eigen Quaternion to Armadillo vector (w, x, y, z):

Eigen::Quaterniond q;
arma::vec arma_q = q.toArma();

Calculate the quaternion error between two quaternions:

Eigen::Quaterniond q1, q2;
// Fill quats ...
Eigen::Vector3d error = q1.error(q2);

Type Definitions

Due to the fact we use 6x1 vectors (wrenches, twists), for convinience we have the following typedefs:

typedef Eigen::Matrix<double, 6, 1> Vector6d;
typedef Eigen::Matrix<float, 6, 1> Vector6f;
typedef Eigen::Matrix<double, 6, 6> Matrix6d;
typedef Eigen::Matrix<float, 6, 6> Matrix6f;