Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* François Bleibel, |
4 |
|
|
* Olivier Stasse, |
5 |
|
|
* |
6 |
|
|
* CNRS/AIST |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
|
10 |
|
|
#include <sot/core/factory.hh> |
11 |
|
|
#include <sot/core/vector-constant.hh> |
12 |
|
|
|
13 |
|
|
#include "../src/matrix/vector-constant-command.h" |
14 |
|
|
|
15 |
|
|
using namespace std; |
16 |
|
|
using namespace dynamicgraph::sot; |
17 |
|
|
using namespace dynamicgraph; |
18 |
|
|
|
19 |
|
✗ |
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(VectorConstant, "VectorConstant"); |
20 |
|
|
|
21 |
|
|
/* --------------------------------------------------------------------- */ |
22 |
|
|
/* --- VECTOR ---------------------------------------------------------- */ |
23 |
|
|
/* --------------------------------------------------------------------- */ |
24 |
|
✗ |
VectorConstant::VectorConstant(const std::string &name) |
25 |
|
|
: Entity(name), |
26 |
|
✗ |
rows(0), |
27 |
|
✗ |
SOUT("sotVectorConstant(" + name + ")::output(vector)::sout") { |
28 |
|
✗ |
SOUT.setDependencyType(TimeDependency<int>::BOOL_DEPENDENT); |
29 |
|
✗ |
signalRegistration(SOUT); |
30 |
|
|
|
31 |
|
|
// |
32 |
|
|
// Commands |
33 |
|
|
// |
34 |
|
|
// Resize |
35 |
|
✗ |
std::string docstring; |
36 |
|
|
docstring = |
37 |
|
|
" \n" |
38 |
|
|
" Resize the vector and set it to zero.\n" |
39 |
|
|
" Input\n" |
40 |
|
|
" unsigned size.\n" |
41 |
|
✗ |
"\n"; |
42 |
|
✗ |
addCommand("resize", new command::vectorConstant::Resize(*this, docstring)); |
43 |
|
|
// set |
44 |
|
|
docstring = |
45 |
|
|
" \n" |
46 |
|
|
" Set value of output signal\n" |
47 |
|
|
" \n" |
48 |
|
|
" input:\n" |
49 |
|
|
" - a vector\n" |
50 |
|
✗ |
" \n"; |
51 |
|
✗ |
addCommand( |
52 |
|
|
"set", |
53 |
|
|
new ::dynamicgraph::command::Setter<VectorConstant, dynamicgraph::Vector>( |
54 |
|
✗ |
*this, &VectorConstant::setValue, docstring)); |
55 |
|
|
} |
56 |
|
|
|
57 |
|
✗ |
void VectorConstant::setValue(const dynamicgraph::Vector &inValue) { |
58 |
|
✗ |
SOUT.setConstant(inValue); |
59 |
|
|
} |
60 |
|
|
|