17 #ifndef __sot_torque_control_control_manager_H__
18 #define __sot_torque_control_control_manager_H__
25 #if defined(__sot_torque_control_control_manager_H__)
26 #define TALOS_CONTROL_MANAGER_EXPORT __declspec(dllexport)
28 #define TALOS_CONTROL_MANAGER_EXPORT __declspec(dllimport)
31 #define TALOS_CONTROL_MANAGER_EXPORT
38 #include <pinocchio/fwd.hpp>
42 #include <dynamic-graph/signal-helper.h>
45 #include <sot/core/matrix-geometry.hh>
46 #include <sot/core/robot-utils.hh>
48 #include "boost/assign.hpp"
53 namespace talos_balance {
60 #define CTRL_MODE_TRANSITION_TIME_STEP 1000.0
72 os << s.
id <<
"_" << s.
name;
77 :
public ::dynamicgraph::Entity {
80 DYNAMIC_GRAPH_ENTITY_DECL();
89 void init(
const double&
dt,
const std::string& robotRef);
92 std::vector<dynamicgraph::SignalPtr<dynamicgraph::Vector, int>*>
94 std::vector<dynamicgraph::SignalPtr<bool, int>*>
97 std::vector<dynamicgraph::Signal<dynamicgraph::Vector, int>*>
107 void addCtrlMode(
const std::string&
name);
109 void getCtrlMode(
const std::string& jointName);
110 void setCtrlMode(
const std::string& jointName,
const std::string& ctrlMode);
111 void setCtrlMode(
const int jid,
const CtrlMode&
cm);
113 void resetProfiler();
125 void setSleepTime(
const double& seconds);
126 void addEmergencyStopSIN(
const std::string&
name);
129 virtual void display(std::ostream& os)
const;
146 std::vector<CtrlMode>
148 std::vector<CtrlMode>
154 bool convertStringToCtrlMode(
const std::string&
name,
CtrlMode&
cm);
155 bool convertJointNameToJointId(
const std::string&
name,
unsigned int&
id);
157 void updateJointCtrlModesOutputSignal();
CtrlMode(int id, const std::string &name)
DECLARE_SIGNAL_OUT(u_safe, dynamicgraph::Vector)
raw motor control
std::vector< dynamicgraph::SignalPtr< dynamicgraph::Vector, int > * > m_ctrlInputsSIN
RobotUtilShrPtr m_robot_util
std::vector< CtrlMode > m_jointCtrlModes_previous
control mode of the joints
DECLARE_SIGNAL_OUT(u, dynamicgraph::Vector)
max motor control
DECLARE_SIGNAL_IN(u_max, dynamicgraph::Vector)
double m_dt
true if the entity has been successfully initialized
void setCtrlMode(const std::string &jointName, const std::string &ctrlMode)
int m_iter
true at the first iteration, false otherwise
std::vector< int > m_jointCtrlModesCountDown
previous control mode of the joints
std::vector< std::string > m_ctrlModes
std::vector< dynamicgraph::SignalPtr< bool, int > * > m_emergencyStopVector
std::vector< CtrlMode > m_jointCtrlModes_current
existing control modes
std::vector< dynamicgraph::Signal< dynamicgraph::Vector, int > * > m_jointsCtrlModesSOUT
bool m_emergency_stop_triggered
control loop time period
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
AdmittanceControllerEndEffector EntityClassName
std::ostream & operator<<(std::ostream &os, const CtrlMode &s)
#define TALOS_CONTROL_MANAGER_EXPORT