sot-talos-device.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2016,
3  *
4  * Olivier Stasse
5  *
6  * LAAS, CNRS
7  *
8  * This file is part of TalosController.
9  * TalosController is not a free software,
10  * it contains information related to Talos which involves
11  * that you either purchased the proper license to havec access to
12  * those informations, or that you signed the appropriate
13  * Non-Disclosure agreement.
14  *
15  *
16  */
17 
18 #ifndef _SOT_TalosDevice_H_
19 #define _SOT_TalosDevice_H_
20 
21 #include <dynamic-graph/entity.h>
22 #include <dynamic-graph/linear-algebra.h>
23 #include <dynamic-graph/signal-ptr.h>
24 #include <dynamic-graph/signal.h>
25 
26 #include <sot/core/abstract-sot-external-interface.hh>
27 #include <sot/core/device.hh>
28 #include <sot/core/matrix-geometry.hh>
29 
30 namespace dgsot = dynamicgraph::sot;
31 namespace dg = dynamicgraph;
32 
33 class SoTTalosDevice : public dgsot::Device {
34  public:
35  static const std::string CLASS_NAME;
36  static const double TIMESTEP_DEFAULT;
37 
38  virtual const std::string &getClassName() const { return CLASS_NAME; }
39 
40  SoTTalosDevice(std::string RobotName);
41  virtual ~SoTTalosDevice();
42 
43  void setSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
44 
45  void setupSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
46 
47  void nominalSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
48 
49  void cleanupSetSensors(std::map<std::string, dgsot::SensorValues> &sensorsIn);
50 
51  void getControl(std::map<std::string, dgsot::ControlValues> &anglesOut);
52 
53  void timeStep(double ts) { timestep_ = ts; }
54 
55  protected:
57  dg::Vector previousState_;
58 
60  std::vector<double> baseff_;
61 
63  dynamicgraph::Signal<dg::Vector, int> accelerometerSOUT_;
65  dynamicgraph::Signal<dg::Vector, int> gyrometerSOUT_;
67  dynamicgraph::Signal<dg::Vector, int> currentsSOUT_;
69  dynamicgraph::Signal<dg::Vector, int> joint_anglesSOUT_;
71  dynamicgraph::Signal<dg::Vector, int> motor_anglesSOUT_;
72 
74  dynamicgraph::Signal<dg::Vector, int> p_gainsSOUT_;
75 
76  dynamicgraph::Signal<dg::Vector, int> d_gainsSOUT_;
77 
79  void setSensorsForce(std::map<std::string, dgsot::SensorValues> &SensorsIn,
80  int t);
81  void setSensorsIMU(std::map<std::string, dgsot::SensorValues> &SensorsIn,
82  int t);
83  void setSensorsEncoders(std::map<std::string, dgsot::SensorValues> &SensorsIn,
84  int t);
86  std::map<std::string, dgsot::SensorValues> &SensorsIn, int t);
88  std::map<std::string, dgsot::SensorValues> &SensorsIn, int t);
89  void setSensorsGains(std::map<std::string, dgsot::SensorValues> &SensorsIn,
90  int t);
91 
93  dg::Vector dgforces_;
94  dg::Vector dgRobotState_; // motor-angles
95  dg::Vector joint_angles_; // joint-angles
96  dg::Vector motor_angles_; // motor-angles
97  dg::Vector dgRobotVelocity_; // motor velocities
98  dg::Vector velocities_; // motor velocities
99  dgsot::MatrixRotation pose;
100  dg::Vector accelerometer_;
101  dg::Vector gyrometer_;
102  dg::Vector torques_;
103  dg::Vector currents_;
104  dg::Vector p_gains_;
105  dg::Vector d_gains_;
106 };
107 #endif /* _SOT_TalosDevice_H_*/
SoTTalosDevice::setSensorsIMU
void setSensorsIMU(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Definition: sot-talos-device.cpp:145
SoTTalosDevice::dgRobotVelocity_
dg::Vector dgRobotVelocity_
Definition: sot-talos-device.hh:97
SoTTalosDevice::currents_
dg::Vector currents_
Definition: sot-talos-device.hh:103
SoTTalosDevice::d_gains_
dg::Vector d_gains_
Definition: sot-talos-device.hh:105
SoTTalosDevice::motor_anglesSOUT_
dynamicgraph::Signal< dg::Vector, int > motor_anglesSOUT_
motor angles
Definition: sot-talos-device.hh:71
SoTTalosDevice::pose
dgsot::MatrixRotation pose
Definition: sot-talos-device.hh:99
SoTTalosDevice::p_gainsSOUT_
dynamicgraph::Signal< dg::Vector, int > p_gainsSOUT_
proportional and derivative position-control gains
Definition: sot-talos-device.hh:74
dynamicgraph
Definition: sot-talos-device.cpp:378
SoTTalosDevice::torques_
dg::Vector torques_
Definition: sot-talos-device.hh:102
SoTTalosDevice::accelerometer_
dg::Vector accelerometer_
Definition: sot-talos-device.hh:100
SoTTalosDevice::setSensorsEncoders
void setSensorsEncoders(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Definition: sot-talos-device.cpp:176
SoTTalosDevice::setSensorsForce
void setSensorsForce(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Protected methods for internal variables filling.
Definition: sot-talos-device.cpp:122
SoTTalosDevice::CLASS_NAME
static const std::string CLASS_NAME
Definition: sot-talos-device.hh:35
SoTTalosDevice::TIMESTEP_DEFAULT
static const double TIMESTEP_DEFAULT
Definition: sot-talos-device.hh:36
SoTTalosDevice::setSensorsVelocities
void setSensorsVelocities(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Definition: sot-talos-device.cpp:207
SoTTalosDevice::getClassName
virtual const std::string & getClassName() const
Definition: sot-talos-device.hh:38
SoTTalosDevice::gyrometerSOUT_
dynamicgraph::Signal< dg::Vector, int > gyrometerSOUT_
Rotation velocity measured by gyrometers.
Definition: sot-talos-device.hh:65
SoTTalosDevice::d_gainsSOUT_
dynamicgraph::Signal< dg::Vector, int > d_gainsSOUT_
Definition: sot-talos-device.hh:76
SoTTalosDevice::setupSetSensors
void setupSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-device.cpp:284
SoTTalosDevice::nominalSetSensors
void nominalSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-device.cpp:292
SoTTalosDevice::setSensorsTorquesCurrents
void setSensorsTorquesCurrents(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Definition: sot-talos-device.cpp:224
SoTTalosDevice::setSensors
void setSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-device.cpp:269
SoTTalosDevice::joint_angles_
dg::Vector joint_angles_
Definition: sot-talos-device.hh:95
SoTTalosDevice::setSensorsGains
void setSensorsGains(std::map< std::string, dgsot::SensorValues > &SensorsIn, int t)
Definition: sot-talos-device.cpp:247
SoTTalosDevice::timeStep
void timeStep(double ts)
Definition: sot-talos-device.hh:53
SoTTalosDevice::baseff_
std::vector< double > baseff_
Intermediate variables to avoid allocation during control.
Definition: sot-talos-device.hh:60
SoTTalosDevice::currentsSOUT_
dynamicgraph::Signal< dg::Vector, int > currentsSOUT_
motor currents
Definition: sot-talos-device.hh:67
SoTTalosDevice::dgforces_
dg::Vector dgforces_
Intermediate variables to avoid allocation during control.
Definition: sot-talos-device.hh:93
SoTTalosDevice::p_gains_
dg::Vector p_gains_
Definition: sot-talos-device.hh:104
SoTTalosDevice::cleanupSetSensors
void cleanupSetSensors(std::map< std::string, dgsot::SensorValues > &sensorsIn)
Definition: sot-talos-device.cpp:297
SoTTalosDevice::velocities_
dg::Vector velocities_
Definition: sot-talos-device.hh:98
SoTTalosDevice::getControl
void getControl(std::map< std::string, dgsot::ControlValues > &anglesOut)
Definition: sot-talos-device.cpp:302
dynamicgraph::sot
Definition: sot-talos-device.cpp:379
SoTTalosDevice::gyrometer_
dg::Vector gyrometer_
Definition: sot-talos-device.hh:101
SoTTalosDevice::SoTTalosDevice
SoTTalosDevice(std::string RobotName)
Definition: sot-talos-device.cpp:69
SoTTalosDevice::dgRobotState_
dg::Vector dgRobotState_
Definition: sot-talos-device.hh:94
SoTTalosDevice::~SoTTalosDevice
virtual ~SoTTalosDevice()
Definition: sot-talos-device.cpp:120
SoTTalosDevice::accelerometerSOUT_
dynamicgraph::Signal< dg::Vector, int > accelerometerSOUT_
Accelerations measured by accelerometers.
Definition: sot-talos-device.hh:63
SoTTalosDevice::motor_angles_
dg::Vector motor_angles_
Definition: sot-talos-device.hh:96
SoTTalosDevice::previousState_
dg::Vector previousState_
Previous robot configuration.
Definition: sot-talos-device.hh:57
SoTTalosDevice::joint_anglesSOUT_
dynamicgraph::Signal< dg::Vector, int > joint_anglesSOUT_
joint angles
Definition: sot-talos-device.hh:69
SoTTalosDevice
Definition: sot-talos-device.hh:33