14 #ifndef _OCRA_CONTROLLER_H_ 15 #define _OCRA_CONTROLLER_H_ 19 #include <boost/noncopyable.hpp> 20 #include <boost/shared_ptr.hpp> 21 #include <boost/property_tree/ptree.hpp> 42 class PointContactFeature;
64 void printInfo(
int level,
const std::string& filename);
69 void addTask(std::shared_ptr<Task> task);
70 void addTasks(
const std::vector<std::shared_ptr<Task>>& tasks);
73 void removeTasks(
const std::vector<std::string> tasks);
81 std::shared_ptr<Task>
getTask(
const std::string& name);
82 const std::shared_ptr<Task>
getTask(
const std::string& name)
const;
83 const std::map<std::string, std::shared_ptr<Task>>&
getTasks()
const;
116 void setContactState(
int isInLeftSupport,
int isInRightSupport) { this->_isInLeftSupport = isInLeftSupport; this->_isInRightSupport = isInRightSupport;}
123 std::shared_ptr<Task>
createTask(
const std::string& name, Feature::Ptr feature, Feature::Ptr featureDes)
const;
125 std::shared_ptr<Task>
createTask(
const std::string& name, Feature::Ptr feature)
const;
132 std::shared_ptr<Task>
createContactTask(
const std::string& name, PointContactFeature::Ptr feature,
double mu,
double margin)
const;
141 virtual void doAddTask(std::shared_ptr<Task> task) = 0;
146 virtual std::shared_ptr<Task>
doCreateTask(
const std::string& name, Feature::Ptr feature, Feature::Ptr featureDes)
const = 0;
147 virtual std::shared_ptr<Task>
doCreateTask(
const std::string& name, Feature::Ptr feature)
const = 0;
148 virtual std::shared_ptr<Task>
doCreateContactTask(
const std::string& name, PointContactFeature::Ptr feature,
double mu,
double margin)
const = 0;
152 boost::shared_ptr<Pimpl> pimpl;
154 std::string _fixedLink;
155 int _isInLeftSupport;
156 int _isInRightSupport;
virtual void doAddTask(std::shared_ptr< Task > task)=0
void setErrorFlag(int eflag)
void addContactSet(const ContactSet &contacts)
virtual void doSetMaxJointTorques(const Eigen::VectorXd &tauMax)
void enableErrorHandling()
void removeTask(const std::string &taskName)
void printInfo(int level, const std::string &filename)
void setMaxJointTorqueNorm(double maxTau)
void disableErrorHandling()
const std::string & getErrorMessage() const
Controller(const std::string &name, Model &model)
bool isErrorHandlingEnabled() const
Declaration file of the Model class.
void addTasks(const std::vector< std::shared_ptr< Task >> &tasks)
A class hierarchy to compute task errors based on control frames.
void removeTasks(const std::vector< std::string > tasks)
#define DEFINE_CLASS_POINTER_TYPEDEFS(Class)
void getFixedLinkForOdometry(std::string ¤tFixedLink)
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
void getContactState(int &leftSupport, int &rightSupport)
virtual void doAddContactSet(const ContactSet &contacts)=0
std::vector< std::string > getTaskPortNames()
Interface for controllers.
std::shared_ptr< Task > getTask(const std::string &name)
void setFixedLinkForOdometry(std::string newFixedLink)
const Eigen::VectorXd & getMaxJointTorques() const
void setUseOdometry(bool useOdometry)
std::string getTaskPortName(const std::string &taskName)
std::shared_ptr< Task > createContactTask(const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const
Creates a contact task.
virtual void doComputeOutput(Eigen::VectorXd &tau)=0
virtual std::shared_ptr< Task > doCreateTask(const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const =0
virtual std::shared_ptr< Task > doCreateContactTask(const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const =0
const Eigen::VectorXd & computeOutput()
void setMaxJointTorques(const Eigen::VectorXd &tau_max)
double getMaxJointTorqueNorm() const
void setErrorMessage(const std::string &msg)
const std::map< std::string, std::shared_ptr< Task > > & getTasks() const
std::shared_ptr< Task > createTask(const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const
Generic task creation.
void addTask(std::shared_ptr< Task > task)
void setContactState(int isInLeftSupport, int isInRightSupport)
std::vector< std::string > getTaskNames()
const std::vector< std::shared_ptr< Task > > & getActiveTasks() const