GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/task/task-unilateral.cpp Lines: 0 27 0.0 %
Date: 2023-03-13 12:09:37 Branches: 0 62 0.0 %

Line Branch Exec Source
1
/*
2
 * Copyright 2010,
3
 * François Bleibel,
4
 * Olivier Stasse,
5
 *
6
 * CNRS/AIST
7
 *
8
 */
9
10
/* --------------------------------------------------------------------- */
11
/* --- INCLUDE --------------------------------------------------------- */
12
/* --------------------------------------------------------------------- */
13
14
//#define VP_DEBUG
15
//#define VP_DEBUG_MODE 15
16
17
/* SOT */
18
#include <sot/core/debug.hh>
19
#include <sot/core/task-unilateral.hh>
20
21
using namespace std;
22
using namespace dynamicgraph::sot;
23
using namespace dynamicgraph;
24
25
#include <sot/core/factory.hh>
26
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(TaskUnilateral, "TaskUnilateral");
27
28
/* --------------------------------------------------------------------- */
29
/* --- CLASS ----------------------------------------------------------- */
30
/* --------------------------------------------------------------------- */
31
32
TaskUnilateral::TaskUnilateral(const std::string &n)
33
    : Task(n),
34
      featureList(),
35
      positionSIN(NULL,
36
                  "sotTaskUnilateral(" + n + ")::input(vector)::position"),
37
      referenceInfSIN(
38
          NULL, "sotTaskUnilateral(" + n + ")::input(vector)::referenceInf"),
39
      referenceSupSIN(
40
          NULL, "sotTaskUnilateral(" + n + ")::input(vector)::referenceSup"),
41
      dtSIN(NULL, "sotTaskUnilateral(" + n + ")::input(double)::dt") {
42
  taskSOUT.setFunction(
43
      boost::bind(&TaskUnilateral::computeTaskUnilateral, this, _1, _2));
44
  taskSOUT.clearDependencies();
45
  taskSOUT.addDependency(referenceSupSIN);
46
  taskSOUT.addDependency(referenceInfSIN);
47
  taskSOUT.addDependency(dtSIN);
48
  taskSOUT.addDependency(positionSIN);
49
50
  signalRegistration(referenceSupSIN << dtSIN << referenceInfSIN
51
                                     << positionSIN);
52
}
53
54
/* --- COMPUTATION ---------------------------------------------------------- */
55
/* --- COMPUTATION ---------------------------------------------------------- */
56
/* --- COMPUTATION ---------------------------------------------------------- */
57
58
VectorMultiBound &TaskUnilateral::computeTaskUnilateral(VectorMultiBound &res,
59
                                                        int time) {
60
  sotDEBUG(45) << "# In " << getName() << " {" << endl;
61
  const dynamicgraph::Vector &position = positionSIN(time);
62
  sotDEBUG(35) << "position = " << position << endl;
63
  const dynamicgraph::Vector &refInf = referenceInfSIN(time);
64
  const dynamicgraph::Vector &refSup = referenceSupSIN(time);
65
  const double &dt = dtSIN(time);
66
  res.resize(position.size());
67
  for (unsigned int i = 0; i < res.size(); ++i) {
68
    MultiBound toto((refInf(i) - position(i)) / dt,
69
                    (refSup(i) - position(i)) / dt);
70
    res[i] = toto;
71
  }
72
73
  sotDEBUG(15) << "taskU = " << res << std::endl;
74
  sotDEBUG(45) << "# Out }" << endl;
75
  return res;
76
}
77
78
/* --- DISPLAY ------------------------------------------------------------ */
79
/* --- DISPLAY ------------------------------------------------------------ */
80
/* --- DISPLAY ------------------------------------------------------------ */
81
82
void TaskUnilateral::display(std::ostream &os) const {
83
  os << "TaskUnilateral " << name << ": " << endl;
84
}