task-unilateral.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 // #define VP_DEBUG
15 // #define VP_DEBUG_MODE 15
16 
17 /* SOT */
18 #include <sot/core/debug.hh>
20 
21 using namespace std;
22 using namespace dynamicgraph::sot;
23 using namespace dynamicgraph;
24 
25 #include <sot/core/factory.hh>
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") {
43  boost::bind(&TaskUnilateral::computeTaskUnilateral, this, _1, _2));
49 
51  << positionSIN);
52 }
53 
54 /* --- COMPUTATION ---------------------------------------------------------- */
55 /* --- COMPUTATION ---------------------------------------------------------- */
56 /* --- COMPUTATION ---------------------------------------------------------- */
57 
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 }
Eigen::VectorXd Vector
Vec3f n
int i
void signalRegistration(const SignalArray< int > &signals)
dynamicgraph::SignalTimeDependent< VectorMultiBound, int > taskSOUT
VectorMultiBound & computeTaskUnilateral(VectorMultiBound &res, int time)
std::vector< MultiBound > VectorMultiBound
Definition: multi-bound.hh:71
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > referenceSupSIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(TaskUnilateral, "TaskUnilateral")
dynamicgraph::SignalPtr< double, int > dtSIN
virtual void addDependency(const SignalBase< Time > &signal)
#define sotDEBUG(level)
Definition: debug.hh:165
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > positionSIN
const std::string & getName() const
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > referenceInfSIN
Class that defines the basic elements of a task.
Definition: task.hh:72
void display(std::ostream &os) const
virtual void setFunction(boost::function2< T &, T &, Time > t, Mutex *mutexref=NULL)


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