test_gain.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 /* --- INCLUDES ------------------------------------------------------------- */
12 /* -------------------------------------------------------------------------- */
13 
15 #include <dynamic-graph/signal.h>
16 
17 #include <iostream>
19 using namespace std;
20 using namespace dynamicgraph::sot;
21 using namespace dynamicgraph;
22 
23 class DummyClass {
24  public:
26 
27  dynamicgraph::Vector &getError(dynamicgraph::Vector &res, int t) {
28  cout << "Dummy::getError [" << t << "] " << endl;
29  return res = err;
30  }
31 };
32 
34 
35 /* -------------------------------------------------------------------------- */
36 /* --- INCLUDES ------------------------------------------------------------- */
37 /* -------------------------------------------------------------------------- */
38 
39 int main(void) {
40  dummy.err.resize(3);
41  dummy.err.fill(3);
42 
43  GainAdaptive *gain = new GainAdaptive("gain", 4, 1, 5);
44 
45  Signal<dynamicgraph::Vector, int> errSig("test");
46  errSig.setFunction(boost::bind(&DummyClass::getError, dummy, _1, _2));
47 
48  gain->errorSIN.plug(&errSig);
49  cout << "Appel of errSig and display of the result." << endl;
50  cout << errSig(0) << endl;
51 
52  Signal<double, int> &gainSig = gain->gainSOUT;
53 
54  cout << "Compute gain from Gain Signal and display." << endl;
55  cout << gainSig(0) << endl;
56 
57  return 0;
58 }
Eigen::VectorXd Vector
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
DummyClass dummy
Definition: test_gain.cpp:33
dynamicgraph::SignalTimeDependent< double, int > gainSOUT
virtual void plug(SignalBase< Time > *ref)
Transform3f t
int main(void)
Definition: test_gain.cpp:39
err
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