Go to the documentation of this file.
48 const std::vector<std::vector<double>>
q;
60 #define ADD_PARAMETER(TYPE, NAME, DEFAULT) \
61 TYPE NAME##_ = DEFAULT; \
62 ControllerParameters & NAME(TYPE value) \
84 ADD_PARAMETER(std::vector<std::string>, extra_configurations, {})
90 struct MCGlobalController;
100 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
152 virtual bool runObserverPipelines();
160 virtual bool resetObserverPipelines();
166 bool hasObserverPipeline(
const std::string & name)
const;
169 bool hasObserverPipeline()
const;
175 const std::vector<mc_observers::ObserverPipeline> & observerPipelines()
const;
177 std::vector<mc_observers::ObserverPipeline> & observerPipelines();
203 bool run(mc_solver::FeedbackType fType);
236 void addCollisions(
const std::string & r1,
237 const std::string & r2,
238 const std::vector<mc_rbdyn::Collision> & collisions);
241 bool hasCollision(
const std::string & r1,
const std::string & r2,
const mc_rbdyn::Collision & col)
const noexcept;
244 bool hasCollision(
const std::string & r1,
245 const std::string & r2,
246 const std::string & c1,
247 const std::string & c2)
const noexcept;
254 void removeCollisions(
const std::string & r1,
255 const std::string & r2,
256 const std::vector<mc_rbdyn::Collision> & collisions);
263 void removeCollisions(
const std::string & r1,
const std::string & r2);
270 void addContact(
const Contact & c);
277 void removeContact(
const Contact & c);
280 void clearContacts();
286 bool hasContact(
const Contact & c)
const;
289 inline bool hasRobot(
const std::string & robot)
const noexcept {
return robots().hasRobot(robot); }
346 inline std::shared_ptr<mc_rtc::gui::StateBuilder>
gui() const noexcept {
return gui_; }
444 return outputRealRobots_->robot(name);
461 virtual void supported_robots(std::vector<std::string> & out)
const;
479 void removeRobot(
const std::string & name);
495 Gripper & gripper(
const std::string & robot,
const std::string & gripper);
509 template<
typename T =
void>
513 "[MC_RTC_DEPRECATED] The anchorFrame and anchorFrameReal accessors are no longer supported, please "
514 "remove calls to these functions from your code and replace it with a datastore callback. For "
515 "further information please refer to the observer's tutorial: "
516 "https://jrl-umi3218.github.io/mc_rtc/tutorials/recipes/observers.html");
523 template<
typename T =
void>
527 "[MC_RTC_DEPRECATED] The anchorFrame and anchorFrameReal accessors are no longer supported, please "
528 "remove calls to these functions from your code and replace it with a datastore callback. For "
529 "further information please refer to the observer's tutorial: "
530 "https://jrl-umi3218.github.io/mc_rtc/tutorials/recipes/observers.html");
536 template<
typename T =
void>
540 "[MC_RTC_DEPRECATED] The anchorFrame and anchorFrameReal accessors are no longer supported, please "
541 "remove calls to these functions from your code and replace it with a datastore callback. For "
542 "further information please refer to the observer's tutorial: "
543 "https://jrl-umi3218.github.io/mc_rtc/tutorials/recipes/observers.html");
544 return robot().posW();
551 template<
typename T =
void>
555 "[MC_RTC_DEPRECATED] The anchorFrame and anchorFrameReal accessors are no longer supported, please "
556 "remove calls to these functions from your code and replace it with a datastore callback. For "
557 "further information please refer to the observer's tutorial: "
558 "https://jrl-umi3218.github.io/mc_rtc/tutorials/recipes/observers.html");
559 return robot().posW();
583 MCController(std::shared_ptr<mc_rbdyn::RobotModule> robot,
586 ControllerParameters params = {});
596 MCController(
const std::vector<std::shared_ptr<mc_rbdyn::RobotModule>> & robot_modules,
598 ControllerParameters params = {});
610 MCController(
const std::vector<std::shared_ptr<mc_rbdyn::RobotModule>> & robot_modules,
613 ControllerParameters params = {});
626 const std::string & name,
637 void updateContacts();
659 std::shared_ptr<mc_rtc::gui::StateBuilder>
gui_;
673 std::shared_ptr<mc_solver::ContactConstraint> contact_constraint_ =
nullptr;
684 using ContactTableDataT = std::tuple<std::string, std::string, std::string, std::string, std::string, double>;
730 static void set_loading_location(std::string_view location);
736 static void set_name(std::string_view name);
748 template<MCController::Backend backend,
typename SolverT>
774 # define CONTROLLER_MODULE_API __declspec(dllexport)
777 # define CONTROLLER_MODULE_API __attribute__((visibility("default")))
779 # define CONTROLLER_MODULE_API
Simplify access to values hold within a JSON file.
Definition: Configuration.h:165
const mc_solver::QPSolver & solver() const noexcept
Definition: MCController.h:337
const sva::PTransformd & anchorFrameReal() const
Definition: MCController.h:552
BackendSpecificController(mc_rbdyn::RobotModulePtr robot, double dt, const mc_rtc::Configuration &config={})
Definition: MCController.h:751
std::vector< mc_rbdyn::RobotConverter > converters_
Definition: MCController.h:651
const std::vector< std::vector< double > > q
Definition: MCController.h:48
const std::string name_
Definition: MCController.h:708
std::unordered_set< Contact, std::hash< Contact >, std::equal_to< Contact >, Eigen::aligned_allocator< Contact > > ContactSet
Definition: Contact.h:62
#define MC_CONTROL_DLLAPI
Definition: api.h:50
const SolverT & solver() const noexcept
Definition: MCController.h:764
const mc_rbdyn::Robots & realRobots() const noexcept
Definition: MCController.h:361
const mc_rtc::Configuration & config() const
Definition: MCController.h:485
Definition: QPSolver.h:85
mc_rbdyn::Robot & outputRobot() noexcept
Definition: MCController.h:402
mc_rbdyn::Robot & robot() noexcept
Definition: MCController.h:309
Generic data store.
Definition: DataStore.h:132
std::shared_ptr< Robots > RobotsPtr
Definition: fwd.h:17
SolverT & solver() noexcept
Definition: MCController.h:766
ControllerParameters(mc_solver::QPSolver::Backend backend)
Definition: MCController.h:87
void anchorFrameReal(const sva::PTransformd &)
Definition: MCController.h:524
Extra parameters that influence the creator construction.
Definition: MCController.h:52
mc_rbdyn::Robots & outputRealRobots() noexcept
Definition: MCController.h:428
mc_rbdyn::Robot & outputRobot(const std::string &name)
Definition: MCController.h:412
bool contacts_changed_
Definition: MCController.h:682
mc_rbdyn::Robot & robot(const std::string &name)
Definition: MCController.h:319
Definition: mc_global_controller.h:22
const mc_rtc::DataStore & datastore() const noexcept
Definition: MCController.h:352
mc_rbdyn::Robot & realRobot() noexcept
Definition: MCController.h:370
Definition: MCController.h:501
mc_rtc::unique_ptr< mc_solver::CollisionsConstraint > selfCollisionConstraint
Definition: MCController.h:702
std::vector< mc_solver::ConstraintSetPtr > constraints_
Definition: MCController.h:670
mc_rbdyn::RobotsPtr outputRobots_
Definition: MCController.h:648
Logs controller data to disk.
Definition: Logger.h:29
State observation pipeline.
Definition: ObserverPipeline.h:37
ContactSet contacts_
Definition: MCController.h:680
const mc_rbdyn::Robots & robots() const noexcept
Definition: MCController.h:294
mc_rbdyn::Robot & outputRealRobot() noexcept
Definition: MCController.h:435
Backend
Definition: QPSolver.h:90
mc_rtc::unique_ptr< mc_solver::CompoundJointConstraint > compoundJointConstraint
Definition: MCController.h:704
const mc_rbdyn::Robots & outputRobots() const noexcept
Definition: MCController.h:393
std::shared_ptr< mc_rtc::gui::StateBuilder > gui() const noexcept
Definition: MCController.h:346
std::shared_ptr< mc_tasks::PostureTask > postureTask
Definition: MCController.h:706
const mc_rbdyn::Robot & realRobot() const noexcept
Definition: MCController.h:368
mc_rtc::DataStore datastore_
Definition: MCController.h:666
const mc_rbdyn::Robot & outputRobot() const noexcept
Definition: MCController.h:400
mc_rtc::Configuration config_
Definition: MCController.h:662
mc_rtc::unique_ptr< mc_solver::ContactConstraint > contactConstraint
Definition: MCController.h:696
std::vector< mc_observers::ObserverPipeline > observerPipelines_
Definition: MCController.h:654
mc_rtc::Logger & logger() noexcept
Definition: MCController.h:343
mc_rtc::DataStore & datastore() noexcept
Definition: MCController.h:349
std::shared_ptr< mc_solver::QPSolver > qpsolver
Definition: MCController.h:641
const mc_rbdyn::Robot & realRobot(const std::string &name) const
Definition: MCController.h:377
mc_rbdyn::Robots & outputRobots() noexcept
Definition: MCController.h:395
bool hasRobot(const std::string &robot) const noexcept
Definition: MCController.h:289
MC_RBDYN_DLLAPI RobotsPtr loadRobot(const RobotModule &module, const LoadRobotParameters ¶ms={})
MCController(std::shared_ptr< mc_rbdyn::RobotModule > robot, double dt, ControllerParameters params={})
mc_solver::QPSolver & solver() noexcept
Definition: MCController.h:340
BackendSpecificController(const std::vector< mc_rbdyn::RobotModulePtr > &robots, double dt, const mc_rtc::Configuration &config={}, ControllerParameters params={})
Definition: MCController.h:756
const mc_rbdyn::Robots & outputRealRobots() const noexcept
Definition: MCController.h:426
std::shared_ptr< mc_rtc::gui::StateBuilder > gui_
Definition: MCController.h:659
mc_rbdyn::Robot & outputRealRobot(const std::string &name)
Definition: MCController.h:448
void anchorFrame(const sva::PTransformd &)
Definition: MCController.h:510
const sva::PTransformd & anchorFrame() const
Definition: MCController.h:537
mc_rbdyn::Robots & robots() noexcept
Definition: Robots.h:51
mc_rtc::unique_ptr< mc_solver::KinematicsConstraint > kinematicsConstraint
Definition: MCController.h:700
const double timeStep
Definition: MCController.h:694
mc_rbdyn::RobotsPtr outputRealRobots_
Definition: MCController.h:649
Definition: MCController.h:749
Contains information allowing the controller to start smoothly from the current state of the robot.
Definition: MCController.h:45
mc_rbdyn::Robot & env() noexcept
Definition: MCController.h:331
std::chrono::duration< double, std::milli > duration_ms
Definition: MCController.h:688
const mc_rbdyn::Robot & robot() const noexcept
Definition: MCController.h:306
const mc_rbdyn::Robot & outputRealRobot() const noexcept
Definition: MCController.h:433
mc_control::Contact Contact
Definition: Controller.h:22
mc_rbdyn::Robots & realRobots() noexcept
Definition: MCController.h:363
std::shared_ptr< RobotModule > RobotModulePtr
Definition: RobotModule.h:629
#define ADD_PARAMETER(TYPE, NAME, DEFAULT)
Definition: MCController.h:60
Definition: CompletionCriteria.h:10
mc_rbdyn::Robot & realRobot(const std::string &name)
Definition: MCController.h:380
const mc_rbdyn::Robot & env() const noexcept
Definition: MCController.h:328
A robot's gripper reprensentation.
Definition: generic_gripper.h:34
Definition: generic_gripper.h:14
const mc_rbdyn::Robot & outputRealRobot(const std::string &name) const
Definition: MCController.h:442
std::tuple< std::string, std::string, std::string, std::string, std::string, double > ContactTableDataT
Definition: MCController.h:684
mc_rbdyn::Robots & robots() noexcept
Definition: MCController.h:297
Definition: Collision.h:20
const mc_rbdyn::Robot & outputRobot(const std::string &name) const
Definition: MCController.h:409
MCController is the base class to implement all controllers. It assumes that at least two robots are ...
Definition: MCController.h:98
std::vector< ContactTableDataT > contacts_table_
Definition: MCController.h:686
mc_rtc::unique_ptr< mc_solver::DynamicsConstraint > dynamicsConstraint
Definition: MCController.h:698
std::shared_ptr< mc_rtc::Logger > logger_
Definition: MCController.h:657
mc_rtc::Configuration & config()
Definition: MCController.h:482
std::map< std::pair< std::string, std::string >, std::shared_ptr< mc_solver::CollisionsConstraint > > collision_constraints_
Definition: MCController.h:677
const mc_rbdyn::Robot & robot(const std::string &name) const
Definition: MCController.h:316
const std::string loading_location_
Definition: MCController.h:710