RobotArmLib  0.0.4
Robot Arm Library [WIP]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
matrix.h
Go to the documentation of this file.
1 
7 #ifndef RB_MATRIX_H_
8 #define RB_MATRIX_H_
9 #include "unit.h"
10 
11 #include <Eigen/Dense>
12 #include <Eigen/Geometry>
13 
14 namespace rb
15 {
16 namespace math
17 {
18 typedef Eigen::MatrixXd MatrixX;
19 typedef Eigen::Matrix3d Matrix3;
20 typedef Eigen::Matrix4d Matrix4;
21 
22 typedef Eigen::VectorXd VectorX;
23 typedef Eigen::Vector3d Vector3;
24 typedef Eigen::Vector4d Vector4;
25 
26 typedef Eigen::AngleAxisd AngleAxis;
27 
29 template <typename T, size_t R, size_t C>
30  using Array = Eigen::Array<T, R, C>;
31 
33 typedef Eigen::Array<double, 6, 1> Array6;
34 
44 inline Matrix4 homoTrans(const double& A, const double& alpha, const double& D, const double theta)
45 {
46  double ct = cos(DEG2RAD * theta);
47  double st = sin(DEG2RAD * theta);
48  double ca = cos(DEG2RAD * alpha);
49  double sa = sin(DEG2RAD * alpha);
50 
51  Matrix4 T;
52  T << ct, -st, 0, A,
53  st*ca, ct*ca, -sa, -sa*D,
54  st*sa, ct*sa, ca, ca*D,
55  0, 0, 0, 1;
56  return T;
57 }
58 
59 } // namespace math
60 } // namespace rb
61 
62 #endif // RB_MATRIX_H_
63 
Eigen::Array< T, R, C > Array
make Array as alias of Eigen::Array (class template)
Definition: matrix.h:30
Eigen::Matrix4d Matrix4
make Matrix4 as alias of Eigen::Matrix4d
Definition: matrix.h:20
Eigen::Vector4d Vector4
make Vector4 as alias of Eigen::Vector4d
Definition: matrix.h:24
Eigen::MatrixXd MatrixX
make MatrixX as alias of Eigen::MatrixXd
Definition: matrix.h:18
Eigen::Matrix3d Matrix3
make Matrix3 as alias of Eigen::Matrix3d
Definition: matrix.h:19
static const double DEG2RAD
Constant to present converting from degree to radian.
Definition: unit.h:22
Eigen::Vector3d Vector3
make Vector3 as alias of Eigen::Vector3d
Definition: matrix.h:23
A head file for converting units.
Eigen::AngleAxisd AngleAxis
make AngleAxis as alias of Eigen::AngleAxisd
Definition: matrix.h:26
Matrix4 homoTrans(const double &A, const double &alpha, const double &D, const double theta)
Compute homogeneous transformation matrix for given link properties, and return the matrix...
Definition: matrix.h:44
Eigen::Array< double, 6, 1 > Array6
make Array6 as alias of Eigen::Array<double, 6, 1>
Definition: matrix.h:33
Eigen::VectorXd VectorX
make VectorX as alias of Eigen::VectorXd
Definition: matrix.h:22