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

#include <sot/torque_control/joint-torque-controller.hh>

Inheritance diagram for JointTorqueController:
Collaboration diagram for JointTorqueController:

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW JointTorqueController (const std::string &name)
 
 DECLARE_SIGNAL_IN (jointsPositions, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (jointsVelocities, dynamicgraph::Vector)
 q More...
 
 DECLARE_SIGNAL_IN (jointsAccelerations, dynamicgraph::Vector)
 dq More...
 
 DECLARE_SIGNAL_IN (jointsTorques, dynamicgraph::Vector)
 ddq More...
 
 DECLARE_SIGNAL_IN (jointsTorquesDerivative, dynamicgraph::Vector)
 estimated joints torques tau More...
 
 DECLARE_SIGNAL_IN (jointsTorquesDesired, dynamicgraph::Vector)
 estimated joints torques derivative dtau More...
 
 DECLARE_SIGNAL_IN (dq_des, dynamicgraph::Vector)
 desired joints torques tauDes More...
 
 DECLARE_SIGNAL_IN (KpTorque, dynamicgraph::Vector)
 desired joint velocities More...
 
 DECLARE_SIGNAL_IN (KiTorque, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (KdTorque, dynamicgraph::Vector)
 integral gain for torque feedback controller More...
 
 DECLARE_SIGNAL_IN (KdVel, dynamicgraph::Vector)
 derivative gain for torque feedback controller More...
 
 DECLARE_SIGNAL_IN (KiVel, dynamicgraph::Vector)
 derivative gain for velocity feedback More...
 
 DECLARE_SIGNAL_IN (torque_integral_saturation, dynamicgraph::Vector)
 integral gain for velocity feedback More...
 
 DECLARE_SIGNAL_IN (coulomb_friction_compensation_percentage, dynamicgraph::Vector)
 integral error saturation More...
 
 DECLARE_SIGNAL_IN (motorParameterKt_p, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKt_n, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKf_p, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKf_n, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKv_p, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKv_n, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKa_p, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (motorParameterKa_n, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (polySignDq, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (u, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (smoothSignDq, dynamicgraph::Vector)
 Desired current. More...
 
 DECLARE_SIGNAL_OUT (torque_error_integral, dynamicgraph::Vector)
 smooth approximation of sign(dq) More...
 
virtual void display (std::ostream &os) const
 
void init (const double &timestep, const std::string &robotRef)
 
void reset_integral ()
 

Protected Member Functions

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

Protected Attributes

Eigen::VectorXd m_current_des
 
Eigen::VectorXd m_currentErrIntegral
 integral of the torque error More...
 
Eigen::VectorXd m_dqErrIntegral
 integral of the current error More...
 
double m_dt
 
RobotUtilShrPtr m_robot_util
 integral of the velocity error More...
 
Eigen::VectorXd m_tau_star
 timestep of the controller More...
 
Eigen::VectorXd m_tauErrIntegral
 
MotorModel motorModel
 integral of the torque tracking error More...
 

Detailed Description

This Entity takes as inputs the estimated joints' positions, velocities, accelerations and torques and it computes the desired current to send to the motors board in order to track the desired joints torques. Most of the input of this entity are computed by the entity ForceTorqueEstimator.

QUICK START Create the entity, plug all the input signals, call the init method specifying the control-loop time step. For instance: jtc = JointTorqueController("jtc"); plug(estimator.jointsPositions, jtc.jointsPositions); plug(estimator.jointsVelocities, jtc.jointsVelocities); plug(estimator.jointsAccelerations, jtc.jointsAccelerations); plug(estimator.jointsTorques, jtc.jointsTorques); jtc.KpTorque.value = N_DOF*(10.0,); jtc.KiTorque.value = N_DOF*(0.01,); jtc.init(dt);

DETAILS To do...

Definition at line 67 of file joint-torque-controller.hh.

Constructor & Destructor Documentation

◆ JointTorqueController()

JointTorqueController ( const std::string &  name)

— CONSTRUCTOR -—

Definition at line 61 of file joint-torque-controller.cpp.

Member Function Documentation

◆ DECLARE_SIGNAL_IN() [1/23]

DECLARE_SIGNAL_IN ( jointsPositions  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [2/23]

DECLARE_SIGNAL_IN ( jointsVelocities  ,
dynamicgraph::Vector   
)

q

◆ DECLARE_SIGNAL_IN() [3/23]

DECLARE_SIGNAL_IN ( jointsAccelerations  ,
dynamicgraph::Vector   
)

dq

◆ DECLARE_SIGNAL_IN() [4/23]

DECLARE_SIGNAL_IN ( jointsTorques  ,
dynamicgraph::Vector   
)

ddq

◆ DECLARE_SIGNAL_IN() [5/23]

DECLARE_SIGNAL_IN ( jointsTorquesDerivative  ,
dynamicgraph::Vector   
)

estimated joints torques tau

◆ DECLARE_SIGNAL_IN() [6/23]

DECLARE_SIGNAL_IN ( jointsTorquesDesired  ,
dynamicgraph::Vector   
)

estimated joints torques derivative dtau

◆ DECLARE_SIGNAL_IN() [7/23]

DECLARE_SIGNAL_IN ( dq_des  ,
dynamicgraph::Vector   
)

desired joints torques tauDes

◆ DECLARE_SIGNAL_IN() [8/23]

DECLARE_SIGNAL_IN ( KpTorque  ,
dynamicgraph::Vector   
)

desired joint velocities

◆ DECLARE_SIGNAL_IN() [9/23]

DECLARE_SIGNAL_IN ( KiTorque  ,
dynamicgraph::Vector   
)

proportional gain for torque feedback controller

◆ DECLARE_SIGNAL_IN() [10/23]

DECLARE_SIGNAL_IN ( KdTorque  ,
dynamicgraph::Vector   
)

integral gain for torque feedback controller

◆ DECLARE_SIGNAL_IN() [11/23]

DECLARE_SIGNAL_IN ( KdVel  ,
dynamicgraph::Vector   
)

derivative gain for torque feedback controller

◆ DECLARE_SIGNAL_IN() [12/23]

DECLARE_SIGNAL_IN ( KiVel  ,
dynamicgraph::Vector   
)

derivative gain for velocity feedback

◆ DECLARE_SIGNAL_IN() [13/23]

DECLARE_SIGNAL_IN ( torque_integral_saturation  ,
dynamicgraph::Vector   
)

integral gain for velocity feedback

◆ DECLARE_SIGNAL_IN() [14/23]

DECLARE_SIGNAL_IN ( coulomb_friction_compensation_percentage  ,
dynamicgraph::Vector   
)

integral error saturation

parameters for the linear model

◆ DECLARE_SIGNAL_IN() [15/23]

DECLARE_SIGNAL_IN ( motorParameterKt_p  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [16/23]

DECLARE_SIGNAL_IN ( motorParameterKt_n  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [17/23]

DECLARE_SIGNAL_IN ( motorParameterKf_p  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [18/23]

DECLARE_SIGNAL_IN ( motorParameterKf_n  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [19/23]

DECLARE_SIGNAL_IN ( motorParameterKv_p  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [20/23]

DECLARE_SIGNAL_IN ( motorParameterKv_n  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [21/23]

DECLARE_SIGNAL_IN ( motorParameterKa_p  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [22/23]

DECLARE_SIGNAL_IN ( motorParameterKa_n  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN() [23/23]

DECLARE_SIGNAL_IN ( polySignDq  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT() [1/3]

DECLARE_SIGNAL_OUT ( ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT() [2/3]

DECLARE_SIGNAL_OUT ( smoothSignDq  ,
dynamicgraph::Vector   
)

Desired current.

◆ DECLARE_SIGNAL_OUT() [3/3]

DECLARE_SIGNAL_OUT ( torque_error_integral  ,
dynamicgraph::Vector   
)

smooth approximation of sign(dq)

◆ display()

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

Definition at line 277 of file joint-torque-controller.cpp.

◆ init()

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

Initialize the JointTorqueController.

Parameters
timestepPeriod (in seconds) after which the sensors' data are updated.

Definition at line 131 of file joint-torque-controller.cpp.

◆ reset_integral()

void reset_integral ( )

Definition at line 169 of file joint-torque-controller.cpp.

◆ sendMsg()

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

Definition at line 138 of file joint-torque-controller.hh.

Member Data Documentation

◆ m_current_des

Eigen::VectorXd m_current_des
protected

Definition at line 129 of file joint-torque-controller.hh.

◆ m_currentErrIntegral

Eigen::VectorXd m_currentErrIntegral
protected

integral of the torque error

Definition at line 131 of file joint-torque-controller.hh.

◆ m_dqErrIntegral

Eigen::VectorXd m_dqErrIntegral
protected

integral of the current error

Definition at line 134 of file joint-torque-controller.hh.

◆ m_dt

double m_dt
protected

Definition at line 127 of file joint-torque-controller.hh.

◆ m_robot_util

RobotUtilShrPtr m_robot_util
protected

integral of the velocity error

Definition at line 136 of file joint-torque-controller.hh.

◆ m_tau_star

Eigen::VectorXd m_tau_star
protected

timestep of the controller

Definition at line 128 of file joint-torque-controller.hh.

◆ m_tauErrIntegral

Eigen::VectorXd m_tauErrIntegral
protected

Definition at line 130 of file joint-torque-controller.hh.

◆ motorModel

MotorModel motorModel
protected

integral of the torque tracking error

Definition at line 126 of file joint-torque-controller.hh.


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