sot-torque-control  1.6.5
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
ControlManager Class Reference

#include <sot/torque_control/control-manager.hh>

Inheritance diagram for ControlManager:
Collaboration diagram for ControlManager:

Public Member Functions

 ControlManager (const std::string &name)
 
void addCtrlMode (const std::string &name)
 same as u when everything is fine, 0 otherwise More...
 
void addEmergencyStopSIN (const std::string &name)
 
void ctrlModes ()
 
 DECLARE_SIGNAL_IN (i_max, dynamicgraph::Vector)
 predicted joint torques (using motor model) More...
 
 DECLARE_SIGNAL_IN (i_measured, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (tau, dynamicgraph::Vector)
 motor currents More...
 
 DECLARE_SIGNAL_IN (tau_max, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (tau_predicted, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (u_max, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (u, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (u_safe, dynamicgraph::Vector)
 
virtual void display (std::ostream &os) const
 
void displayRobotUtil ()
 
void getCtrlMode (const std::string &jointName)
 
void init (const double &dt, const std::string &urdfFile, const std::string &robotRef)
 
void resetProfiler ()
 
void sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const char *="", int=0)
 
void setCtrlMode (const int jid, const CtrlMode &cm)
 
void setCtrlMode (const std::string &jointName, const std::string &ctrlMode)
 
void setFootFrameName (const std::string &, const std::string &)
 
void setForceLimitsFromId (const double &jointId, const dynamicgraph::Vector &lq, const dynamicgraph::Vector &uq)
 Command related to ForceUtil. More...
 
void setForceNameToForceId (const std::string &forceName, const double &forceId)
 
void setHandFrameName (const std::string &, const std::string &)
 Commands related to HandUtil. More...
 
void setImuJointName (const std::string &)
 
void setJointLimitsFromId (const double &jointId, const double &lq, const double &uq)
 
void setJoints (const dynamicgraph::Vector &)
 Set the mapping between urdf and sot. More...
 
void setNameToId (const std::string &jointName, const double &jointId)
 Commands related to joint name and joint id. More...
 
void setRightFootForceSensorXYZ (const dynamicgraph::Vector &)
 
void setRightFootSoleXYZ (const dynamicgraph::Vector &)
 Commands related to FootUtil. More...
 
void setSleepTime (const double &seconds)
 
void setStreamPrintPeriod (const double &s)
 

Public Attributes

std::vector< dynamicgraph::SignalPtr< dynamicgraph::Vector, int > * > m_ctrlInputsSIN
 
std::vector< dynamicgraph::SignalPtr< bool, int > * > m_emergencyStopSIN
 
std::vector< dynamicgraph::Signal< dynamicgraph::Vector, int > * > m_jointsCtrlModesSOUT
 

Protected Member Functions

bool convertJointNameToJointId (const std::string &name, unsigned int &id)
 
bool convertStringToCtrlMode (const std::string &name, CtrlMode &cm)
 
bool isJointInRange (unsigned int id, double q)
 
void updateJointCtrlModesOutputSignal ()
 

Protected Attributes

std::vector< std::string > m_ctrlModes
 
double m_dt
 true if the entity has been successfully initialized More...
 
bool m_emergency_stop_triggered
 control loop time period More...
 
bool m_initSucceeded
 
bool m_is_first_iter
 
int m_iter
 true at the first iteration, false otherwise More...
 
std::vector< CtrlModem_jointCtrlModes_current
 existing control modes More...
 
std::vector< CtrlModem_jointCtrlModes_previous
 control mode of the joints More...
 
std::vector< int > m_jointCtrlModesCountDown
 previous control mode of the joints More...
 
tsid::robots::RobotWrapper * m_robot
 
RobotUtilShrPtr m_robot_util
 
double m_sleep_time
 

Detailed Description

Definition at line 68 of file control-manager.hh.

Constructor & Destructor Documentation

◆ ControlManager()

ControlManager ( const std::string &  name)

Definition at line 47 of file control-manager.cpp.

Member Function Documentation

◆ addCtrlMode()

void addCtrlMode ( const std::string &  name)

same as u when everything is fine, 0 otherwise

Commands related to the control mode.

Definition at line 376 of file control-manager.cpp.

◆ addEmergencyStopSIN()

void addEmergencyStopSIN ( const std::string &  name)

Definition at line 492 of file control-manager.cpp.

◆ convertJointNameToJointId()

bool convertJointNameToJointId ( const std::string &  name,
unsigned int &  id 
)
protected

Definition at line 659 of file control-manager.cpp.

◆ convertStringToCtrlMode()

bool convertStringToCtrlMode ( const std::string &  name,
CtrlMode cm 
)
protected

counters used for the transition between two ctrl modes

Definition at line 645 of file control-manager.cpp.

◆ ctrlModes()

void ctrlModes ( )

Definition at line 405 of file control-manager.cpp.

◆ DECLARE_SIGNAL_IN() [1/6]

DECLARE_SIGNAL_IN ( i_max  ,
dynamicgraph::Vector   
)

predicted joint torques (using motor model)

◆ DECLARE_SIGNAL_IN() [2/6]

DECLARE_SIGNAL_IN ( i_measured  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [3/6]

DECLARE_SIGNAL_IN ( tau  ,
dynamicgraph::Vector   
)

motor currents

◆ DECLARE_SIGNAL_IN() [4/6]

DECLARE_SIGNAL_IN ( tau_max  ,
dynamicgraph::Vector   
)

max desired current allowed before stopping the controller (in Ampers)

◆ DECLARE_SIGNAL_IN() [5/6]

DECLARE_SIGNAL_IN ( tau_predicted  ,
dynamicgraph::Vector   
)

estimated joint torques (using dynamic robot model + F/T sensors)

◆ DECLARE_SIGNAL_IN() [6/6]

DECLARE_SIGNAL_IN ( u_max  ,
dynamicgraph::Vector   
)

max current allowed before stopping the controller (in Ampers)

◆ DECLARE_SIGNAL_OUT() [1/2]

DECLARE_SIGNAL_OUT ( ,
dynamicgraph::Vector   
)

max torque allowed before stopping the controller

◆ DECLARE_SIGNAL_OUT() [2/2]

DECLARE_SIGNAL_OUT ( u_safe  ,
dynamicgraph::Vector   
)

◆ display()

void display ( std::ostream &  os) const
virtual

Definition at line 701 of file control-manager.cpp.

◆ displayRobotUtil()

void displayRobotUtil ( )

Definition at line 618 of file control-manager.cpp.

◆ getCtrlMode()

void getCtrlMode ( const std::string &  jointName)

Definition at line 460 of file control-manager.cpp.

◆ init()

void init ( const double &  dt,
const std::string &  urdfFile,
const std::string &  robotRef 
)

Initialize

Parameters
dtcontrol interval
urdfFilepath to the URDF model of the robot

Definition at line 194 of file control-manager.cpp.

◆ isJointInRange()

bool isJointInRange ( unsigned int  id,
double  q 
)
protected

Definition at line 677 of file control-manager.cpp.

◆ resetProfiler()

void resetProfiler ( )

Definition at line 477 of file control-manager.cpp.

◆ sendMsg()

void sendMsg ( const std::string &  msg,
MsgType  t = MSG_TYPE_INFO,
const char *  = "",
int  = 0 
)
inline

Definition at line 157 of file control-manager.hh.

◆ setCtrlMode() [1/2]

void setCtrlMode ( const int  jid,
const CtrlMode cm 
)

Definition at line 434 of file control-manager.cpp.

◆ setCtrlMode() [2/2]

void setCtrlMode ( const std::string &  jointName,
const std::string &  ctrlMode 
)

◆ setFootFrameName()

void setFootFrameName ( const std::string &  FootName,
const std::string &  FrameName 
)

Definition at line 582 of file control-manager.cpp.

◆ setForceLimitsFromId()

void setForceLimitsFromId ( const double &  jointId,
const dynamicgraph::Vector &  lq,
const dynamicgraph::Vector &  uq 
)

Command related to ForceUtil.

Definition at line 528 of file control-manager.cpp.

◆ setForceNameToForceId()

void setForceNameToForceId ( const std::string &  forceName,
const double &  forceId 
)

Definition at line 540 of file control-manager.cpp.

◆ setHandFrameName()

void setHandFrameName ( const std::string &  HandName,
const std::string &  FrameName 
)

Commands related to HandUtil.

Definition at line 596 of file control-manager.cpp.

◆ setImuJointName()

void setImuJointName ( const std::string &  JointName)

Definition at line 610 of file control-manager.cpp.

◆ setJointLimitsFromId()

void setJointLimitsFromId ( const double &  jointId,
const double &  lq,
const double &  uq 
)

Definition at line 517 of file control-manager.cpp.

◆ setJoints()

void setJoints ( const dynamicgraph::Vector &  )

Set the mapping between urdf and sot.

Definition at line 553 of file control-manager.cpp.

◆ setNameToId()

void setNameToId ( const std::string &  jointName,
const double &  jointId 
)

Commands related to joint name and joint id.

Definition at line 506 of file control-manager.cpp.

◆ setRightFootForceSensorXYZ()

void setRightFootForceSensorXYZ ( const dynamicgraph::Vector &  xyz)

Definition at line 571 of file control-manager.cpp.

◆ setRightFootSoleXYZ()

void setRightFootSoleXYZ ( const dynamicgraph::Vector &  xyz)

Commands related to FootUtil.

Definition at line 561 of file control-manager.cpp.

◆ setSleepTime()

void setSleepTime ( const double &  seconds)

Definition at line 486 of file control-manager.cpp.

◆ setStreamPrintPeriod()

void setStreamPrintPeriod ( const double &  s)

Definition at line 482 of file control-manager.cpp.

◆ updateJointCtrlModesOutputSignal()

void updateJointCtrlModesOutputSignal ( )
protected

Definition at line 623 of file control-manager.cpp.

Member Data Documentation

◆ m_ctrlInputsSIN

std::vector<dynamicgraph::SignalPtr<dynamicgraph::Vector, int>*> m_ctrlInputsSIN

Definition at line 84 of file control-manager.hh.

◆ m_ctrlModes

std::vector<std::string> m_ctrlModes
protected

time to sleep at every iteration (to slow down simulation)

Definition at line 176 of file control-manager.hh.

◆ m_dt

double m_dt
protected

true if the entity has been successfully initialized

Definition at line 167 of file control-manager.hh.

◆ m_emergency_stop_triggered

bool m_emergency_stop_triggered
protected

control loop time period

Definition at line 168 of file control-manager.hh.

◆ m_emergencyStopSIN

std::vector<dynamicgraph::SignalPtr<bool, int>*> m_emergencyStopSIN

Definition at line 86 of file control-manager.hh.

◆ m_initSucceeded

bool m_initSucceeded
protected

Definition at line 166 of file control-manager.hh.

◆ m_is_first_iter

bool m_is_first_iter
protected

true if an emergency condition as been triggered either by an other entity, or by control limit violation

Definition at line 171 of file control-manager.hh.

◆ m_iter

int m_iter
protected

true at the first iteration, false otherwise

Definition at line 172 of file control-manager.hh.

◆ m_jointCtrlModes_current

std::vector<CtrlMode> m_jointCtrlModes_current
protected

existing control modes

Definition at line 178 of file control-manager.hh.

◆ m_jointCtrlModes_previous

std::vector<CtrlMode> m_jointCtrlModes_previous
protected

control mode of the joints

Definition at line 180 of file control-manager.hh.

◆ m_jointCtrlModesCountDown

std::vector<int> m_jointCtrlModesCountDown
protected

previous control mode of the joints

Definition at line 182 of file control-manager.hh.

◆ m_jointsCtrlModesSOUT

std::vector<dynamicgraph::Signal<dynamicgraph::Vector, int>*> m_jointsCtrlModesSOUT

emergency stop inputs. If one is true, control is set to zero forever

Definition at line 89 of file control-manager.hh.

◆ m_robot

tsid::robots::RobotWrapper* m_robot
protected

Definition at line 164 of file control-manager.hh.

◆ m_robot_util

RobotUtilShrPtr m_robot_util
protected

Definition at line 163 of file control-manager.hh.

◆ m_sleep_time

double m_sleep_time
protected

Definition at line 173 of file control-manager.hh.


The documentation for this class was generated from the following files: