22#include <sackmesser/Configurations.hpp>
24#include <orwell/torque/CartesianImpedanceController.hpp>
29 template <
int dof,
class Reference>
33 config_ = interface->getConfigurations()->load<Configuration>(name);
35 position_error_ = Eigen::Vector<double, 6>::Zero();
36 velocity_error_ = Eigen::Vector<double, 6>::Zero();
37 acceleration_error_ = Eigen::Vector<double, 6>::Zero();
40 template <
int dof,
class Reference>
42 const std::shared_ptr<sackmesser::Configurations> &server)
44 std::array<double, 6> stiffness, damping, inertia, wrench_limits;
46 if (!(server->loadParameter<6>(ns +
"/stiffness", &stiffness)
47 && server->loadParameter<6>(ns +
"/damping", &damping)
48 && server->loadParameter<6>(ns +
"/inertia", &inertia)
49 && server->loadParameter<6>(ns +
"/wrench_limits", &wrench_limits)))
54 stiffness_ = Eigen::DiagonalMatrix<double, 6, 6>(Eigen::Vector<double, 6>(stiffness.data()));
55 damping_ = Eigen::DiagonalMatrix<double, 6, 6>(Eigen::Vector<double, 6>(damping.data()));
56 inertia_ = Eigen::DiagonalMatrix<double, 6, 6>(Eigen::Vector<double, 6>(inertia.data()));
57 wrench_limits_ = Eigen::Vector<double, 6>(wrench_limits.data());
62 template <
int dof,
class Reference>
63 CartesianImpedanceController<dof, Reference>::~CartesianImpedanceController() =
default;
65 template <
int dof,
class Reference>
70 return this->getRobotModel()->getJacobian().transpose() *
limitWrench(this->getDesiredWrench());
73 template <
int dof,
class Reference>
76 return config_.stiffness_ * position_error_ +
77 config_.damping_ * velocity_error_ +
78 config_.inertia_ * acceleration_error_;
81 template <
int dof,
class Reference>
84 position_error_ = position_error;
87 template <
int dof,
class Reference>
90 velocity_error_ = velocity_error;
93 template <
int dof,
class Reference>
96 acceleration_error_ = acceleration_error;
99 template <
int dof,
class Reference>
102 return wrench.array().min(config_.wrench_limits_.array()).max(-config_.wrench_limits_.array());
base class for an impedance controller derived from TorqueController
void setVelocityError(const Eigen::Vector< double, 6 > &velocity_error)
set the value of velocity_error_
void setAccelerationError(const Eigen::Vector< double, 6 > &acceleration_error)
set the value of acceleration_error_
void setPositionError(const Eigen::Vector< double, 6 > &position_error)
set the value of position_error_
CartesianImpedanceController(const sackmesser::Interface::Ptr &interface, const std::string &name)
loads configuration parameters
Eigen::Vector< double, 6 > limitWrench(const Eigen::Vector< double, 6 > &wrench)
limit the end-effector wrench to the given wrench_limit_
virtual void computeStateError()=0
computes the state error for the impedance control law
RobotState< dof >::Vector computeCommand()
implements the impedance control law
base implementation of a Controller tracking a given Reference
Eigen::Vector< double, dof > Vector
typedef