tests
task
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
14
#include <
dynamic-graph/linear-algebra.h
>
15
#include <dynamic-graph/signal.h>
16
17
#include <iostream>
18
#include <
sot/core/gain-adaptive.hh
>
19
using namespace
std;
20
using namespace
dynamicgraph::sot
;
21
using namespace
dynamicgraph
;
22
23
class
DummyClass
{
24
public
:
25
dynamicgraph::Vector
err
;
26
27
dynamicgraph::Vector
&getError(
dynamicgraph::Vector
&res,
int
t
) {
28
cout <<
"Dummy::getError ["
<<
t
<<
"] "
<< endl;
29
return
res
=
err
;
30
}
31
};
32
33
DummyClass
dummy
;
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, sigtime_t>
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, sigtime_t>
&gainSig = gain->
gainSOUT
;
53
54
cout <<
"Compute gain from Gain Signal and display."
<< endl;
55
cout << gainSig(0) << endl;
56
57
return
0;
58
}
DummyClass
Definition:
test_dep.cpp:21
main
int main(void)
Definition:
test_gain.cpp:39
dynamicgraph::Signal< dynamicgraph::Vector, sigtime_t >
dynamicgraph::sot::GainAdaptive::errorSIN
dynamicgraph::SignalPtr< dynamicgraph::Vector, sigtime_t > errorSIN
Definition:
gain-adaptive.hh:119
dynamicgraph
dynamicgraph::SignalPtr::plug
virtual void plug(SignalBase< Time > *ref)
dynamicgraph::Signal::setFunction
virtual void setFunction(boost::function2< T &, T &, Time > t, Mutex *mutexref=NULL)
res
res
dynamicgraph::sot::GainAdaptive::gainSOUT
dynamicgraph::SignalTimeDependent< double, sigtime_t > gainSOUT
Definition:
gain-adaptive.hh:120
dummy
DummyClass dummy
Definition:
test_gain.cpp:33
dynamicgraph::Vector
Eigen::VectorXd Vector
linear-algebra.h
dynamicgraph::sot::GainAdaptive
Definition:
gain-adaptive.hh:53
err
err
gain-adaptive.hh
dynamicgraph::sot
t
Transform3f t
sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:32