Control Libraries 7.4.0
Loading...
Searching...
No Matches
IController.hpp
1#pragma once
2
3#include <list>
4#include <map>
5#include <memory>
6
7#include "controllers/exceptions/NoRobotModelException.hpp"
8
9#include "robot_model/Model.hpp"
10#include "state_representation/parameters/ParameterMap.hpp"
11#include "state_representation/space/Jacobian.hpp"
12#include "state_representation/space/joint/JointPositions.hpp"
13#include "state_representation/space/joint/JointState.hpp"
14
19namespace controllers {
25template<class S>
27public:
31 IController() = default;
32
36 virtual ~IController() = default;
37
45 [[nodiscard]] virtual S compute_command(const S& command_state, const S& feedback_state) = 0;
46
55 const S& command_state, const S& feedback_state, const state_representation::Jacobian& jacobian
56 );
57
68 const S& command_state, const S& feedback_state, const state_representation::JointPositions& joint_positions,
69 const std::string& frame = ""
70 );
71
76 [[nodiscard]] const robot_model::Model& get_robot_model();
77
83
84protected:
85 std::shared_ptr<robot_model::Model> robot_model_;
86};
87
88template<class S>
90 if (this->robot_model_ == nullptr) {
91 throw exceptions::NoRobotModelException("No robot model");
92 }
93 return *this->robot_model_;
94}
95
96template<class S>
98 this->robot_model_ = std::make_shared<robot_model::Model>(robot_model);
99}
100}// namespace controllers
Abstract class to define a controller in a desired state type, such as joint or Cartesian spaces.
void set_robot_model(const robot_model::Model &robot_model)
Set the robot model associated with the controller.
IController()=default
Empty constructor.
virtual ~IController()=default
Empty destructor.
virtual S compute_command(const S &command_state, const S &feedback_state)=0
Compute the command output based on the commanded state and a feedback state To be redefined based on...
std::shared_ptr< robot_model::Model > robot_model_
The robot model associated with the controller.
const robot_model::Model & get_robot_model()
Get the robot model associated with the controller.
The Model class is a wrapper around pinocchio dynamic computation library with state_representation e...
Definition Model.hpp:62
Class to define a robot Jacobian matrix.
Definition Jacobian.hpp:21
Class to define positions of the joints.
Class to define a state in joint space.
A wrapper class to contain a map of Parameter pointers by name and provide robust access methods.
Systems to determine a command output from measured and desired inputs.
Robot kinematics and dynamics.