tsot.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 #include <iostream>
14 // #include <sot/core/sot-h.hh>
16 
17 #include <sot/core/debug.hh>
21 #include <sot/core/task.hh>
22 
23 using namespace std;
24 using namespace dynamicgraph::sot;
25 
26 double drand(void) { return 2 * ((double)rand()) / RAND_MAX - 1; }
28  for (int i = 0; i < J.rows(); ++i)
29  for (int j = 0; j < J.cols(); ++j) J(i, j) = drand();
30  return J;
31 }
32 
33 int main(void) {
34  sotDEBUGF("# In {");
35 
36  srand(12);
37  dynamicgraph::Matrix Jq(6, 6);
38  Jq.setIdentity();
39 
40  dynamicgraph::Vector p1xy(2);
41  p1xy(0) = 1.;
42  p1xy(1) = -2;
43 
44  sotDEBUGF("Create feature");
46  FeatureVisualPoint *p1des = new FeatureVisualPoint("p1des");
47 
49  p1->selectionSIN = Flags(true);
50  p1->setReference(p1des);
51  p1->xySIN = p1xy;
52 
53  p1des->xySIN = dynamicgraph::Vector(2);
54 
55  sotDEBUGF("Create Task");
56  // sotDEBUG(0) << dynamicgraph::MATLAB;
57 
58  Task *task = new Task("task");
59  task->addFeature(*p1);
60  task->addFeature(*p1);
61 
62  GainAdaptive *lambda = new GainAdaptive("g");
63  lambda->errorSIN.plug(&task->errorSOUT);
64 
65  task->controlGainSIN.plug(&lambda->gainSOUT);
66  task->dampingGainSINOUT = .1;
67  task->controlSelectionSIN = Flags(true);
68 
69  task->jacobianSOUT.display(cout) << endl;
70  task->jacobianSOUT.displayDependencies(cout) << endl;
71 
72  sotDEBUG(0) << "J" << task->jacobianSOUT(2);
73  sotDEBUG(0) << "e" << task->errorSOUT(2) << endl;
74 
75  sotDEBUGF("# Out }");
76 
77  return 0;
78 }
Eigen::VectorXd Vector
virtual std::ostream & display(std::ostream &os) const
dynamicgraph::SignalPtr< dynamicgraph::Matrix, int > articularJacobianSIN
SignalPtr< Flags, int > selectionSIN
This vector specifies which dimension are used to perform the computation. For instance let us assume...
tuple p1
int i
double drand(void)
Definition: tsot.cpp:26
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > errorSIN
dynamicgraph::SignalPtr< double, int > controlGainSIN
Definition: task.hh:108
void addFeature(FeatureAbstract &s)
Definition: task.cpp:108
int main(void)
Definition: tsot.cpp:33
virtual void setReference(const T *t, typename Signal< T, Time >::Mutex *m=NULL)
dynamicgraph::SignalPtr< Flags, int > controlSelectionSIN
Definition: task.hh:110
dynamicgraph::SignalTimeDependent< double, int > gainSOUT
dynamicgraph::SignalTimeDependent< dynamicgraph::Vector, int > errorSOUT
Definition: task.hh:111
def rand(n)
Class that defines 2D visualPoint visual feature.
virtual void plug(SignalBase< Time > *ref)
virtual void setReference(FeatureAbstract *sdes)=0
dynamicgraph::SignalPtr< double, int > dampingGainSINOUT
Definition: task.hh:109
dynamicgraph::SignalTimeDependent< dynamicgraph::Matrix, int > jacobianSOUT
#define sotDEBUG(level)
Definition: debug.hh:165
dynamicgraph::SignalPtr< dynamicgraph::Vector, int > xySIN
Eigen::MatrixXd Matrix
void sotDEBUGF(const int, const char *,...)
Definition: debug.hh:179
Class that defines the basic elements of a task.
Definition: task.hh:72
std::ostream & displayDependencies(std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
dynamicgraph::Matrix & mrand(dynamicgraph::Matrix &J)
Definition: tsot.cpp:27


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