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") {
42  taskSOUT.setFunction(
43  boost::bind(&TaskUnilateral::computeTaskUnilateral, this, _1, _2));
49 
51  << positionSIN);
52 }
53 
54 /* --- COMPUTATION ---------------------------------------------------------- */
55 /* --- COMPUTATION ---------------------------------------------------------- */
56 /* --- COMPUTATION ---------------------------------------------------------- */
57 
59  sigtime_t 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 (std::size_t 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 }
dynamicgraph::sot::TaskUnilateral::positionSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > positionSIN
Definition: task-unilateral.hh:67
factory.hh
dynamicgraph
dynamicgraph::sot::VectorMultiBound
std::vector< MultiBound > VectorMultiBound
Definition: multi-bound.hh:72
i
int i
dynamicgraph::sot::TaskUnilateral::referenceSupSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > referenceSupSIN
Definition: task-unilateral.hh:69
dynamicgraph::sot::TaskUnilateral::referenceInfSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > referenceInfSIN
Definition: task-unilateral.hh:68
dynamicgraph::sot::TaskUnilateral::dtSIN
dynamicgraph::SignalPtr< double, sigtime_t > dtSIN
Definition: task-unilateral.hh:70
dynamicgraph::Entity::name
std::string name
dynamicgraph::Entity::getName
const std::string & getName() const
debug.hh
res
res
dynamicgraph::sigtime_t
int64_t sigtime_t
dynamicgraph::sot::TaskUnilateral::computeTaskUnilateral
VectorMultiBound & computeTaskUnilateral(VectorMultiBound &res, sigtime_t time)
Definition: task-unilateral.cpp:58
dynamicgraph::SignalTimeDependent::addDependency
virtual void addDependency(const SignalBase< Time > &signal)
dynamicgraph::Vector
Eigen::VectorXd Vector
task-unilateral.hh
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(TaskUnilateral, "TaskUnilateral")
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
dynamicgraph::sot::MultiBound
Definition: multi-bound.hh:35
dynamicgraph::sot
dynamicgraph::sot::TaskUnilateral::display
void display(std::ostream &os) const
Definition: task-unilateral.cpp:82
test-parameter-server.dt
float dt
Definition: test-parameter-server.py:14
dynamicgraph::sot::TaskUnilateral
Definition: task-unilateral.hh:50
dynamicgraph::SignalTimeDependent::clearDependencies
virtual void clearDependencies()
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< sigtime_t > &signals)
n
Vec3f n
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