feature-vector3.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 /* --------------------------------------------------------------------- */
11 /* --- INCLUDE --------------------------------------------------------- */
12 /* --------------------------------------------------------------------- */
13 
14 /* --- SOT --- */
15 // #define VP_DEBUG
16 // #define VP_DEBUG_MODE 45
17 #include <sot/core/debug.hh>
19 #include <sot/core/factory.hh>
22 
23 using namespace dynamicgraph::sot;
24 using namespace std;
25 using namespace dynamicgraph;
26 
28 
29 /* --------------------------------------------------------------------- */
30 /* --- CLASS ----------------------------------------------------------- */
31 /* --------------------------------------------------------------------- */
32 
33 FeatureVector3::FeatureVector3(const string &pointName)
34  : FeatureAbstract(pointName),
35  vectorSIN(NULL,
36  "sotFeatureVector3(" + name + ")::input(vector3)::vector"),
37  positionSIN(
38  NULL, "sotFeaturePoint6d(" + name + ")::input(matrixHomo)::position"),
39  articularJacobianSIN(
40  NULL, "sotFeatureVector3(" + name + ")::input(matrix)::Jq"),
41  positionRefSIN(
42  NULL, "sotFeatureVector3(" + name + ")::input(vector)::positionRef") {
45 
49 
51  << positionRefSIN);
52 }
53 
54 /* --------------------------------------------------------------------- */
55 /* --------------------------------------------------------------------- */
56 /* --------------------------------------------------------------------- */
57 
59  sotDEBUG(25) << "# In {" << endl;
60 
61  return dim = 3;
62 }
63 
64 /* --------------------------------------------------------------------- */
69  sotDEBUG(15) << "# In {" << endl;
70 
71  const Matrix &Jq = articularJacobianSIN(time);
72  const Vector &vect = vectorSIN(time);
73  const MatrixHomogeneous &M = positionSIN(time);
75  R = M.linear();
76 
77  Matrix Skew(3, 3);
78  Skew(0, 0) = 0;
79  Skew(0, 1) = -vect(2);
80  Skew(0, 2) = vect(1);
81  Skew(1, 0) = vect(2);
82  Skew(1, 1) = 0;
83  Skew(1, 2) = -vect(0);
84  Skew(2, 0) = -vect(1);
85  Skew(2, 1) = vect(0);
86  Skew(2, 2) = 0;
87 
88  Matrix RSk(3, 3);
89  RSk = R * Skew;
90 
91  J.resize(3, Jq.cols());
92  for (std::size_t i = 0; i < 3; ++i)
93  for (size_type j = 0; j < Jq.cols(); ++j) {
94  J(i, j) = 0;
95  for (std::size_t k = 0; k < 3; ++k) {
96  J(i, j) -= RSk(i, k) * Jq(k + 3, j);
97  }
98  }
99 
100  sotDEBUG(15) << "# Out }" << endl;
101  return J;
102 }
103 
108  sotDEBUGIN(15);
109 
110  const MatrixHomogeneous &M = positionSIN(time);
111  const Vector &vect = vectorSIN(time);
112  const Vector &vectdes = positionRefSIN(time);
113 
114  sotDEBUG(15) << "M = " << M << std::endl;
115  sotDEBUG(15) << "v = " << vect << std::endl;
116  sotDEBUG(15) << "vd = " << vectdes << std::endl;
117 
119  R = M.linear();
120  Mvect3.resize(3);
121  Mvect3 = R * vect;
122  Mvect3 -= vectdes;
123 
124  sotDEBUGOUT(15);
125  return Mvect3;
126 }
127 
128 void FeatureVector3::display(std::ostream &os) const {
129  os << "Vector3 <" << name << ">";
130 }
dynamicgraph::sot::FeatureVector3::display
virtual void display(std::ostream &os) const
Definition: feature-vector3.cpp:128
dynamicgraph::sot::FeatureVector3::computeError
virtual dynamicgraph::Vector & computeError(dynamicgraph::Vector &res, sigtime_t time)
Definition: feature-vector3.cpp:107
dynamicgraph::sot::FeatureVector3::computeJacobian
virtual dynamicgraph::Matrix & computeJacobian(dynamicgraph::Matrix &res, sigtime_t time)
Definition: feature-vector3.cpp:68
factory.hh
dynamicgraph::sot::FeatureVector3
Class that defines point-3d control feature.
Definition: feature-vector3.hh:47
dynamicgraph::sot::MatrixHomogeneous
Eigen::Transform< double, 3, Eigen::Affine > SOT_CORE_EXPORT MatrixHomogeneous
Definition: matrix-geometry.hh:75
dynamicgraph::sot::FeatureAbstract::errorSOUT
SignalTimeDependent< dynamicgraph::Vector, sigtime_t > errorSOUT
This signal returns the error between the desired value and the current value : .
Definition: feature-abstract.hh:185
dynamicgraph
J
J
i
int i
dynamicgraph::sot::FeatureVector3::positionSIN
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > positionSIN
Definition: feature-vector3.hh:58
dynamicgraph::Entity::name
std::string name
dynamicgraph::Matrix
Eigen::MatrixXd Matrix
R
R
dynamicgraph::sot::FeatureAbstract::jacobianSOUT
SignalTimeDependent< dynamicgraph::Matrix, sigtime_t > jacobianSOUT
Jacobian of the error wrt the robot state: .
Definition: feature-abstract.hh:193
dynamicgraph::sot::DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(FeaturePosture, "FeaturePosture")
dynamicgraph::sot::FeatureAbstract
This class gives the abstract definition of a feature.
Definition: feature-abstract.hh:76
debug.hh
sotDEBUGOUT
#define sotDEBUGOUT(level)
Definition: debug.hh:215
dim
int dim
dynamicgraph::sot::FeatureVector3::positionRefSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > positionRefSIN
Definition: feature-vector3.hh:60
dynamicgraph::sigtime_t
int64_t sigtime_t
dynamicgraph::SignalTimeDependent::addDependency
virtual void addDependency(const SignalBase< Time > &signal)
sotDEBUGIN
#define sotDEBUGIN(level)
Definition: debug.hh:214
M
M
dynamicgraph::size_type
Matrix::Index size_type
dynamicgraph::Vector
Eigen::VectorXd Vector
dynamicgraph::sot::FeatureVector3::articularJacobianSIN
dynamicgraph::SignalPtr< dynamicgraph::Matrix, sigtime_t > articularJacobianSIN
Definition: feature-vector3.hh:59
exception-feature.hh
matrix-geometry.hh
dynamicgraph::sot
dynamicgraph::sot::FeatureAbstract::getDimension
size_type getDimension(void) const
Shortest method.
Definition: feature-abstract.hh:121
dynamicgraph::sot::MatrixRotation
Eigen::Matrix< double, 3, 3 > SOT_CORE_EXPORT MatrixRotation
Definition: matrix-geometry.hh:76
dynamicgraph::sot::FeatureVector3::FeatureVector3
FeatureVector3(const std::string &name)
Definition: feature-vector3.cpp:33
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< sigtime_t > &signals)
dynamicgraph::sot::FeatureVector3::vectorSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > vectorSIN
Definition: feature-vector3.hh:57
feature-vector3.hh
compile.name
name
Definition: compile.py:23
sotDEBUG
#define sotDEBUG(level)
Definition: debug.hh:168


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31