22#include <sackmesser/Configurations.hpp>
24#include <orwell/Controller.hpp>
32 config_ = interface->getConfigurations()->load<Configuration>(name);
38 std::array<double, 7> command_limits;
40 if (!server->loadParameter<7>(ns +
"/command_limits", &command_limits))
45 command_limits_ = Eigen::Vector<double, 7>(command_limits.data());
59 robot_model_ = robot_model;
65 stopping_criterion_ = stopping_criterion;
71 if (!stopping_criterion_)
76 return stopping_criterion_->isFinished(robot_state);
80 template <
class Derived>
83 return std::dynamic_pointer_cast<Derived>(this->shared_from_this());
89 robot_state_ = robot_state;
105 return command.array().min(config_.command_limits_.array()).max(-config_.command_limits_.array());
base class for controller implementation
RobotState< dof >::Vector getControlCommand(const RobotState< dof > &robot_state)
general function to obtain control commands
bool isFinished(const RobotState< dof > &robot_state) const
check if the StoppingCriterion is fulfilled
const RobotState< dof > & getRobotState() const
proved access to the RobotState to derived classes
RobotModel< dof >::Ptr getRobotModel()
proved access to the RobotModel to derived classes
Derived::Ptr cast()
cast Controller to a derived class
void setRobotModel(const typename RobotModel< dof >::Ptr &robot_model)
set the RobotModel
virtual RobotState< dof >::Vector computeCommand()=0
will be invoked when calling getControlCommand
Controller(const sackmesser::Interface::Ptr &interface, const std::string &name)
loads configuration parameters
void setStoppingCriterion(const std::shared_ptr< StoppingCriterion< dof > > &stopping_criterion)
(optional) StoppingCriterion
std::shared_ptr< RobotModel > Ptr
typedef
Eigen::Vector< double, dof > Vector
typedef
base class for a stopping criterion for a Controller