ocra-recipes
Doxygen documentation for the ocra-recipes repository
|
gOcra Controller based on LQP solver for the ocra framework. More...
#include <GHCJTController.h>
Classes | |
struct | Pimpl |
Public Member Functions | |
GHCJTController (const std::string &ctrlName, Model &innerModel, ocra::OneLevelSolver &innerSolver, bool useGrav) | |
virtual | ~GHCJTController () |
Model & | getModel () |
ocra::OneLevelSolver & | getSolver () |
void | takeIntoAccountGravity (bool useGrav) |
void | writePerformanceInStream (std::ostream &myOstream, bool addCommaAtEnd) const |
std::string | getPerformances () const |
void | addConstraint (ocra::LinearConstraint &constraint) const |
void | removeConstraint (ocra::LinearConstraint &constraint) const |
GHCJTTask & | createGHCJTTask (const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const |
GHCJTTask & | createGHCJTTask (const std::string &name, Feature::Ptr feature) const |
GHCJTTask & | createGHCJTContactTask (const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const |
void | setActiveTaskVector () |
void | doUpdateAugmentedJacobian () |
void | doUpdateProjector () |
std::vector< GHCJTTask * > & | getActiveTask () |
int | getNbActiveTask () const |
int | getTotalActiveTaskDimensions () const |
void | initPriorityMatrix () |
std::pair< Eigen::VectorXd, Eigen::MatrixXd > | sortRows (const Eigen::MatrixXd &C, const Eigen::MatrixXd &J) |
void | computeProjector (const Eigen::MatrixXd &C, const Eigen::MatrixXd &J, Eigen::MatrixXd &projector) |
void | computeTaskiProjector (const Eigen::MatrixXd &J, Eigen::MatrixXd &projector) |
void | setTaskProjectors (Eigen::MatrixXd ¶m) |
Public Member Functions inherited from ocra::Controller | |
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< Task > | getTask (const std::string &name) |
const std::shared_ptr< Task > | getTask (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< Task > | createContactTask (const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const |
Creates a contact task. More... | |
std::shared_ptr< Task > | createTask (const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const |
Generic task creation. More... | |
std::shared_ptr< Task > | createTask (const std::string &name, Feature::Ptr feature) const |
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 ¤tFixedLink) |
void | setContactState (int isInLeftSupport, int isInRightSupport) |
void | getContactState (int &leftSupport, int &rightSupport) |
Public Member Functions inherited from ocra::NamedInstance | |
NamedInstance (const std::string &name) | |
const std::string & | getName () const |
virtual | ~NamedInstance () |
Protected Member Functions | |
virtual void | doComputeOutput (Eigen::VectorXd &tau) |
virtual void | doAddTask (Task &task) |
virtual void | doAddContactSet (const ContactSet &contacts) |
virtual Task * | doCreateTask (const std::string &name, Feature::Ptr feature, Feature::Ptr featureDes) const |
virtual Task * | doCreateTask (const std::string &name, Feature::Ptr feature) const |
virtual Task * | doCreateContactTask (const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const |
Protected Member Functions inherited from ocra::Controller | |
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 | doAddTask (std::shared_ptr< Task > task)=0 |
virtual void | doSetMaxJointTorques (const Eigen::VectorXd &tauMax) |
Additional Inherited Members | |
Public Types inherited from ocra::Controller | |
enum | ErrorFlag { SUCCESS = 0, CRITICAL_ERROR = 1, STATIC_EQ_LOSS = 2, DYN_EQ_LOSS = 4, INSTABILITY = 8 + 1, OTHER = 16 } |
Error handling. More... | |
gOcra Controller based on LQP solver for the ocra framework.
Definition at line 40 of file GHCJTController.h.
gocra::GHCJTController::GHCJTController | ( | const std::string & | ctrlName, |
Model & | innerModel, | ||
ocra::OneLevelSolver & | innerSolver, | ||
bool | useGrav | ||
) |
Initialize GHCJT controller.
ctrlName | The name of the controller |
innerModel | The internal model of the robot one wants to control |
innerSolver | The internal solver one wants to use to make the quadratic optimization |
useGrav | Whether to activate gravity compensation or not |
Definition at line 85 of file GHCJTController.cpp.
|
virtual |
Destructor
Definition at line 95 of file GHCJTController.cpp.
void gocra::GHCJTController::addConstraint | ( | ocra::LinearConstraint & | constraint | ) | const |
Definition at line 134 of file GHCJTController.cpp.
void gocra::GHCJTController::computeProjector | ( | const Eigen::MatrixXd & | C, |
const Eigen::MatrixXd & | J, | ||
Eigen::MatrixXd & | projector | ||
) |
Definition at line 494 of file GHCJTController.cpp.
void gocra::GHCJTController::computeTaskiProjector | ( | const Eigen::MatrixXd & | J, |
Eigen::MatrixXd & | projector | ||
) |
Definition at line 532 of file GHCJTController.cpp.
GHCJTTask & gocra::GHCJTController::createGHCJTContactTask | ( | const std::string & | name, |
PointContactFeature::Ptr | feature, | ||
double | mu, | ||
double | margin | ||
) | const |
Definition at line 200 of file GHCJTController.cpp.
GHCJTTask & gocra::GHCJTController::createGHCJTTask | ( | const std::string & | name, |
Feature::Ptr | feature, | ||
Feature::Ptr | featureDes | ||
) | const |
Definition at line 188 of file GHCJTController.cpp.
GHCJTTask & gocra::GHCJTController::createGHCJTTask | ( | const std::string & | name, |
Feature::Ptr | feature | ||
) | const |
Definition at line 194 of file GHCJTController.cpp.
|
protectedvirtual |
Internal implementation inside the addContactSet method.
contacts | The contact set to add in the controller |
Implements ocra::Controller.
Definition at line 180 of file GHCJTController.cpp.
|
protectedvirtual |
Internal implementation inside the addTask method.
task | The task to add in the controller |
Definition at line 163 of file GHCJTController.cpp.
|
protectedvirtual |
Compute the output of the controller.
tau | The joint torques, which is the output of our problem |
Here, the controller solves the optimization problem depending on the tasks and constraints, and the result is set in the variable of the problem . The torque is computed using , and it is finally applied to the robot.
Implements ocra::Controller.
Definition at line 272 of file GHCJTController.cpp.
|
protectedvirtual |
Internal implementation inside the createContactTask method.
name | The task name, a unique identifier |
feature | The contact point feature of the robot one wants to control |
mu | The friction cone coefficient such as |
margin | The margin inside the friction cone |
This method is called by the higher level methods #createGHCJTContactTask(const std::string&, PointContactFeature::Ptr, , double, double, int, double) const and is the concrete implementation required by the xde Controller class.
Implements ocra::Controller.
Definition at line 254 of file GHCJTController.cpp.
|
protectedvirtual |
Internal implementation inside the createTask method.
name | The task name, a unique identifier |
feature | The part of the robot one wants to control (full state, frame, CoM,...) |
featureDes | The desired state one wants to reach, depends on the feature argument |
This method is called by the higher level methods #createGHCJTTask(const std::string&, const Feature&, const Feature&, int, double) const and #createGHCJTTask(const std::string&, const Feature&, int, double) const and is the concrete implementation required by the xde Controller class.
Implements ocra::Controller.
Definition at line 220 of file GHCJTController.cpp.
|
protectedvirtual |
Internal implementation inside the createTask method.
name | The task name, a unique identifier |
feature | The part of the robot one wants to control (full state, frame, CoM,...) |
This method is called by the higher level methods #createGHCJTTask(const std::string&, const Feature&, const Feature&, int, double) const and #createGHCJTTask(const std::string&, const Feature&, int, double) const and is the concrete implementation required by the xde Controller class.
Implements ocra::Controller.
Definition at line 236 of file GHCJTController.cpp.
void gocra::GHCJTController::doUpdateAugmentedJacobian | ( | ) |
Definition at line 405 of file GHCJTController.cpp.
void gocra::GHCJTController::doUpdateProjector | ( | ) |
Definition at line 422 of file GHCJTController.cpp.
std::vector< GHCJTTask * > & gocra::GHCJTController::getActiveTask | ( | ) |
Definition at line 437 of file GHCJTController.cpp.
Model & gocra::GHCJTController::getModel | ( | ) |
Definition at line 113 of file GHCJTController.cpp.
int gocra::GHCJTController::getNbActiveTask | ( | ) | const |
Definition at line 442 of file GHCJTController.cpp.
std::string gocra::GHCJTController::getPerformances | ( | ) | const |
Get information about performances through a string.
Information are saved in a JSON way (http://www.json.org/). It returns a of dictionnary on the form:
where performance_info are:
See gocra::GHCJTController::writePerformanceInStream(std::ostream&, bool) and gocra::ocra::OneLevelSolver::writePerformanceInStream(std::ostream&, bool).
Definition at line 371 of file GHCJTController.cpp.
ocra::OneLevelSolver & gocra::GHCJTController::getSolver | ( | ) |
Definition at line 121 of file GHCJTController.cpp.
int gocra::GHCJTController::getTotalActiveTaskDimensions | ( | ) | const |
Definition at line 447 of file GHCJTController.cpp.
void gocra::GHCJTController::initPriorityMatrix | ( | ) |
Definition at line 452 of file GHCJTController.cpp.
void gocra::GHCJTController::removeConstraint | ( | ocra::LinearConstraint & | constraint | ) | const |
Definition at line 140 of file GHCJTController.cpp.
void gocra::GHCJTController::setActiveTaskVector | ( | ) |
Definition at line 381 of file GHCJTController.cpp.
void gocra::GHCJTController::setTaskProjectors | ( | Eigen::MatrixXd & | param | ) |
Definition at line 544 of file GHCJTController.cpp.
std::pair< VectorXd, MatrixXd > gocra::GHCJTController::sortRows | ( | const Eigen::MatrixXd & | C, |
const Eigen::MatrixXd & | J | ||
) |
Definition at line 467 of file GHCJTController.cpp.
void gocra::GHCJTController::takeIntoAccountGravity | ( | bool | useGrav | ) |
Definition at line 127 of file GHCJTController.cpp.
void gocra::GHCJTController::writePerformanceInStream | ( | std::ostream & | outstream, |
bool | addCommaAtEnd | ||
) | const |
Write information about controller performances in a string stream.
outstream | the output stream where to write the performances information |
addCommaAtEnd | If true, add a comma at the end of the stream. If false, it means that this is the end of the json file, nothing will be added after that, no comma is added. |
See gocra::GHCJTController::getPerformances() to know more. Here it saves:
Definition at line 341 of file GHCJTController.cpp.