parameter-server.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2015, Andrea Del Prete, LAAS-CNRS
3  *
4  * This file is part of sot-torque-control.
5  * sot-torque-control is free software: you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation, either version 3 of
8  * the License, or (at your option) any later version.
9  * sot-torque-control is distributed in the hope that it will be
10  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details. You should
13  * have received a copy of the GNU Lesser General Public License along
14  * with sot-torque-control. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __sot_torque_control_parameter_server_H__
18 #define __sot_torque_control_parameter_server_H__
19 
20 /* --------------------------------------------------------------------- */
21 /* --- API ------------------------------------------------------------- */
22 /* --------------------------------------------------------------------- */
23 
24 #if defined(WIN32)
25 #if defined(__sot_torque_parameter_server_H__)
26 #define SOTParameterServer_EXPORT __declspec(dllexport)
27 #else
28 #define SOTParameterServer_EXPORT __declspec(dllimport)
29 #endif
30 #else
31 #define SOTParameterServer_EXPORT
32 #endif
33 
34 /* --------------------------------------------------------------------- */
35 /* --- INCLUDE --------------------------------------------------------- */
36 /* --------------------------------------------------------------------- */
37 
38 #include "boost/assign.hpp"
39 #include <dynamic-graph/signal-helper.h>
40 #include <map>
42 #include <sot/core/robot-utils.hh>
43 
44 namespace dynamicgraph {
45 namespace sot {
46 
47 /* --------------------------------------------------------------------- */
48 /* --- CLASS ----------------------------------------------------------- */
49 /* --------------------------------------------------------------------- */
50 
52 #define CTRL_MODE_TRANSITION_TIME_STEP 1000.0
53 
55  : public ::dynamicgraph::Entity {
57  DYNAMIC_GRAPH_ENTITY_DECL();
58 
59 public:
60  /* --- CONSTRUCTOR ---- */
61  ParameterServer(const std::string &name);
62 
66  void init(const double &dt, const std::string &urdfFile,
67  const std::string &robotRef);
68 
69  /* --- SIGNALS --- */
70 
71  /* --- COMMANDS --- */
72 
74  void setNameToId(const std::string &jointName, const double &jointId);
75  void setJointLimitsFromId(const double &jointId, const double &lq,
76  const double &uq);
77 
79  void setForceLimitsFromId(const double &jointId,
80  const dynamicgraph::Vector &lq,
81  const dynamicgraph::Vector &uq);
82  void setForceNameToForceId(const std::string &forceName,
83  const double &forceId);
84 
87  void setRightFootSoleXYZ(const dynamicgraph::Vector &);
88  void setRightFootForceSensorXYZ(const dynamicgraph::Vector &);
89  void setFootFrameName(const std::string &, const std::string &);
90  void setImuJointName(const std::string &);
91  void displayRobotUtil();
95  void setParameter(const std::string &ParameterName,
96  const std::string &ParameterValue);
97  std::string getParameter(const std::string &ParameterName);
100  void setJoints(const dynamicgraph::Vector &);
101 
102  /* --- ENTITY INHERITANCE --- */
103  virtual void display(std::ostream &os) const;
104 
105 protected:
108  double m_dt;
110  bool m_is_first_iter;
113  int m_iter;
114  double m_sleep_time;
115 
117  bool convertJointNameToJointId(const std::string &name, unsigned int &id);
118  bool isJointInRange(unsigned int id, double q);
119  void updateJointCtrlModesOutputSignal();
120 
121 }; // class ParameterServer
122 
123 } // namespace sot
124 } // namespace dynamicgraph
125 
126 #endif // #ifndef __sot_torque_control_control_manager_H__
dynamicgraph::sot::ParameterServer::m_robot_util
RobotUtilShrPtr m_robot_util
Definition: parameter-server.hh:106
dynamicgraph::sot::RobotUtilShrPtr
boost::shared_ptr< RobotUtil > RobotUtilShrPtr
Accessors - This should be changed to RobotUtilPtrShared.
Definition: robot-utils.hh:243
dynamicgraph
Definition: abstract-sot-external-interface.hh:17
robot-utils.hh
dynamicgraph::sot::ParameterServer::m_dt
double m_dt
true if the entity has been successfully initialized
Definition: parameter-server.hh:108
dynamicgraph::sot::ParameterServer::m_iter
int m_iter
true at the first iteration, false otherwise
Definition: parameter-server.hh:113
matrix-geometry.hh
dynamicgraph::sot::ParameterServer::m_initSucceeded
bool m_initSucceeded
Definition: parameter-server.hh:107
dynamicgraph::sot::ParameterServer
Definition: parameter-server.hh:54
dynamicgraph::sot::ParameterServer::m_emergency_stop_triggered
bool m_emergency_stop_triggered
control loop time period
Definition: parameter-server.hh:109
dynamicgraph::sot::ParameterServer::m_sleep_time
double m_sleep_time
Definition: parameter-server.hh:114
SOTParameterServer_EXPORT
#define SOTParameterServer_EXPORT
Definition: parameter-server.hh:31