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)
171  feature_("feature" + name),
172  featureDes_("featureDes" + name),
173  dim_(dim) {
174  feature_.setReference(&featureDes_);
175  feature_.selectionSIN = Flags(true);
176 
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
FeatureTestBase::checkTaskOutput
void checkTaskOutput()
Definition: test_feature_generic.cpp:111
TestFeatureGeneric::featureAbstract
FeatureAbstract & featureAbstract()
Definition: test_feature_generic.cpp:184
pinocchio::CartesianProductOperation
dynamicgraph::sot::QuaternionMap
Eigen::Map< Quaternion > SOT_CORE_EXPORT QuaternionMap
Definition: matrix-geometry.hh:86
BOOST_AUTO_TEST_SUITE_END
BOOST_AUTO_TEST_SUITE_END() MatrixHomogeneous randomM()
Definition: test_feature_generic.cpp:284
init
void init(bool compute_local_aabb=true)
TestFeaturePose::jb_
pinocchio::JointIndex jb_
Definition: test_feature_generic.cpp:317
pinocchio::SpecialEuclideanOperationTpl
TestFeaturePose::relative_
bool relative_
Definition: test_feature_generic.cpp:314
pinocchio::FrameIndex
Index FrameIndex
feature_pose_absolute_tpl
void feature_pose_absolute_tpl(const std::string &repr)
Definition: test_feature_generic.cpp:613
pinocchio::getFrameJacobian
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)
N
N
TestFeaturePose::checkFeedForward
virtual void checkFeedForward()
Definition: test_feature_generic.cpp:531
dynamicgraph::sot::Task::errorTimeDerivativeSOUT
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > errorTimeDerivativeSOUT
Definition: task.hh:115
pinocchio::ModelTpl::frames
FrameVector frames
FeatureTestBase::expectedTaskOutput_
dynamicgraph::Vector expectedTaskOutput_
Definition: test_feature_generic.cpp:80
dynamicgraph::sot::SE3Representation
@ SE3Representation
Definition: feature-pose.hh:29
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(check_value)
Definition: test_feature_generic.cpp:275
pinocchio::DataTpl
TestFeatureGeneric::TestFeatureGeneric
TestFeatureGeneric(unsigned dim, const std::string &name)
Definition: test_feature_generic.cpp:169
dynamicgraph::SignalPtr::accessCopy
virtual const T & accessCopy() const
dynamicgraph::sot::Task::controlGainSIN
dynamicgraph::SignalPtr< double, sigtime_t > controlGainSIN
Definition: task.hh:110
dynamicgraph::sot::Task::setWithDerivative
void setWithDerivative(const bool &s)
Definition: task.cpp:142
TestFeatureGeneric::printOutputs
void printOutputs()
Definition: test_feature_generic.cpp:257
pinocchio::ModelTpl::lowerPositionLimit
ConfigVectorType lowerPositionLimit
TestFeaturePose::_setFrame
void _setFrame()
Definition: test_feature_generic.cpp:351
dynamicgraph
TestFeatureGeneric::recompute
void recompute()
Definition: test_feature_generic.cpp:245
dynamicgraph::sot::FeatureGeneric::jacobianSIN
dynamicgraph::SignalPtr< dynamicgraph::Matrix, sigtime_t > jacobianSIN
Input for the Jacobian.
Definition: feature-generic.hh:80
SE3Tpl< double, 0 >
J
J
i
int i
FeatureTestBase::computeExpectedTaskOutput
void computeExpectedTaskOutput(const Vector &s, const Vector &sdes, const Vector &sDesDot, const LG_t &lg)
Definition: test_feature_generic.cpp:99
dynamicgraph::sot::SE3_t
pinocchio::SpecialEuclideanOperationTpl< 3, double > SE3_t
Definition: test_feature_generic.cpp:45
pinocchio::framesForwardKinematics
PINOCCHIO_DEPRECATED void framesForwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
pinocchio::randomConfiguration
void randomConfiguration(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigL_t > &q0, const Eigen::MatrixBase< ConfigR_t > &q1, const Eigen::MatrixBase< ConfigOut_t > &qout)
EIGEN_VECTOR_IS_APPROX
#define EIGEN_VECTOR_IS_APPROX(Va, Vb, precision)
Definition: test_feature_generic.cpp:61
dynamicgraph::sot::FeatureAbstract::setReference
virtual void setReference(FeatureAbstract *sdes)=0
dynamicgraph::sot::FeaturePose::jaJja
dynamicgraph::SignalPtr< Matrix, sigtime_t > jaJja
Jacobian of the input Joint A, expressed in Joint A
Definition: feature-pose.hh:80
task.hh
FeatureTestBase::time_
int time_
Definition: test_feature_generic.cpp:79
dynamicgraph::sot::FeatureAbstract::selectionSIN
SignalPtr< Flags, sigtime_t > selectionSIN
This vector specifies which dimension are used to perform the computation. For instance let us assume...
Definition: feature-abstract.hh:173
FeatureTestBase::printInputs
virtual void printInputs()
Definition: test_feature_generic.cpp:137
dynamicgraph::sot::FeatureGeneric
Class that defines a generic implementation of the abstract interface for features.
Definition: feature-generic.hh:56
dynamicgraph::Matrix
Eigen::MatrixXd Matrix
FeatureTestBase::setSignal
void setSignal(SignalType &sig, const ValueType &v)
Definition: test_feature_generic.cpp:127
feature-abstract.hh
dynamicgraph::sot::FeaturePose::faMfb
SignalTimeDependent< MatrixHomogeneous, sigtime_t > faMfb
Pose of Frame B wrt to Frame A.
Definition: feature-pose.hh:95
dynamicgraph::SignalPtr::setReference
virtual void setReference(const T *t, typename Signal< T, Time >::Mutex *m=NULL)
f
void f(void)
Definition: test_mailbox.cpp:33
FeatureTestBase::computeExpectedTaskOutput
void computeExpectedTaskOutput(const Vector &error, const Vector &errorDrift)
Definition: test_feature_generic.cpp:92
setup.absolute
def absolute(src)
Definition: setup.in.py:36
pinocchio::getJointJacobian
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)
dynamicgraph::sot::internal::LG_t::type
boost::mpl::if_c< representation==SE3Representation, SE3_t, R3xSO3_t >::type type
Definition: test_feature_generic.cpp:51
TestFeatureGeneric::dim_
int dim_
Definition: test_feature_generic.cpp:167
runTest
void runTest(TestClass &runner, int N=2)
Definition: test_feature_generic.cpp:602
TestFeaturePose::setInputs
void setInputs()
Definition: test_feature_generic.cpp:374
dynamicgraph::sot::FeatureAbstract
This class gives the abstract definition of a feature.
Definition: feature-abstract.hh:76
pinocchio::FrameTpl
dynamicgraph::sot::R3xSO3_t
pinocchio::CartesianProductOperation< pinocchio::VectorSpaceOperationTpl< 3, double >, pinocchio::SpecialOrthogonalOperationTpl< 3, double > > R3xSO3_t
Definition: test_feature_generic.cpp:44
TestFeaturePose::fb_
pinocchio::FrameIndex fb_
Definition: test_feature_generic.cpp:318
debug.hh
dynamicgraph::SignalPtr::access
virtual const T & access(const Time &t)
FeatureTestBase::init
virtual void init()
Definition: test_feature_generic.cpp:87
FeatureTestBase::setGain
void setGain(double gain)
Definition: test_feature_generic.cpp:120
s
s
feature-pose.hh
dim
int dim
FeatureTestBase::recompute
virtual void recompute()
Definition: test_feature_generic.cpp:139
dynamicgraph::sot::FeatureAbstract::errordotSOUT
SignalTimeDependent< dynamicgraph::Vector, sigtime_t > errordotSOUT
Derivative of the error with respect to time: .
Definition: feature-abstract.hh:189
dynamicgraph::sot::FeaturePose
Feature that controls the relative (or absolute) pose between two frames A (or world) and B.
Definition: feature-pose.hh:62
TestFeaturePose::featureAbstract
FeatureAbstract & featureAbstract()
Definition: test_feature_generic.cpp:372
eps
float eps
sot.hh
pinocchio::ModelTpl::getFrameId
FrameIndex getFrameId(const std::string &name, const FrameType &type=(FrameType)(JOINT|FIXED_JOINT|BODY|OP_FRAME|SENSOR)) const
pinocchio::SpecialOrthogonalOperationTpl
TestFeaturePose::printInputs
void printInputs()
Definition: test_feature_generic.cpp:409
pinocchio::integrate
void integrate(const LieGroupGenericTpl< LieGroupCollection > &lg, const Eigen::MatrixBase< ConfigIn_t > &q, const Eigen::MatrixBase< Tangent_t > &v, const Eigen::MatrixBase< ConfigOut_t > &qout)
TestFeatureGeneric::setInputs
void setInputs()
Definition: test_feature_generic.cpp:186
TestFeaturePose::recompute
void recompute()
Definition: test_feature_generic.cpp:416
pinocchio::computeJointJacobians
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix6x & computeJointJacobians(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
M
M
w
w
q
q
FeatureTestBase
Definition: test_feature_generic.cpp:76
dynamicgraph::sot::FeaturePose::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::Vector
Eigen::VectorXd Vector
dynamicgraph::sot::Task::errorSOUT
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, sigtime_t > errorSOUT
Definition: task.hh:113
TestFeaturePose::checkJacobian
virtual void checkJacobian()
Definition: test_feature_generic.cpp:452
dynamicgraph::sot::internal::LG_t
Definition: test_feature_generic.cpp:49
dynamicgraph::sot::Representation_t
Representation_t
Enum used to specify what difference operation is used in FeaturePose.
Definition: feature-pose.hh:29
pinocchio::ModelTpl::addFrame
FrameIndex addFrame(const Frame &frame, const bool append_inertia=true)
dynamicgraph::sot::FeaturePose::faNufafbDes
dynamicgraph::SignalPtr< Vector, sigtime_t > faNufafbDes
Definition: feature-pose.hh:88
dynamicgraph::sot::FeaturePose::faMfbDes
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > faMfbDes
The desired pose of Frame B wrt to Frame A.
Definition: feature-pose.hh:85
TestFeaturePose::feature_
FeaturePose< representation > feature_
Definition: test_feature_generic.cpp:313
pinocchio::JOINT
JOINT
FeatureTestBase::checkValue
virtual void checkValue()
Definition: test_feature_generic.cpp:155
dynamicgraph::sot::FeatureGeneric::errorSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > errorSIN
Input for the error.
Definition: feature-generic.hh:77
pinocchio::ModelTpl::getJointId
JointIndex getJointId(const std::string &name) const
FeatureTestBase::FeatureTestBase
FeatureTestBase(unsigned dim, const std::string &name)
Definition: test_feature_generic.cpp:82
TestFeaturePose::setRandomFrame
void setRandomFrame()
Definition: test_feature_generic.cpp:366
dynamicgraph::sot::FeaturePose::jaMfa
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > jaMfa
Input pose of Frame A wrt to Joint A.
Definition: feature-pose.hh:74
SE3
pinocchio::SE3 SE3
Definition: test_feature_generic.cpp:294
linear-algebra.h
pinocchio::buildModels::humanoid
void humanoid(ModelTpl< Scalar, Options, JointCollectionTpl > &model, bool usingFF=true)
TestFeatureGeneric::featureDes_
FeatureGeneric featureDes_
Definition: test_feature_generic.cpp:166
TestFeaturePose
Definition: test_feature_generic.cpp:310
dynamicgraph::sot::FeaturePose::jbJjb
dynamicgraph::SignalPtr< Matrix, sigtime_t > jbJjb
Jacobian of the input Joint B, expressed in Joint B
Definition: feature-pose.hh:82
pinocchio::OP_FRAME
OP_FRAME
Vector7
Eigen::Matrix< double, 7, 1 > Vector7
TestFeaturePose::model_
pinocchio::Model model_
Definition: test_feature_generic.cpp:315
feature-generic.hh
TestFeaturePose::LieGroup_t
dg::sot::internal::LG_t< representation >::type LieGroup_t
Definition: test_feature_generic.cpp:312
dynamicgraph::sot::TaskAbstract::taskSOUT
dynamicgraph::SignalTimeDependent< VectorMultiBound, sigtime_t > taskSOUT
Definition: task-abstract.hh:78
dynamicgraph::sot::Task
Class that defines the basic elements of a task.
Definition: task.hh:72
TestFeaturePose::setJointFrame
void setJointFrame()
Definition: test_feature_generic.cpp:360
gain-adaptive.hh
TestFeatureGeneric::printInputs
void printInputs()
Definition: test_feature_generic.cpp:234
pinocchio::ModelTpl::nv
int nv
TestFeaturePose::data_
pinocchio::Data data_
Definition: test_feature_generic.cpp:316
SE3Tpl< double, 0 >::Identity
static SE3Tpl Identity()
dynamicgraph::sot
dynamicgraph::sot::FeaturePose::oMja
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > oMja
Input pose of Joint A wrt to world frame.
Definition: feature-pose.hh:72
dynamicgraph::sot::FeaturePose::oMjb
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > oMjb
Input pose of Joint B wrt to world frame.
Definition: feature-pose.hh:76
v
v
TestFeatureGeneric
Definition: test_feature_generic.cpp:164
dynamic_graph.sot.core.meta_tasks.setGain
def setGain(gain, val)
Definition: meta_tasks.py:39
pinocchio::JointIndex
Index JointIndex
toVector
Vector7 toVector(const pinocchio::SE3 &M)
Definition: test_feature_generic.cpp:296
dynamicgraph::sot::FeatureGeneric::errorSOUT
SignalTimeDependent< dynamicgraph::Vector, sigtime_t > errorSOUT
Publish the error between the desired and the current value of the feature.
Definition: feature-abstract.hh:185
TestFeaturePose::printOutputs
void printOutputs()
Definition: test_feature_generic.cpp:437
MatrixHomogeneous
Eigen::Transform< double, 3, Eigen::Affine > MatrixHomogeneous
pinocchio::VectorSpaceOperationTpl
dynamicgraph::sot::FeatureAbstract::errordotSIN
SignalPtr< dynamicgraph::Vector, sigtime_t > errordotSIN
Derivative of the reference value.
Definition: feature-abstract.hh:176
sig
Signal< dynamicgraph::Matrix, sigtime_t > sig("matrix")
dynamicgraph::sot::Flags
Definition: flags.hh:33
dynamicgraph::sot::FeaturePose::jbMfb
dynamicgraph::SignalPtr< MatrixHomogeneous, sigtime_t > jbMfb
Input pose of Frame B wrt to Joint B.
Definition: feature-pose.hh:78
dynamicgraph::sot::Task::addFeature
void addFeature(FeatureAbstract &s)
Definition: task.cpp:109
pinocchio::ModelTpl
TestFeaturePose::TestFeaturePose
TestFeaturePose(bool relative, const std::string &name)
Definition: test_feature_generic.cpp:320
pinocchio::ModelTpl::upperPositionLimit
ConfigVectorType upperPositionLimit
FeatureTestBase::task_
Task task_
Definition: test_feature_generic.cpp:78
compile.name
name
Definition: compile.py:23
FeatureTestBase::printOutputs
virtual void printOutputs()
Definition: test_feature_generic.cpp:153
pinocchio::Data
DataTpl< double > Data
pinocchio::LOCAL
LOCAL


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