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 }
control-pd.hh
dynamicgraph::sot::ControlPD::positionSIN
SignalPtr< dynamicgraph::Vector, sigtime_t > positionSIN
Definition: control-pd.hh:70
dynamicgraph::sot::ControlPD::velocitySIN
SignalPtr< dynamicgraph::Vector, sigtime_t > velocitySIN
Definition: control-pd.hh:72
dynamicgraph::sot::ControlPD::KdSIN
SignalPtr< dynamicgraph::Vector, sigtime_t > KdSIN
Definition: control-pd.hh:69
dynamicgraph
dynamicgraph::sot::ControlPD::controlSOUT
SignalTimeDependent< dynamicgraph::Vector, sigtime_t > controlSOUT
Definition: control-pd.hh:74
dynamicgraph::sot::ControlPD::desiredpositionSIN
SignalPtr< dynamicgraph::Vector, sigtime_t > desiredpositionSIN
Definition: control-pd.hh:71
debug.hh
dynamicgraph::sot::ControlPD::init
void init(const double &step)
Definition: control-pd.cpp:61
dynamicgraph::sot::ControlPD
Definition: control-pd.hh:46
dynamicgraph::sot::ControlPD::desiredvelocitySIN
SignalPtr< dynamicgraph::Vector, sigtime_t > desiredvelocitySIN
Definition: control-pd.hh:73
dynamicgraph::sot
dynamicgraph::sot::ControlPD::KpSIN
SignalPtr< dynamicgraph::Vector, sigtime_t > KpSIN
Definition: control-pd.hh:68
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(control_pd)
Definition: tools/test_control_pd.cpp:27


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:32