1#include "controllers/impedance/Dissipative.hpp"
3#include "controllers/exceptions/NotImplementedException.hpp"
7namespace controllers::impedance {
12 "compute_orthonormal_basis(desired_velocity) not implemented for this input class");
17 double tolerance = 1e-4;
18 Eigen::MatrixXd updated_basis = Eigen::MatrixXd::Zero(this->dimensions_, this->dimensions_);
19 switch (this->computational_space_) {
20 case ComputationalSpaceType::LINEAR: {
23 if (linear_velocity.norm() < tolerance) {
24 updated_basis.topLeftCorner<3, 3>() = Eigen::Matrix3d::Identity();
28 updated_basis.topLeftCorner<3, 3>() =
32 case ComputationalSpaceType::ANGULAR: {
35 if (angular_velocity.norm() < tolerance) {
36 updated_basis.bottomRightCorner<3, 3>() = Eigen::Matrix3d::Identity();
41 this->basis_.bottomRightCorner<3, 3>(), angular_velocity);
44 case ComputationalSpaceType::DECOUPLED_TWIST: {
49 if (linear_velocity.norm() > tolerance) {
50 updated_basis.block<3, 3>(0, 0) =
54 if (angular_velocity.norm() > tolerance) {
56 this->basis_.bottomRightCorner<3, 3>(), angular_velocity);
61 return Eigen::MatrixXd::Identity(this->dimensions_, this->dimensions_);
65 case ComputationalSpaceType::FULL: {
67 if (desired_velocity.
get_twist().norm() < tolerance) {
68 return Eigen::MatrixXd::Identity(this->dimensions_, this->dimensions_);
80 if (desired_velocity.
get_size() != this->dimensions_) {
82 "The input state is of incorrect dimensions, expected " + std::to_string(this->dimensions_) +
" got "
83 + std::to_string(desired_velocity.
get_size()));
85 double tolerance = 1e-4;
88 return Eigen::MatrixXd::Identity(this->dimensions_, this->dimensions_);
static Eigen::MatrixXd orthonormalize_basis(const Eigen::MatrixXd &basis, const Eigen::VectorXd &main_eigenvector)
Orthornormalize the basis matrix given in input wrt the main engenvector.
Eigen::MatrixXd compute_orthonormal_basis(const S &desired_velocity)
Compute the orthonormal basis based on the desired velocity input.
Class to represent a state in Cartesian space.
const Eigen::Vector3d & get_linear_velocity() const
Getter of the linear velocity attribute.
Eigen::Matrix< double, 6, 1 > get_twist() const
Getter of the 6d twist from linear and angular velocity attributes.
const Eigen::Vector3d & get_angular_velocity() const
Getter of the angular velocity attribute.
Class to define a state in joint space.
const Eigen::VectorXd & get_velocities() const
Getter of the velocities attribute.
unsigned int get_size() const
Getter of the size from the attributes.
Core state variables and objects.