ocra-recipes
Doxygen documentation for the ocra-recipes repository
gOcraContactSetTaskManager.cpp
Go to the documentation of this file.
2 #include <stdio.h>
3 
4 namespace gocra
5 {
6 
18 gOcraContactSetTaskManager::gOcraContactSetTaskManager(GHCJTController& _ctrl, const ocra::Model& _model, const std::string& _taskName, const std::string& _segmentName, Eigen::Displacementd _H_segment_frame[], int _numContacts, double _mu, double _margin)
19  : gOcraTaskManagerBase(_ctrl, _model, _taskName), segmentName(_segmentName), numContacts(_numContacts)
20 {
21  tasks = new gocra::GHCJTTask*[numContacts];
22  feats = new ocra::PointContactFeature*[numContacts];
23  featFrames = new ocra::SegmentFrame*[numContacts];
24  names = new std::string[numContacts];
25 
26  for (int i = 0; i < numContacts; i++)
27  {
28  std::ostringstream name_stream;
29  name_stream << name << i;
30  names[i] = name_stream.str();
31 
32  featFrames[i] = new ocra::SegmentFrame(names[i] + ".SegmentFrame", model, model.SegmentName(segmentName), _H_segment_frame[i]);
33  feats[i] = new ocra::PointContactFeature(names[i] + ".PointContactFeature", *featFrames[i]);
34  tasks[i] = &(ctrl.createGHCJTContactTask(names[i], *feats[i], _mu, _margin));
35 
36  ctrl.addTask(*tasks[i]);
37 
38  tasks[i]->activateAsConstraint();
39  }
40 
41 }
42 
48 {
49  for (int i = 0; i < numContacts; i++)
50  {
51  tasks[i]->activateAsConstraint();
52  }
53 }
54 
60 {
61  for (int i = 0; i < numContacts; i++)
62  {
63  tasks[i]->deactivate();
64  }
65 }
66 
67 // Masks base class function
69 {
70  throw std::runtime_error("[gOcraContactSetTaskManager::getTaskError()] Error is meaningless in this context or has not been computed");
71 }
72 
73 // Masks base class function
75 {
76  throw std::runtime_error("[gOcraContactSetTaskManager::getTaskErrorNorm()] Error is meaningless in this context or has not been computed");
77 }
78 
79 }
void activateAsConstraint()
Definition: Task.cpp:312
Model class.
Definition: Model.h:38
Task Manager for the Center of Mass (CoM) task with the gOcra Controllers.
gOcra Controller based on LQP solver for the ocra framework.
void deactivate()
Definition: Task.cpp:326
A frame attached to a segment of a model.
Definition: ControlFrame.h:104
A generic abstract task for the GHCJT controller.
Definition: GHCJTTask.h:41
gocra::GHCJTController & ctrl
Used to build point contact tasks.
Definition: Feature.h:147
GHCJTTask & createGHCJTContactTask(const std::string &name, PointContactFeature::Ptr feature, double mu, double margin) const
const std::string SegmentName(const std::string &name) const
Definition: Model.cpp:245
gOcraContactSetTaskManager(GHCJTController &ctrl, const ocra::Model &model, const std::string &taskName, const std::string &segmentName, Eigen::Displacementd H_segment_frame[], int numContacts, double mu, double margin)
void addTask(std::shared_ptr< Task > task)
Definition: Controller.cpp:184