Control Libraries 7.4.0
Loading...
Searching...
No Matches
IController.cpp
1#include "controllers/IController.hpp"
2
3#include "controllers/exceptions/NotImplementedException.hpp"
4
5using namespace state_representation;
6
7namespace controllers {
8
9template<class S>
12 "Computation of a joint-space command with a Jacobian is not implemented for this controller.");
13}
14
15template<class S>
16JointState IController<S>::compute_command(const S&, const S&, const JointPositions&, const std::string&) {
18 "Computation of a joint-space command from joint positions is not implemented for this controller.");
19}
20
21template<>
23 const CartesianState& command_state, const CartesianState& feedback_state,
24 const Jacobian& jacobian
25) {
26 return jacobian.transpose(CartesianWrench(this->compute_command(command_state, feedback_state)));
27}
28
29template<>
31 const CartesianState& command_state, const CartesianState& feedback_state, const JointPositions& joint_positions,
32 const std::string& frame
33) {
34 if (this->robot_model_ == nullptr) {
35 throw exceptions::NoRobotModelException(
36 "A robot model is required to convert the control command from Cartesian to joint space");
37 }
38
39 auto jacobian = this->robot_model_->compute_jacobian(joint_positions, frame);
40 return this->compute_command(command_state, feedback_state, jacobian);
41}
42
43}
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...
Class to represent a state in Cartesian space.
Class to define wrench in Cartesian space as 3D force and torque vectors.
Class to define a robot Jacobian matrix.
Definition Jacobian.hpp:21
Eigen::MatrixXd transpose() const
Return the transpose of the Jacobian matrix.
Definition Jacobian.cpp:261
Class to define positions of the joints.
Class to define a state in joint space.
Systems to determine a command output from measured and desired inputs.
Core state variables and objects.