tools/test_control_pd.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2019,
3  * Olivier Stasse,
4  *
5  * CNRS/AIST
6  *
7  */
8 
9 #include <iostream>
10 #include <sot/core/debug.hh>
11 
12 #ifndef WIN32
13 #include <unistd.h>
14 #endif
15 
16 using namespace std;
17 
18 #include <dynamic-graph/entity.h>
19 #include <dynamic-graph/factory.h>
20 
21 #include <sot/core/control-pd.hh>
22 #include <sstream>
23 
24 using namespace dynamicgraph;
25 using namespace dynamicgraph::sot;
26 
27 BOOST_AUTO_TEST_CASE(control_pd) {
28  sot::ControlPD *aControlPD = ControlPD("acontrol_pd");
29  aControlPD->init(0.001);
30  aControlPD->setsize(5);
31  std::istringstream Kpiss("[5](10.0,20.0,30.0,40.0,50.0)");
32  std::istringstream Kdiss("[5](0.10,0.20,0.30,0.40,0.50)");
33  aControlPD->KpSIN.set(Kpiss);
34  aControlPD->KdSIN.set(Kdiss);
35  std::istringstream posiss("[5](1.0,1.0,1.0,1.0,1.0)");
36  aControlPD->positionSIN.set(posiss);
37  std::istringstream dposiss("[5](2.0,2.0,2.0,2.0,2.0)");
38  aControlPD->desiredpositionSIN.set(dposiss);
39  std::istringstream veliss("[5](0.0,0.0,0.0,0.0,0.0)");
40  aControlPD->velocitySIN.set(veliss);
41  std::istringstream dveliss("[5](1.0,1.0,1.0,1.0,1.0)");
42  aControlPD->desiredvelocitySIN.set(dveliss);
43 
44  aControlPD->recompute(0);
45  output_test_stream output;
46  aControlPD->controlSOUT.get(output);
47 }
virtual void set(std::istringstream &value)
SignalPtr< dynamicgraph::Vector, int > KpSIN
Definition: control-pd.hh:68
SignalPtr< dynamicgraph::Vector, int > desiredvelocitySIN
Definition: control-pd.hh:73
SignalPtr< dynamicgraph::Vector, int > desiredpositionSIN
Definition: control-pd.hh:71
BOOST_AUTO_TEST_CASE(control_pd)
void init(const double &step)
Definition: control-pd.cpp:61
SignalPtr< dynamicgraph::Vector, int > velocitySIN
Definition: control-pd.hh:72
SignalPtr< dynamicgraph::Vector, int > KdSIN
Definition: control-pd.hh:69
SignalTimeDependent< dynamicgraph::Vector, int > controlSOUT
Definition: control-pd.hh:74
virtual void get(std::ostream &value) const
SignalPtr< dynamicgraph::Vector, int > positionSIN
Definition: control-pd.hh:70


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