kinematics-dynamics
ProductOfExponentials.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __PRODUCT_OF_EXPONENTIALS_HPP__
4 #define __PRODUCT_OF_EXPONENTIALS_HPP__
5 
6 #include <vector>
7 
8 #include <kdl/chain.hpp>
9 #include <kdl/frames.hpp>
10 #include <kdl/jntarray.hpp>
11 
12 #include "MatrixExponential.hpp"
13 
14 namespace roboticslab
15 {
16 
28 {
29 public:
35  explicit PoeExpression(const KDL::Frame & H_S_T = KDL::Frame::Identity()) : H_S_T(H_S_T) {}
36 
47  void append(const MatrixExponential & exp, const KDL::Frame & H_new_old = KDL::Frame::Identity())
48  { exps.push_back(exp.cloneWithBase(H_new_old)); }
49 
61  void append(const PoeExpression & poe, const KDL::Frame & H_new_old = KDL::Frame::Identity());
62 
68  const KDL::Frame & getTransform() const
69  { return H_S_T; }
70 
76  int size() const
77  { return exps.size(); }
78 
87  { return exps.at(i); }
88 
97  void changeBaseFrame(const KDL::Frame & H_new_old);
98 
104  void changeToolFrame(const KDL::Frame & H_new_old)
105  { H_S_T = H_S_T * H_new_old; }
106 
116  bool evaluate(const KDL::JntArray & q, KDL::Frame & H) const;
117 
126  void reverseSelf();
127 
138  PoeExpression makeReverse() const;
139 
147  KDL::Chain toChain() const;
148 
158  static PoeExpression fromChain(const KDL::Chain & chain);
159 
160 private:
161  std::vector<MatrixExponential> exps;
162  KDL::Frame H_S_T;
163 };
164 
165 } // namespace roboticslab
166 
167 #endif // __PRODUCT_OF_EXPONENTIALS_HPP__
Abstraction of a term in a product of exponentials (POE) formula.
Definition: MatrixExponential.hpp:19
MatrixExponential cloneWithBase(const KDL::Frame &H_new_old) const
Clones this instance and refers the internal coordinates of the screw to a different base.
Definition: MatrixExponential.cpp:70
Abstraction of a product of exponentials (POE) formula.
Definition: ProductOfExponentials.hpp:28
KDL::Chain toChain() const
Makes a KDL::Chain from this instance.
Definition: ProductOfExponentials.cpp:138
void reverseSelf()
Inverts this POE formula.
Definition: ProductOfExponentials.cpp:104
bool evaluate(const KDL::JntArray &q, KDL::Frame &H) const
Performs forward kinematics.
Definition: ProductOfExponentials.cpp:82
static PoeExpression fromChain(const KDL::Chain &chain)
Builds a PoeExpression from a KDL::Chain.
Definition: ProductOfExponentials.cpp:167
void changeBaseFrame(const KDL::Frame &H_new_old)
Refers the internal coordinates of this POE to a different base.
Definition: ProductOfExponentials.cpp:70
const MatrixExponential & exponentialAtJoint(int i) const
Retrieves a term of the POE formula.
Definition: ProductOfExponentials.hpp:86
const KDL::Frame & getTransform() const
Retrieves the transformation between base and tool frames.
Definition: ProductOfExponentials.hpp:68
void append(const MatrixExponential &exp, const KDL::Frame &H_new_old=KDL::Frame::Identity())
Appends a new term to this POE formula.
Definition: ProductOfExponentials.hpp:47
int size() const
Size of this POE.
Definition: ProductOfExponentials.hpp:76
PoeExpression(const KDL::Frame &H_S_T=KDL::Frame::Identity())
Constructor.
Definition: ProductOfExponentials.hpp:35
PoeExpression makeReverse() const
Creates a new POE entity from the inverse of this POE formula.
Definition: ProductOfExponentials.cpp:118
void changeToolFrame(const KDL::Frame &H_new_old)
Updates the tool frame.
Definition: ProductOfExponentials.hpp:104
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6