ocra-recipes
Doxygen documentation for the ocra-recipes repository
GHCJTController.h
Go to the documentation of this file.
1 
10 #ifndef __GHCJTCTRL_H__
11 #define __GHCJTCTRL_H__
12 
13 #include <string>
14 #include <vector>
15 #include <iostream>
16 
17 // OCRA INCLUDES
19 #include "ocra/control/Model.h"
21 
22 
23 // GOCRA INCLUDES
24 #include "gocra/Tasks/GHCJTTask.h"
25 //#include "gocra/Constraints/gOcraConstraint.h"
26 //#include "gocra/Constraints/GHCAccelerationConstraint.h"
27 using namespace ocra;
28 
29 
30 namespace gocra
31 {
32 
41 {
42 public:
43 
44  GHCJTController(const std::string& ctrlName, Model& innerModel, ocra::OneLevelSolver& innerSolver, bool useGrav);
45  virtual ~GHCJTController();
46 
47  //getter
48  Model& getModel();
49  ocra::OneLevelSolver& getSolver();
50 
51  //setter
52  void takeIntoAccountGravity(bool useGrav);
53 
54  void writePerformanceInStream(std::ostream& myOstream, bool addCommaAtEnd) const;
55  std::string getPerformances() const;
56 
57  void addConstraint(ocra::LinearConstraint& constraint) const;
58  void removeConstraint(ocra::LinearConstraint& constraint) const;
59  //void addConstraint(gOcraConstraint& constraint) const;
60  //void removeConstraint(gOcraConstraint& constraint) const;
61 
62  GHCJTTask& createGHCJTTask(const std::string& name, Feature::Ptr feature, Feature::Ptr featureDes) const;
63  GHCJTTask& createGHCJTTask(const std::string& name, Feature::Ptr feature) const;
64  GHCJTTask& createGHCJTContactTask(const std::string& name, PointContactFeature::Ptr feature, double mu, double margin) const;
65 
66  void setActiveTaskVector();
67  void doUpdateAugmentedJacobian();
68  void doUpdateProjector();
69  std::vector< GHCJTTask* >& getActiveTask();
70  int getNbActiveTask() const;
71  int getTotalActiveTaskDimensions() const;
72 
73  void initPriorityMatrix();
74 
75  std::pair<Eigen::VectorXd, Eigen::MatrixXd> sortRows(const Eigen::MatrixXd &C, const Eigen::MatrixXd &J);
76  void computeProjector(const Eigen::MatrixXd &C, const Eigen::MatrixXd &J, Eigen::MatrixXd& projector);
77  void computeTaskiProjector(const Eigen::MatrixXd &J, Eigen::MatrixXd& projector);
78  void setTaskProjectors(Eigen::MatrixXd& param);
79 
80 
81 
82 
83 
84 
85 protected:
86  virtual void doComputeOutput(Eigen::VectorXd& tau);
87  virtual void doAddTask(Task& task);
88  virtual void doAddContactSet(const ContactSet& contacts);
89 
90 protected: // factory
91  virtual Task* doCreateTask(const std::string& name, Feature::Ptr feature, Feature::Ptr featureDes) const;
92  virtual Task* doCreateTask(const std::string& name, Feature::Ptr feature) const;
93  virtual Task* doCreateContactTask(const std::string& name, PointContactFeature::Ptr feature, double mu, double margin) const;
94 
95 
96 private:
97  struct Pimpl;
98  boost::shared_ptr<Pimpl> pimpl;
99 };
100  // end group core
102 
103 } //end namespace gocra
104 
105 
106 
107 #endif
Define task class for GHCJT controller. It inherits from the task class defined in the ocra framework...
Contact task factory.
Definition: ContactSet.h:59
Define the internal solver class that can be used in the wOcra controller.
Declaration file of the Model class.
Model class.
Definition: Model.h:38
gOcra Controller based on LQP solver for the ocra framework.
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
Interface for controllers.
Definition: Controller.h:53
Constraint class.
Definition: Constraint.h:100
A generic abstract task for the GHCJT controller.
Definition: GHCJTTask.h:41
A generic abstract class the solvers that can be used in the wOcra Controller.
Controller interface.