orwell 0.0.0
orwell::Controller< dof > Class Template Referenceabstract

base class for controller implementation More...

#include <Controller.hpp>

Inheritance diagram for orwell::Controller< dof >:
orwell::PositionController< dof > orwell::TorqueController< dof > orwell::VelocityController< dof > orwell::CompliantController< dof >

Public Member Functions

 Controller (const sackmesser::Interface::Ptr &interface, const std::string &name)
 loads configuration parameters
 
RobotState< dof >::Vector getControlCommand (const RobotState< dof > &robot_state)
 general function to obtain control commands
 
void setRobotModel (const typename RobotModel< dof >::Ptr &robot_model)
 set the RobotModel
 
void setStoppingCriterion (const std::shared_ptr< StoppingCriterion< dof > > &stopping_criterion)
 (optional) StoppingCriterion
 
bool isFinished (const RobotState< dof > &robot_state) const
 check if the StoppingCriterion is fulfilled
 
template<class Derived >
Derived::Ptr cast ()
 cast Controller to a derived class
 

Protected Member Functions

virtual RobotState< dof >::Vector computeCommand ()=0
 will be invoked when calling getControlCommand
 
RobotModel< dof >::Ptr getRobotModel ()
 proved access to the RobotModel to derived classes
 
const RobotState< dof > & getRobotState () const
 proved access to the RobotState to derived classes
 

Friends

template<int , template< int > class>
class ParallelController
 

Detailed Description

template<int dof>
class orwell::Controller< dof >

base class for controller implementation

Template Parameters
dofnumber of degrees of freedom of the controlled system

Definition at line 41 of file Controller.hpp.

Constructor & Destructor Documentation

◆ Controller()

template<int dof>
orwell::Controller< dof >::Controller ( const sackmesser::Interface::Ptr & interface,
const std::string & name )

loads configuration parameters

Parameters
interfaceinterfaces the configuration server
nameparameter namespace

Definition at line 30 of file Controller.hxx.

31 {
32 config_ = interface->getConfigurations()->load<Configuration>(name);
33 }

Member Function Documentation

◆ cast()

template<int dof>
template<class Derived >
Derived::Ptr orwell::Controller< dof >::cast ( )

cast Controller to a derived class

expects the derived class to declare a typedef called Ptr

Template Parameters
Derivedderived class type
Returns
shared pointer to derived class

Definition at line 81 of file Controller.hxx.

82 {
83 return std::dynamic_pointer_cast<Derived>(this->shared_from_this());
84 }

◆ computeCommand()

template<int dof>
virtual RobotState< dof >::Vector orwell::Controller< dof >::computeCommand ( )
protectedpure virtual

will be invoked when calling getControlCommand

actual computation of the control command depending on the derived class

Returns
control command

Implemented in orwell::CompliantController< dof >, orwell::PositionController< dof >, and orwell::VelocityController< dof >.

Referenced by orwell::Controller< dof >::getControlCommand().

◆ getControlCommand()

template<int dof>
RobotState< dof >::Vector orwell::Controller< dof >::getControlCommand ( const RobotState< dof > & robot_state)

general function to obtain control commands

Parameters
robot_statecurrent RobotState
Returns
control command as torque, position or velocity

Definition at line 87 of file Controller.hxx.

88 {
89 robot_state_ = robot_state;
90
91 this->getRobotModel()->computeCartesianState(robot_state);
92
93 return limitCommand(computeCommand());
94 }
RobotModel< dof >::Ptr getRobotModel()
proved access to the RobotModel to derived classes
virtual RobotState< dof >::Vector computeCommand()=0
will be invoked when calling getControlCommand

References orwell::Controller< dof >::computeCommand(), and orwell::Controller< dof >::getRobotModel().

◆ getRobotModel()

template<int dof>
RobotModel< dof >::Ptr orwell::Controller< dof >::getRobotModel ( )
protected

proved access to the RobotModel to derived classes

Returns
RobotModel

Definition at line 51 of file Controller.hxx.

52 {
53 return robot_model_;
54 }

Referenced by orwell::Controller< dof >::getControlCommand().

◆ getRobotState()

template<int dof>
const RobotState< dof > & orwell::Controller< dof >::getRobotState ( ) const
protected

proved access to the RobotState to derived classes

Returns
RobotState

Definition at line 97 of file Controller.hxx.

98 {
99 return robot_state_;
100 }

◆ isFinished()

template<int dof>
bool orwell::Controller< dof >::isFinished ( const RobotState< dof > & robot_state) const

check if the StoppingCriterion is fulfilled

Parameters
robot_statecurrent RobotState
Returns
true if the StoppingCriterion is fulfilled

Definition at line 69 of file Controller.hxx.

70 {
71 if (!stopping_criterion_)
72 {
73 return false;
74 }
75
76 return stopping_criterion_->isFinished(robot_state);
77 }

◆ setRobotModel()

template<int dof>
void orwell::Controller< dof >::setRobotModel ( const typename RobotModel< dof >::Ptr & robot_model)

set the RobotModel

since the RobotModel is implemented as a base class, this function allows the usage of different kinematics/dynamics libraries

Parameters
robot_modelRobotModel the model of the robot to compute kinematics/dynamics

Definition at line 57 of file Controller.hxx.

58 {
59 robot_model_ = robot_model;
60 }

Referenced by orwell::ControllerManager< dof >::ControllerManager().

◆ setStoppingCriterion()

template<int dof>
void orwell::Controller< dof >::setStoppingCriterion ( const std::shared_ptr< StoppingCriterion< dof > > & stopping_criterion)

(optional) StoppingCriterion

can be checked via the function isFinished

Parameters
stopping_criterionStoppingCriterion

Definition at line 63 of file Controller.hxx.

64 {
65 stopping_criterion_ = stopping_criterion;
66 }

Friends And Related Symbol Documentation

◆ ParallelController

template<int dof>
template<int , template< int > class>
friend class ParallelController
friend

Definition at line 163 of file Controller.hpp.


The documentation for this class was generated from the following files: