test_feature_generic.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 /* -------------------------------------------------------------------------- */
11 /* --- INCLUDES ------------------------------------------------------------- */
12 /* -------------------------------------------------------------------------- */
13 #include <iostream>
14 #include <pinocchio/algorithm/frames.hpp>
15 #include <pinocchio/algorithm/jacobian.hpp>
16 #include <pinocchio/algorithm/joint-configuration.hpp>
17 #include <pinocchio/algorithm/kinematics.hpp>
18 #include <pinocchio/multibody/data.hpp>
19 #include <pinocchio/multibody/liegroup/liegroup.hpp>
20 #include <pinocchio/multibody/model.hpp>
21 #include <pinocchio/parsers/sample-models.hpp>
22 
23 #define BOOST_TEST_MODULE features
24 #include <dynamic-graph/factory.h>
26 
27 #include <Eigen/SVD>
28 #include <boost/test/unit_test.hpp>
29 #include <sot/core/debug.hh>
32 #include <sot/core/feature-pose.hh>
34 #include <sot/core/sot.hh>
35 #include <sot/core/task.hh>
36 
37 namespace dynamicgraph {
38 namespace sot {
39 namespace dg = dynamicgraph;
40 
46 
47 namespace internal {
48 template <Representation_t representation>
49 struct LG_t {
50  typedef typename boost::mpl::if_c<representation == SE3Representation, SE3_t,
52 };
53 } // namespace internal
54 } // namespace sot
55 } // namespace dynamicgraph
56 
57 using namespace std;
58 using namespace dynamicgraph::sot;
59 using namespace dynamicgraph;
60 
61 #define EIGEN_VECTOR_IS_APPROX(Va, Vb, precision) \
62  BOOST_CHECK_MESSAGE((Va).isApprox(Vb, precision), \
63  "check " #Va ".isApprox(" #Vb \
64  ") failed " \
65  "[\n" \
66  << (Va).transpose() << "\n!=\n" \
67  << (Vb).transpose() << "\n]")
68 #define EIGEN_MATRIX_IS_APPROX(Va, Vb, precision) \
69  BOOST_CHECK_MESSAGE((Va).isApprox(Vb, precision), "check " #Va \
70  ".isApprox(" #Vb \
71  ") failed " \
72  "[\n" \
73  << (Va) << "\n!=\n" \
74  << (Vb) << "\n]")
75 
77  public:
79  int time_;
81 
82  FeatureTestBase(unsigned dim, const std::string &name)
83  : task_("task" + name), time_(0) {
84  expectedTaskOutput_.resize(dim);
85  }
86 
87  virtual void init() {
88  task_.addFeature(featureAbstract());
89  task_.setWithDerivative(true);
90  }
91 
92  void computeExpectedTaskOutput(const Vector &error,
93  const Vector &errorDrift) {
94  double gain = task_.controlGainSIN;
95  expectedTaskOutput_ = -gain * error - errorDrift;
96  }
97 
98  template <typename LG_t>
99  void computeExpectedTaskOutput(const Vector &s, const Vector &sdes,
100  const Vector &sDesDot, const LG_t &lg) {
101  Vector s_sd(lg.nv());
102  lg.difference(sdes, s, s_sd);
103 
104  Eigen::Matrix<typename LG_t::Scalar, LG_t::NV, LG_t::NV> Jminus(lg.nv(),
105  lg.nv());
106  lg.template dDifference<pinocchio::ARG0>(sdes, s, Jminus);
107 
108  computeExpectedTaskOutput(s_sd, Jminus * sDesDot);
109  }
110 
112  BOOST_REQUIRE_EQUAL(task_.taskSOUT.accessCopy().size(),
113  expectedTaskOutput_.size());
114  Vector taskOutput(expectedTaskOutput_.size());
115  for (int i = 0; i < expectedTaskOutput_.size(); ++i)
116  taskOutput[i] = task_.taskSOUT.accessCopy()[i].getSingleBound();
117  EIGEN_VECTOR_IS_APPROX(taskOutput, expectedTaskOutput_, 1e-6);
118  }
119 
120  void setGain(double gain) {
121  task_.controlGainSIN = gain;
122  task_.controlGainSIN.access(time_);
123  task_.controlGainSIN.setReady();
124  }
125 
126  template <typename SignalType, typename ValueType>
127  void setSignal(SignalType &sig, const ValueType &v) {
128  sig = v;
129  sig.access(time_);
130  sig.setReady();
131  }
132 
133  virtual FeatureAbstract &featureAbstract() = 0;
134 
135  virtual void setInputs() = 0;
136 
137  virtual void printInputs() {}
138 
139  virtual void recompute() {
140  task_.taskSOUT.recompute(time_);
141 
142  // Check that recomputing went fine.
143  FeatureAbstract &f(featureAbstract());
144  BOOST_CHECK_EQUAL(time_, f.errorSOUT.getTime());
145  BOOST_CHECK_EQUAL(time_, f.errordotSOUT.getTime());
146  BOOST_CHECK_EQUAL(time_, task_.errorSOUT.getTime());
147  BOOST_CHECK_EQUAL(time_, task_.errorTimeDerivativeSOUT.getTime());
148 
149  // TODO check that the output is correct
150  // computeExpectedTaskOutput (s - sd, - vd);
151  }
152 
153  virtual void printOutputs() {}
154 
155  virtual void checkValue() {
156  time_++;
157  setInputs();
158  printInputs();
159  recompute();
160  printOutputs();
161  }
162 };
163 
165  public:
167  int dim_;
168 
169  TestFeatureGeneric(unsigned dim, const std::string &name)
170  : FeatureTestBase(dim, name),
171  feature_("feature" + name),
172  featureDes_("featureDes" + name),
173  dim_(dim) {
174  feature_.setReference(&featureDes_);
175  feature_.selectionSIN = Flags(true);
176 
177  dynamicgraph::Matrix Jq(dim, dim);
178  Jq.setIdentity();
179  feature_.jacobianSIN.setReference(&Jq);
180 
181  init();
182  }
183 
184  FeatureAbstract &featureAbstract() { return feature_; }
185 
186  void setInputs() {
187  dynamicgraph::Vector s(dim_), sd(dim_), vd(dim_);
188  double gain;
189 
190  switch (time_) {
191  case 0:
192  BOOST_TEST_MESSAGE(" ----- Test Velocity -----");
193  s.setZero();
194  sd.setZero();
195  vd.setZero();
196  gain = 0.0;
197  break;
198  case 1:
199  BOOST_TEST_MESSAGE(" ----- Test Position -----");
200  s.setZero();
201  sd.setConstant(2.);
202  vd.setZero();
203  gain = 1.0;
204  break;
205  case 2:
206  BOOST_TEST_MESSAGE(" ----- Test both -----");
207  s.setZero();
208  sd.setConstant(2.);
209  vd.setConstant(1.);
210  gain = 3.0;
211  break;
212  default:
213  s.setRandom();
214  sd.setRandom();
215  vd.setRandom();
216  gain = 1.0;
217  }
218 
219  feature_.errorSIN = s;
220  feature_.errorSIN.access(time_);
221  feature_.errorSIN.setReady();
222 
223  featureDes_.errorSIN = sd;
224  featureDes_.errorSIN.access(time_);
225  featureDes_.errorSIN.setReady();
226 
227  featureDes_.errordotSIN = vd;
228  featureDes_.errordotSIN.access(time_);
229  featureDes_.errordotSIN.setReady();
230 
231  setGain(gain);
232  }
233 
234  void printInputs() {
235  BOOST_TEST_MESSAGE("----- inputs -----");
236  BOOST_TEST_MESSAGE(
237  "feature_.errorSIN: " << feature_.errorSIN(time_).transpose());
238  BOOST_TEST_MESSAGE(
239  "featureDes_.errorSIN: " << featureDes_.errorSIN(time_).transpose());
240  BOOST_TEST_MESSAGE("featureDes_.errordotSIN: "
241  << featureDes_.errordotSIN(time_).transpose());
242  BOOST_TEST_MESSAGE("task.controlGain: " << task_.controlGainSIN(time_));
243  }
244 
245  void recompute() {
247 
248  dynamicgraph::Vector s = feature_.errorSIN;
249  dynamicgraph::Vector sd = featureDes_.errorSIN;
250  dynamicgraph::Vector vd = featureDes_.errordotSIN;
251 
252  computeExpectedTaskOutput(s - sd, -vd);
253 
254  checkTaskOutput();
255  }
256 
257  void printOutputs() {
258  BOOST_TEST_MESSAGE("----- output -----");
259  BOOST_TEST_MESSAGE("time: " << time_);
260  BOOST_TEST_MESSAGE(
261  "feature.errorSOUT: " << feature_.errorSOUT(time_).transpose());
262  BOOST_TEST_MESSAGE(
263  "feature.errordotSOUT: " << feature_.errordotSOUT(time_).transpose());
264  BOOST_TEST_MESSAGE("task.taskSOUT: " << task_.taskSOUT(time_));
265  // BOOST_TEST_MESSAGE("task.errorSOUT: " << task_.errorSOUT(time_));
266  // BOOST_TEST_MESSAGE("task.errordtSOUT: " <<
267  // task_.errorTimeDerivativeSOUT(time_));
268  BOOST_TEST_MESSAGE(
269  "Expected task output: " << expectedTaskOutput_.transpose());
270  }
271 };
272 
273 BOOST_AUTO_TEST_SUITE(feature_generic)
274 
275 BOOST_AUTO_TEST_CASE(check_value) {
276  std::string srobot("test");
277  unsigned int dim = 6;
278 
279  TestFeatureGeneric testFeatureGeneric(dim, srobot);
280 
281  for (int i = 0; i < 10; ++i) testFeatureGeneric.checkValue();
282 }
283 
284 BOOST_AUTO_TEST_SUITE_END() // feature_generic
285 
286 MatrixHomogeneous randomM() {
288  M.translation().setRandom();
289  Eigen::Vector3d w(Eigen::Vector3d::Random());
290  M.linear() = Eigen::AngleAxisd(w.norm(), w.normalized()).matrix();
291  return M;
292 }
293 
295 
297  Vector7 v;
298  v.head<3>() = M.translation();
299  QuaternionMap(v.tail<4>().data()) = M.rotation();
300  return v;
301 }
302 
303 Vector toVector(const std::vector<MultiBound> &in) {
304  Vector out(in.size());
305  for (int i = 0; i < (int)in.size(); ++i) out[i] = in[i].getSingleBound();
306  return out;
307 }
308 
309 template <Representation_t representation>
311  public:
312  typedef typename dg::sot::internal::LG_t<representation>::type LieGroup_t;
314  bool relative_;
319 
320  TestFeaturePose(bool relative, const std::string &name)
321  : FeatureTestBase(6, name),
322  feature_("feature" + name),
323  relative_(relative),
324  data_(model_) {
325  pinocchio::buildModels::humanoid(model_, true); // use freeflyer
326  model_.lowerPositionLimit.head<3>().setConstant(-1.);
327  model_.upperPositionLimit.head<3>().setConstant(1.);
328  jb_ = model_.getJointId("rarm_wrist2_joint");
329  fb_ = model_.addFrame(pinocchio::Model::Frame(
330  "frame_b", jb_,
331  model_.getFrameId("rarm_wrist2_joint", pinocchio::JOINT),
333  if (relative) {
334  ja_ = model_.getJointId("larm_wrist2_joint");
335  fa_ = model_.addFrame(pinocchio::Model::Frame(
336  "frame_a", ja_,
337  model_.getFrameId("larm_wrist2_joint", pinocchio::JOINT),
339  } else {
340  ja_ = 0;
341  fa_ = model_.addFrame(pinocchio::Model::Frame(
342  "frame_a", 0, 0, SE3::Identity(), pinocchio::OP_FRAME));
343  }
344  data_ = pinocchio::Data(model_);
345 
346  init();
347 
348  setJointFrame();
349  }
350 
351  void _setFrame() {
352  setSignal(
353  feature_.jaMfa,
354  MatrixHomogeneous(model_.frames[fa_].placement.toHomogeneousMatrix()));
355  setSignal(
356  feature_.jbMfb,
357  MatrixHomogeneous(model_.frames[fb_].placement.toHomogeneousMatrix()));
358  }
359 
360  void setJointFrame() {
361  model_.frames[fa_].placement.setIdentity();
362  model_.frames[fb_].placement.setIdentity();
363  _setFrame();
364  }
365 
366  void setRandomFrame() {
367  model_.frames[fa_].placement.setRandom();
368  model_.frames[fb_].placement.setRandom();
369  _setFrame();
370  }
371 
372  FeatureAbstract &featureAbstract() { return feature_; }
373 
374  void setInputs() {
376  pinocchio::framesForwardKinematics(model_, data_, q);
377  pinocchio::computeJointJacobians(model_, data_);
378 
379  // Poses
380  setSignal(feature_.oMjb,
381  MatrixHomogeneous(data_.oMi[jb_].toHomogeneousMatrix()));
382  if (relative_) {
383  setSignal(feature_.oMja,
384  MatrixHomogeneous(data_.oMi[ja_].toHomogeneousMatrix()));
385  }
386 
387  // Jacobians
388  Matrix J(6, model_.nv);
389  J.setZero();
390  pinocchio::getJointJacobian(model_, data_, jb_, pinocchio::LOCAL, J);
391  setSignal(feature_.jbJjb, J);
392  if (relative_) {
393  J.setZero();
394  pinocchio::getJointJacobian(model_, data_, ja_, pinocchio::LOCAL, J);
395  setSignal(feature_.jaJja, J);
396  }
397 
398  // Desired
399  setSignal(feature_.faMfbDes, randomM());
400  setSignal(feature_.faNufafbDes, Vector::Random(6));
401 
402  double gain = 0;
403  // if (time_ % 5 != 0)
404  // gain = 2 * (double)rand() / RAND_MAX;
405  if (time_ % 2 != 0) gain = 1;
406  setGain(gain);
407  }
408 
409  void printInputs() {
410  BOOST_TEST_MESSAGE("----- inputs -----");
411  // BOOST_TEST_MESSAGE("feature_.errorSIN: " <<
412  // feature_.errorSIN(time_).transpose());
413  BOOST_TEST_MESSAGE("task.controlGain: " << task_.controlGainSIN(time_));
414  }
415 
416  void recompute() {
418 
419  const SE3 oMfb = data_.oMf[fb_], oMfa = data_.oMf[fa_],
420  faMfb(feature_.faMfb.accessCopy().matrix()),
421  faMfbDes(feature_.faMfbDes.accessCopy().matrix());
422  const Vector &nu(feature_.faNufafbDes.accessCopy());
423 
424  computeExpectedTaskOutput(
425  toVector(oMfa.inverse() * oMfb), toVector(faMfbDes),
426  (boost::is_same<LieGroup_t, SE3_t>::value
427  ? faMfbDes.toActionMatrixInverse() * nu
428  : (Vector6d() << nu.head<3>() -
429  faMfb.translation().cross(nu.tail<3>()),
430  faMfbDes.rotation().transpose() * nu.tail<3>())
431  .finished()),
432  LieGroup_t());
433 
434  checkTaskOutput();
435  }
436 
437  void printOutputs() {
438  BOOST_TEST_MESSAGE("----- output -----");
439  BOOST_TEST_MESSAGE("time: " << time_);
440  BOOST_TEST_MESSAGE(
441  "feature.errorSOUT: " << feature_.errorSOUT(time_).transpose());
442  BOOST_TEST_MESSAGE(
443  "feature.errordotSOUT: " << feature_.errordotSOUT(time_).transpose());
444  BOOST_TEST_MESSAGE("task.taskSOUT: " << task_.taskSOUT(time_));
445  // BOOST_TEST_MESSAGE("task.errorSOUT: " << task_.errorSOUT(time_));
446  // BOOST_TEST_MESSAGE("task.errordtSOUT: " <<
447  // task_.errorTimeDerivativeSOUT(time_));
448  BOOST_TEST_MESSAGE(
449  "Expected task output: " << expectedTaskOutput_.transpose());
450  }
451 
452  virtual void checkJacobian() {
453  time_++;
454  // We want to check that e (q+dq, t) ~ e(q, t) + de/dq(q,t) dq
455 
456  setGain(1.);
457 
459  pinocchio::framesForwardKinematics(model_, data_, q);
460  pinocchio::computeJointJacobians(model_, data_);
461 
462  // Poses
463  setSignal(feature_.oMjb,
464  MatrixHomogeneous(data_.oMi[jb_].toHomogeneousMatrix()));
465  if (relative_) {
466  setSignal(feature_.oMja,
467  MatrixHomogeneous(data_.oMi[ja_].toHomogeneousMatrix()));
468  }
469 
470  // Jacobians
471  Matrix J(6, model_.nv);
472  J.setZero();
473  pinocchio::getJointJacobian(model_, data_, jb_, pinocchio::LOCAL, J);
474  setSignal(feature_.jbJjb, J);
475  if (relative_) {
476  J.setZero();
477  pinocchio::getJointJacobian(model_, data_, ja_, pinocchio::LOCAL, J);
478  setSignal(feature_.jaJja, J);
479  }
480 
481  // Desired
482  setSignal(feature_.faMfbDes, randomM());
483 
484  // Get task jacobian
485  Vector e_q = task_.errorSOUT.access(time_);
486  J = task_.jacobianSOUT.access(time_);
487 
488  Eigen::IOFormat PyVectorFmt(Eigen::FullPrecision, 0, ", ", ", ", "", "",
489  "[", "]\n");
490  Eigen::IOFormat PyMatrixFmt(Eigen::FullPrecision, 0, ", ", ",\n", "[", "]",
491  "[", "]\n");
492 
493  Vector qdot(Vector::Zero(model_.nv));
494  double eps = 1e-6;
495  BOOST_TEST_MESSAGE(
496  data_.oMi[ja_].toHomogeneousMatrix().format(PyMatrixFmt)
497  << data_.oMi[jb_].toHomogeneousMatrix().format(PyMatrixFmt)
498  << model_.frames[fa_].placement.toHomogeneousMatrix().format(
499  PyMatrixFmt)
500  << model_.frames[fb_].placement.toHomogeneousMatrix().format(
501  PyMatrixFmt)
502  << J.format(PyMatrixFmt));
503 
504  for (int i = 0; i < model_.nv; ++i) {
505  time_++;
506  qdot(i) = eps;
507 
508  // Update pose signals
509  Vector q_qdot = pinocchio::integrate(model_, q, qdot);
510  pinocchio::framesForwardKinematics(model_, data_, q_qdot);
511  setSignal(feature_.oMjb,
512  MatrixHomogeneous(data_.oMi[jb_].toHomogeneousMatrix()));
513  if (relative_) {
514  setSignal(feature_.oMja,
515  MatrixHomogeneous(data_.oMi[ja_].toHomogeneousMatrix()));
516  }
517 
518  // Recompute output and check finite diff
519  Vector e_q_dq = task_.errorSOUT.access(time_);
520  BOOST_CHECK_MESSAGE(
521  (((e_q_dq - e_q) / eps) - J.col(i)).maxCoeff() < 1e-4,
522  "Jacobian col " << i << " does not match finite difference.\n"
523  << ((e_q_dq - e_q) / eps).format(PyVectorFmt) << '\n'
524  << J.col(i).format(PyVectorFmt) << '\n');
525 
526  qdot(i) = 0.;
527  }
528  time_++;
529  }
530 
531  virtual void checkFeedForward() {
532  setGain(0.);
533  // random config
534  // set inputs
535  // compute e = task_.taskSOUT and J = task_.jacobianSOUT
536  // check that e (q + eps*qdot) - e (q) ~= eps * J * qdot
537  // compute qdot = J^+ * e
538  // check that faMfb (q+eps*qdot) ~= faMfb(q) + eps * faNufafbDes
539 
540  time_++;
542  pinocchio::framesForwardKinematics(model_, data_, q);
543  pinocchio::computeJointJacobians(model_, data_);
544 
545  SE3 faMfb = data_.oMf[fa_].actInv(data_.oMf[fb_]);
546 
547  // Poses
548  setSignal(feature_.oMjb,
549  MatrixHomogeneous(data_.oMi[jb_].toHomogeneousMatrix()));
550  if (relative_) {
551  setSignal(feature_.oMja,
552  MatrixHomogeneous(data_.oMi[ja_].toHomogeneousMatrix()));
553  }
554 
555  // Jacobians
556  Matrix J(6, model_.nv);
557  J.setZero();
558  pinocchio::getJointJacobian(model_, data_, jb_, pinocchio::LOCAL, J);
559  setSignal(feature_.jbJjb, J);
560  if (relative_) {
561  J.setZero();
562  pinocchio::getJointJacobian(model_, data_, ja_, pinocchio::LOCAL, J);
563  setSignal(feature_.jaJja, J);
564  }
565 
566  Matrix faJfafb;
567  J.setZero();
568  pinocchio::getFrameJacobian(model_, data_, fb_, pinocchio::LOCAL, J);
569  faJfafb = faMfb.toActionMatrix() * J;
570  J.setZero();
571  pinocchio::getFrameJacobian(model_, data_, fa_, pinocchio::LOCAL, J);
572  faJfafb -= J;
573 
574  // Desired
575  setSignal(feature_.faMfbDes, randomM());
576 
577  // Get task jacobian
578  task_.jacobianSOUT.recompute(time_);
579  J = task_.jacobianSOUT.accessCopy();
580  Eigen::JacobiSVD<Matrix> svd(J, Eigen::ComputeThinU | Eigen::ComputeThinV);
581 
582  Vector faNufafbDes(Vector::Zero(6));
583  double eps = 1e-6;
584  for (int i = 0; i < 6; ++i) {
585  time_++;
586  faNufafbDes(i) = 1.;
587  setSignal(feature_.faNufafbDes, faNufafbDes);
588  task_.taskSOUT.recompute(time_);
589 
590  Vector qdot = svd.solve(toVector(task_.taskSOUT.accessCopy()));
591 
592  Vector faNufafb = faJfafb * qdot;
593  EIGEN_VECTOR_IS_APPROX(faNufafbDes, faNufafb, eps);
594 
595  faNufafbDes(i) = 0.;
596  }
597  time_++;
598  }
599 };
600 
601 template <typename TestClass>
602 void runTest(TestClass &runner, int N = 2)
603 // int N = 10)
604 {
605  for (int i = 0; i < N; ++i) runner.checkValue();
606  for (int i = 0; i < N; ++i) runner.checkJacobian();
607  for (int i = 0; i < N; ++i) runner.checkFeedForward();
608 }
609 
610 BOOST_AUTO_TEST_SUITE(feature_pose)
611 
612 template <Representation_t representation>
613 void feature_pose_absolute_tpl(const std::string &repr) {
614  BOOST_TEST_MESSAGE("absolute " << repr);
615  TestFeaturePose<representation> testAbsolute(false, "abs" + repr);
616  testAbsolute.setJointFrame();
617  runTest(testAbsolute);
618 
619  testAbsolute.setRandomFrame();
620  runTest(testAbsolute);
621 }
622 
623 BOOST_AUTO_TEST_SUITE(absolute)
624 
626  feature_pose_absolute_tpl<R3xSO3Representation>("R3xSO3");
627 }
628 
630  feature_pose_absolute_tpl<SE3Representation>("SE3");
631 }
632 
633 BOOST_AUTO_TEST_SUITE_END() // absolute
634 
635 template <Representation_t representation>
636 void feature_pose_relative_tpl(const std::string &repr) {
637  BOOST_TEST_MESSAGE("relative " << repr);
638  TestFeaturePose<representation> testRelative(true, "rel" + repr);
639  runTest(testRelative);
640 
641  testRelative.setRandomFrame();
642  runTest(testRelative);
643 }
644 
645 BOOST_AUTO_TEST_SUITE(relative)
646 
647 BOOST_AUTO_TEST_CASE(r3xso3) {
648  feature_pose_relative_tpl<R3xSO3Representation>("R3xSO3");
649 }
650 
652  feature_pose_relative_tpl<SE3Representation>("SE3");
653 }
654 
655 BOOST_AUTO_TEST_SUITE_END() // relative
656 
657 BOOST_AUTO_TEST_SUITE_END() // feature_pose
J
dynamicgraph::SignalPtr< MatrixHomogeneous, int > jaMfa
Input pose of Frame A wrt to Joint A.
Definition: feature-pose.hh:74
float eps
TestFeaturePose(bool relative, const std::string &name)
void computeExpectedTaskOutput(const Vector &s, const Vector &sdes, const Vector &sDesDot, const LG_t &lg)
dg::sot::internal::LG_t< representation >::type LieGroup_t
FeatureAbstract & featureAbstract()
BOOST_AUTO_TEST_CASE(check_value)
static SE3Tpl Identity()
TestFeatureGeneric(unsigned dim, const std::string &name)
SignalTimeDependent< dynamicgraph::Vector, int > errordotSOUT
Derivative of the error with respect to time: .
virtual void checkJacobian()
Index FrameIndex
Eigen::VectorXd Vector
s
q
SignalPtr< Flags, int > selectionSIN
This vector specifies which dimension are used to perform the computation. For instance let us assume...
Eigen::Matrix< double, 7, 1 > Vector7
int i
Eigen::Transform< double, 3, Eigen::Affine > MatrixHomogeneous
void setGain(double gain)
dynamicgraph::SignalTimeDependent< VectorMultiBound, int > taskSOUT
dynamicgraph::SignalPtr< double, int > controlGainSIN
Definition: task.hh:108
void addFeature(FeatureAbstract &s)
Definition: task.cpp:108
N
virtual void setReference(const T *t, typename Signal< T, Time >::Mutex *m=NULL)
ConfigVectorType lowerPositionLimit
void computeExpectedTaskOutput(const Vector &error, const Vector &errorDrift)
Signal< dynamicgraph::Matrix, int > sig("matrix")
FrameVector frames
pinocchio::SpecialEuclideanOperationTpl< 3, double > SE3_t
virtual void recompute()
def absolute(src)
Definition: setup.in.py:36
pinocchio::JointIndex jb_
void setWithDerivative(const bool &s)
Definition: task.cpp:141
dynamicgraph::SignalPtr< MatrixHomogeneous, int > oMja
Input pose of Joint A wrt to world frame.
Definition: feature-pose.hh:72
virtual void printInputs()
dynamicgraph::SignalPtr< dynamicgraph::Matrix, int > jacobianSIN
Input for the Jacobian.
int dim
void getJointJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const typename ModelTpl< Scalar, Options, JointCollectionTpl >::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6Like > &J)
void integrate(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigIn_t > &q, const Eigen::MatrixBase< Tangent_t > &v, const Eigen::MatrixBase< ConfigOut_t > &qout)
SignalTimeDependent< MatrixHomogeneous, int > faMfb
Pose of Frame B wrt to Frame A.
Definition: feature-pose.hh:95
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > errorSOUT
Definition: task.hh:111
void humanoid(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
dynamicgraph::SignalPtr< MatrixHomogeneous, int > jbMfb
Input pose of Frame B wrt to Joint B.
Definition: feature-pose.hh:78
virtual void printOutputs()
SignalPtr< dynamicgraph::Vector, int > errordotSIN
Derivative of the reference value.
pinocchio::CartesianProductOperation< pinocchio::VectorSpaceOperationTpl< 3, double >, pinocchio::SpecialOrthogonalOperationTpl< 3, double > > R3xSO3_t
void feature_pose_absolute_tpl(const std::string &repr)
void setSignal(SignalType &sig, const ValueType &v)
void runTest(TestClass &runner, int N=2)
boost::mpl::if_c< representation==SE3Representation, SE3_t, R3xSO3_t >::type type
FeatureAbstract & featureAbstract()
virtual void checkFeedForward()
pinocchio::FrameIndex fb_
virtual const T & access(const Time &t)
void f(void)
void randomConfiguration(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< ConfigOut_t > &qout)
FrameIndex getFrameId(const std::string &name, const FrameType &type=(FrameType)(JOINT|FIXED_JOINT|BODY|OP_FRAME|SENSOR)) const
virtual void setReference(FeatureAbstract *sdes)=0
virtual const T & accessCopy() const
pinocchio::Model model_
DataTpl< double > Data
dynamicgraph::SignalPtr< Matrix, int > jaJja
Jacobian of the input Joint A, expressed in Joint A
Definition: feature-pose.hh:80
void init(bool compute_local_aabb=true)
virtual void recompute(const Time &t)
FeatureTestBase(unsigned dim, const std::string &name)
FrameIndex addFrame(const Frame &frame, const bool append_inertia=true)
Index JointIndex
JointIndex getJointId(const std::string &name) const
This class gives the abstract definition of a feature.
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobians(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
pinocchio::SE3 SE3
Eigen::MatrixXd Matrix
BOOST_AUTO_TEST_SUITE_END() MatrixHomogeneous randomM()
Feature that controls the relative (or absolute) pose between two frames A (or world) and B...
Definition: feature-pose.hh:62
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > errorTimeDerivativeSOUT
Definition: task.hh:113
dynamicgraph::SignalPtr< Matrix, int > jbJjb
Jacobian of the input Joint B, expressed in Joint B
Definition: feature-pose.hh:82
Vector7 toVector(const pinocchio::SE3 &M)
ConfigVectorType upperPositionLimit
virtual void checkValue()
dynamicgraph::SignalPtr< MatrixHomogeneous, int > faMfbDes
The desired pose of Frame B wrt to Frame A.
Definition: feature-pose.hh:85
Class that defines the basic elements of a task.
Definition: task.hh:72
virtual const T & accessCopy() const
M
v
dynamicgraph::SignalPtr< MatrixHomogeneous, int > oMjb
Input pose of Joint B wrt to world frame.
Definition: feature-pose.hh:76
void setReady(const bool sready=true)
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
Input for the error.
dynamicgraph::SignalPtr< Vector, int > faNufafbDes
Definition: feature-pose.hh:88
SignalTimeDependent< dynamicgraph::Vector, int > errorSOUT
This signal returns the error between the desired value and the current value : . ...
virtual const Time & getTime() const
w
#define EIGEN_VECTOR_IS_APPROX(Va, Vb, precision)
void getFrameJacobian(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const FrameIndex frame_id, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xLike > &J)
dynamicgraph::Vector expectedTaskOutput_
FeaturePose< representation > feature_
Eigen::Map< Quaternion > SOT_CORE_EXPORT QuaternionMap
void framesForwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Class that defines a generic implementation of the abstract interface for features.


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26