22#include <orwell/torque/JointImpedanceController.hpp>
31 config_ = interface->getConfigurations()->load<Configuration>(name);
37 std::array<double, dof> stiffness, damping, position_difference_limit;
39 if (!(server->loadParameter<dof>(ns +
"/stiffness", &stiffness)
40 && server->loadParameter<dof>(ns +
"/damping", &damping)
41 && server->loadParameter<dof>(ns +
"/position_difference_limit", &position_difference_limit)))
46 stiffness_ = Eigen::DiagonalMatrix<double, dof, dof>(Eigen::Vector<double, dof>(stiffness.data()));
47 damping_ = Eigen::DiagonalMatrix<double, dof, dof>(Eigen::Vector<double, dof>(damping.data()));
48 position_difference_limit_ = Eigen::Vector<double, dof>(position_difference_limit.data());
54 JointImpedanceController<dof>::~JointImpedanceController() =
default;
59 Eigen::Vector<double, dof> torque = Eigen::Vector<double, dof>::Zero();
61 Eigen::Vector<double, dof> position_error = limit(this->
getReference() - this->getRobotState().getPosition());
63 torque = config_.stiffness_ * position_error + config_.damping_ * (-this->getRobotState().getVelocity());
71 return position_difference.array().min(config_.position_difference_limit_.array()).max(-config_.position_difference_limit_.array());
defines an impedance control law in joint space
Eigen::Vector< double, dof > computeCommand()
computes the control command for the impedance control law in joint space
JointImpedanceController(const sackmesser::Interface::Ptr &interface, const std::string &name)
loads configuration parameters
base implementation of a Controller tracking a given Reference
const Reference & getReference() const
provide access to the Reference to derived classes