ocra-recipes
Doxygen documentation for the ocra-recipes repository
Classes | Public Member Functions | Protected Member Functions | List of all members
ocra::Controller Class Referenceabstract

Interface for controllers. More...

#include <Controller.h>

Inheritance diagram for ocra::Controller:
[legend]
Collaboration diagram for ocra::Controller:
[legend]

Classes

struct  Pimpl
 

Public Member Functions

virtual ~Controller ()=0
 
void printInfo (int level, const std::string &filename)
 
void setMaxJointTorques (const Eigen::VectorXd &tau_max)
 
const Eigen::VectorXd & getMaxJointTorques () const
 
void addTask (std::shared_ptr< Task > task)
 
void addTasks (const std::vector< std::shared_ptr< Task >> &tasks)
 
void removeTask (const std::string &taskName)
 
void removeTasks (const std::vector< std::string > tasks)
 
std::vector< std::string > getTaskNames ()
 
std::string getTaskPortName (const std::string &taskName)
 
std::vector< std::string > getTaskPortNames ()
 
void addContactSet (const ContactSet &contacts)
 
std::shared_ptr< TaskgetTask (const std::string &name)
 
const std::shared_ptr< TaskgetTask (const std::string &name) const
 
const std::map< std::string, std::shared_ptr< Task > > & getTasks () const
 
void computeOutput (Eigen::VectorXd &tau)
 Computation of output torques based on the tasks added to the controller. More...
 
const Eigen::VectorXd & computeOutput ()
 
std::shared_ptr< TaskcreateContactTask (const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const
 Creates a contact task. More...
 
std::shared_ptr< TaskcreateTask (const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const
 Generic task creation. More...
 
std::shared_ptr< TaskcreateTask (const std::string &name, Feature::Ptr feature) const
 
- Public Member Functions inherited from ocra::NamedInstance
 NamedInstance (const std::string &name)
 
const std::string & getName () const
 
virtual ~NamedInstance ()
 

Protected Member Functions

 Controller (const std::string &name, Model &model)
 
const std::vector< std::shared_ptr< Task > > & getActiveTasks () const
 
void setErrorFlag (int eflag)
 
void setErrorMessage (const std::string &msg)
 
virtual void doComputeOutput (Eigen::VectorXd &tau)=0
 
virtual void doAddTask (std::shared_ptr< Task > task)=0
 
virtual void doAddContactSet (const ContactSet &contacts)=0
 
virtual void doSetMaxJointTorques (const Eigen::VectorXd &tauMax)
 
virtual std::shared_ptr< TaskdoCreateTask (const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const =0
 
virtual std::shared_ptr< TaskdoCreateTask (const std::string &name, Feature::Ptr feature) const =0
 
virtual std::shared_ptr< TaskdoCreateContactTask (const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const =0
 
enum  ErrorFlag {
  SUCCESS = 0, CRITICAL_ERROR = 1, STATIC_EQ_LOSS = 2, DYN_EQ_LOSS = 4,
  INSTABILITY = 8 + 1, OTHER = 16
}
 Error handling. More...
 
void enableErrorHandling ()
 
void disableErrorHandling ()
 
bool isErrorHandlingEnabled () const
 
const std::string & getErrorMessage () const
 
void clearErrorFlag ()
 
int getErrorFlag () const
 
void setMaxJointTorqueNorm (double maxTau)
 
double getMaxJointTorqueNorm () const
 
void setFixedLinkForOdometry (std::string newFixedLink)
 
void setUseOdometry (bool useOdometry)
 
void getFixedLinkForOdometry (std::string &currentFixedLink)
 
void setContactState (int isInLeftSupport, int isInRightSupport)
 
void getContactState (int &leftSupport, int &rightSupport)
 

Detailed Description

Interface for controllers.

This class can be derived to implement control laws for a manikin.

Definition at line 53 of file Controller.h.

Member Enumeration Documentation

Error handling.

Enumerator
SUCCESS 
CRITICAL_ERROR 
STATIC_EQ_LOSS 
DYN_EQ_LOSS 
INSTABILITY 
OTHER 

Definition at line 95 of file Controller.h.

Constructor & Destructor Documentation

ocra::Controller::Controller ( const std::string &  name,
Model model 
)
protected

Definition at line 106 of file Controller.cpp.

ocra::Controller::~Controller ( )
pure virtual

Definition at line 115 of file Controller.cpp.

Member Function Documentation

void ocra::Controller::addContactSet ( const ContactSet contacts)

Definition at line 209 of file Controller.cpp.

void ocra::Controller::addTask ( std::shared_ptr< Task task)

Definition at line 184 of file Controller.cpp.

void ocra::Controller::addTasks ( const std::vector< std::shared_ptr< Task >> &  tasks)

Definition at line 191 of file Controller.cpp.

void ocra::Controller::clearErrorFlag ( )

Definition at line 333 of file Controller.cpp.

void ocra::Controller::computeOutput ( Eigen::VectorXd &  tau)

Computation of output torques based on the tasks added to the controller.

Calls the method doComputeOutput, which can be overloaded to implement specific control laws to realize the added tasks.

Definition at line 258 of file Controller.cpp.

const Eigen::VectorXd & ocra::Controller::computeOutput ( )

Definition at line 252 of file Controller.cpp.

std::shared_ptr< Task > ocra::Controller::createContactTask ( const std::string &  name,
PointContactFeature::Ptr  feature,
double  mu,
double  margin 
) const

Creates a contact task.

The parameters describe the friction cone parameters for the force applied by the manikin on the environment.

Definition at line 378 of file Controller.cpp.

std::shared_ptr< Task > ocra::Controller::createTask ( const std::string &  name,
Feature::Ptr  feature,
Feature::Ptr  featureDes 
) const

Generic task creation.

Definition at line 354 of file Controller.cpp.

std::shared_ptr< Task > ocra::Controller::createTask ( const std::string &  name,
Feature::Ptr  feature 
) const

Definition at line 365 of file Controller.cpp.

void ocra::Controller::disableErrorHandling ( )

Definition at line 318 of file Controller.cpp.

virtual void ocra::Controller::doAddContactSet ( const ContactSet contacts)
protectedpure virtual
virtual void ocra::Controller::doAddTask ( std::shared_ptr< Task task)
protectedpure virtual

Implemented in wocra::WocraController.

virtual void ocra::Controller::doComputeOutput ( Eigen::VectorXd &  tau)
protectedpure virtual
virtual std::shared_ptr<Task> ocra::Controller::doCreateContactTask ( const std::string &  name,
PointContactFeature::Ptr  feature,
double  mu,
double  margin 
) const
protectedpure virtual
virtual std::shared_ptr<Task> ocra::Controller::doCreateTask ( const std::string &  name,
Feature::Ptr  feature,
Feature::Ptr  featureDes 
) const
protectedpure virtual
virtual std::shared_ptr<Task> ocra::Controller::doCreateTask ( const std::string &  name,
Feature::Ptr  feature 
) const
protectedpure virtual
void ocra::Controller::doSetMaxJointTorques ( const Eigen::VectorXd &  tauMax)
protectedvirtual

Definition at line 177 of file Controller.cpp.

void ocra::Controller::enableErrorHandling ( )

Definition at line 313 of file Controller.cpp.

const std::vector< std::shared_ptr< Task > > & ocra::Controller::getActiveTasks ( ) const
protected

Definition at line 394 of file Controller.cpp.

void ocra::Controller::getContactState ( int &  leftSupport,
int &  rightSupport 
)

Definition at line 306 of file Controller.cpp.

int ocra::Controller::getErrorFlag ( ) const

Definition at line 339 of file Controller.cpp.

const std::string & ocra::Controller::getErrorMessage ( ) const

Definition at line 328 of file Controller.cpp.

void ocra::Controller::getFixedLinkForOdometry ( std::string &  currentFixedLink)
inline

Definition at line 115 of file Controller.h.

double ocra::Controller::getMaxJointTorqueNorm ( ) const

Definition at line 349 of file Controller.cpp.

const VectorXd & ocra::Controller::getMaxJointTorques ( ) const

Definition at line 179 of file Controller.cpp.

std::shared_ptr< Task > ocra::Controller::getTask ( const std::string &  name)

Definition at line 214 of file Controller.cpp.

const std::shared_ptr< Task > ocra::Controller::getTask ( const std::string &  name) const

Definition at line 247 of file Controller.cpp.

std::vector< std::string > ocra::Controller::getTaskNames ( )

Definition at line 219 of file Controller.cpp.

std::string ocra::Controller::getTaskPortName ( const std::string &  taskName)

Definition at line 228 of file Controller.cpp.

std::vector< std::string > ocra::Controller::getTaskPortNames ( )

Definition at line 238 of file Controller.cpp.

const std::map< std::string, std::shared_ptr< Task > > & ocra::Controller::getTasks ( ) const

Definition at line 411 of file Controller.cpp.

bool ocra::Controller::isErrorHandlingEnabled ( ) const

Definition at line 323 of file Controller.cpp.

void ocra::Controller::printInfo ( int  level,
const std::string &  filename 
)

Definition at line 119 of file Controller.cpp.

void ocra::Controller::removeTask ( const std::string &  taskName)

Definition at line 197 of file Controller.cpp.

void ocra::Controller::removeTasks ( const std::vector< std::string >  tasks)

Definition at line 203 of file Controller.cpp.

void ocra::Controller::setContactState ( int  isInLeftSupport,
int  isInRightSupport 
)
inline

Definition at line 116 of file Controller.h.

void ocra::Controller::setErrorFlag ( int  eflag)
protected

Definition at line 401 of file Controller.cpp.

void ocra::Controller::setErrorMessage ( const std::string &  msg)
protected

Definition at line 406 of file Controller.cpp.

void ocra::Controller::setFixedLinkForOdometry ( std::string  newFixedLink)

Definition at line 300 of file Controller.cpp.

void ocra::Controller::setMaxJointTorqueNorm ( double  maxTau)

Definition at line 344 of file Controller.cpp.

void ocra::Controller::setMaxJointTorques ( const Eigen::VectorXd &  tau_max)

Definition at line 172 of file Controller.cpp.

void ocra::Controller::setUseOdometry ( bool  useOdometry)
inline

Definition at line 114 of file Controller.h.


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