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
203 bool run(mc_solver::FeedbackType fType);
237 const std::string & r2,
238 const std::vector<mc_rbdyn::Collision> & collisions);
245 const std::string & r2,
246 const std::string & c1,
247 const std::string & c2)
const noexcept;
255 const std::string & r2,
256 const std::vector<mc_rbdyn::Collision> & collisions);
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);
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();
596 MCController(
const std::vector<std::shared_ptr<mc_rbdyn::RobotModule>> & robot_modules,
610 MCController(
const std::vector<std::shared_ptr<mc_rbdyn::RobotModule>> & robot_modules,
626 const std::string & name,
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>;
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
#define ADD_PARAMETER(TYPE, NAME, DEFAULT)
Definition: MCController.h:60
#define MC_CONTROL_DLLAPI
Definition: api.h:50
mc_control::Contact Contact
Definition: Controller.h:22
Definition: CompletionCriteria.h:11
std::unordered_set< Contact, std::hash< Contact >, std::equal_to< Contact >, Eigen::aligned_allocator< Contact > > ContactSet
Definition: Contact.h:62
Definition: generic_gripper.h:15
std::shared_ptr< Robots > RobotsPtr
Definition: fwd.h:17
std::shared_ptr< RobotModule > RobotModulePtr
Definition: RobotModule.h:629
Extra parameters that influence the creator construction.
Definition: MCController.h:53
ControllerParameters(ControllerParameters &&)=default
ControllerParameters & operator=(const ControllerParameters &)=default
ControllerParameters & operator=(ControllerParameters &&)=default
ControllerParameters(const ControllerParameters &)=default
ControllerParameters(mc_solver::QPSolver::Backend backend)
Definition: MCController.h:87
ControllerParameters()=default
Contains information allowing the controller to start smoothly from the current state of the robot.
Definition: MCController.h:46
const std::vector< std::vector< double > > q
Definition: MCController.h:48
A robot's gripper reprensentation.
Definition: generic_gripper.h:35
Definition: MCController.h:502
MCController is the base class to implement all controllers. It assumes that at least two robots are ...
Definition: MCController.h:99
virtual void createObserverPipelines(const mc_rtc::Configuration &config)
const mc_rbdyn::Robots & realRobots() const noexcept
Definition: MCController.h:361
void removeCollisions(const std::string &r1, const std::string &r2)
bool hasContact(const Contact &c) const
const mc_rbdyn::Robot & outputRobot(const std::string &name) const
Definition: MCController.h:409
std::tuple< std::string, std::string, std::string, std::string, std::string, double > ContactTableDataT
Definition: MCController.h:684
const std::string name_
Definition: MCController.h:708
mc_rtc::unique_ptr< mc_solver::ContactConstraint > contactConstraint
Definition: MCController.h:696
const mc_rbdyn::Robot & realRobot(const std::string &name) const
Definition: MCController.h:377
const mc_observers::ObserverPipeline & observerPipeline() const
mc_rbdyn::Robot & outputRealRobot(const std::string &name)
Definition: MCController.h:448
void addContact(const Contact &c)
mc_rtc::unique_ptr< mc_solver::DynamicsConstraint > dynamicsConstraint
Definition: MCController.h:698
const mc_rbdyn::Robot & outputRealRobot(const std::string &name) const
Definition: MCController.h:442
mc_rbdyn::Robot & outputRealRobot() noexcept
Definition: MCController.h:435
std::vector< mc_solver::ConstraintSetPtr > constraints_
Definition: MCController.h:670
const mc_rbdyn::Robot & outputRealRobot() const noexcept
Definition: MCController.h:433
mc_rbdyn::Robots & outputRealRobots() noexcept
Definition: MCController.h:428
mc_rbdyn::Robot & realRobot() noexcept
Definition: MCController.h:370
MCController(const std::vector< std::shared_ptr< mc_rbdyn::RobotModule >> &robot_modules, double dt, ControllerParameters params={})
MCController(std::shared_ptr< mc_rbdyn::RobotModule > robot, double dt, const mc_rtc::Configuration &config, ControllerParameters params={})
const mc_solver::QPSolver & solver() const noexcept
Definition: MCController.h:337
mc_rbdyn::Robot & outputRobot(const std::string &name)
Definition: MCController.h:412
mc_rtc::unique_ptr< mc_solver::CompoundJointConstraint > compoundJointConstraint
Definition: MCController.h:704
void anchorFrame(const sva::PTransformd &)
Definition: MCController.h:510
mc_rbdyn::Robot & loadRobot(mc_rbdyn::RobotModulePtr rm, const std::string &name)
bool hasCollision(const std::string &r1, const std::string &r2, const mc_rbdyn::Collision &col) const noexcept
const sva::PTransformd & anchorFrame() const
Definition: MCController.h:537
const std::string loading_location_
Definition: MCController.h:710
mc_rbdyn::RobotsPtr outputRealRobots_
Definition: MCController.h:649
const std::vector< mc_observers::ObserverPipeline > & observerPipelines() const
std::vector< ContactTableDataT > contacts_table_
Definition: MCController.h:686
virtual void reset(const ControllerResetData &reset_data)
std::shared_ptr< mc_tasks::PostureTask > postureTask
Definition: MCController.h:706
mc_rtc::unique_ptr< mc_solver::CollisionsConstraint > selfCollisionConstraint
Definition: MCController.h:702
mc_rtc::DataStore datastore_
Definition: MCController.h:666
const mc_rbdyn::Robot & realRobot() const noexcept
Definition: MCController.h:368
std::shared_ptr< mc_solver::QPSolver > qpsolver
Definition: MCController.h:641
virtual bool runObserverPipelines()
mc_observers::ObserverPipeline & observerPipeline(const std::string &name)
const ContactSet & contacts() const
const mc_rbdyn::Robots & outputRealRobots() const noexcept
Definition: MCController.h:426
bool contacts_changed_
Definition: MCController.h:682
std::shared_ptr< mc_rtc::gui::StateBuilder > gui_
Definition: MCController.h:659
mc_rtc::Configuration robot_config(const std::string &robot_name) const
void addCollisions(const std::string &r1, const std::string &r2, const std::vector< mc_rbdyn::Collision > &collisions)
std::chrono::duration< double, std::milli > duration_ms
Definition: MCController.h:688
std::shared_ptr< mc_rtc::Logger > logger_
Definition: MCController.h:657
MCController(std::shared_ptr< mc_rbdyn::RobotModule > robot, double dt, ControllerParameters params={})
mc_rbdyn::Robots & robots() noexcept
Definition: MCController.h:297
Gripper & gripper(const std::string &robot, const std::string &gripper)
const mc_rbdyn::Robot & robot(const std::string &name) const
Definition: MCController.h:316
static void set_name(std::string_view name)
void removeCollisions(const std::string &r1, const std::string &r2, const std::vector< mc_rbdyn::Collision > &collisions)
mc_rbdyn::Robots & realRobots() noexcept
Definition: MCController.h:363
static void set_loading_location(std::string_view location)
const mc_rtc::Configuration & config() const
Definition: MCController.h:485
mc_rtc::Configuration robot_config(const mc_rbdyn::Robot &robot) const
bool run(mc_solver::FeedbackType fType)
mc_rbdyn::Robot & robot() noexcept
Definition: MCController.h:309
mc_rbdyn::Robots & outputRobots() noexcept
Definition: MCController.h:395
const mc_observers::ObserverPipeline & observerPipeline(const std::string &name) const
void addRobotToGUI(const mc_rbdyn::Robot &robot)
bool hasCollision(const std::string &r1, const std::string &r2, const std::string &c1, const std::string &c2) const noexcept
mc_rbdyn::RobotsPtr outputRobots_
Definition: MCController.h:648
mc_rbdyn::Robot & env() noexcept
Definition: MCController.h:331
virtual void supported_robots(std::vector< std::string > &out) const
mc_rtc::Logger & logger() noexcept
Definition: MCController.h:343
void addRobotToLog(const mc_rbdyn::Robot &robot)
std::vector< mc_observers::ObserverPipeline > observerPipelines_
Definition: MCController.h:654
mc_rbdyn::Robot & outputRobot() noexcept
Definition: MCController.h:402
const mc_rtc::DataStore & datastore() const noexcept
Definition: MCController.h:352
void anchorFrameReal(const sva::PTransformd &)
Definition: MCController.h:524
mc_solver::QPSolver & solver() noexcept
Definition: MCController.h:340
bool hasObserverPipeline() const
mc_rtc::Configuration & config()
Definition: MCController.h:482
const mc_rbdyn::Robot & robot() const noexcept
Definition: MCController.h:306
mc_rtc::unique_ptr< mc_solver::KinematicsConstraint > kinematicsConstraint
Definition: MCController.h:700
const mc_rbdyn::Robots & outputRobots() const noexcept
Definition: MCController.h:393
const mc_rbdyn::Robot & outputRobot() const noexcept
Definition: MCController.h:400
const mc_rbdyn::Robot & env() const noexcept
Definition: MCController.h:328
mc_rtc::Configuration config_
Definition: MCController.h:662
std::vector< mc_observers::ObserverPipeline > & observerPipelines()
mc_observers::ObserverPipeline & observerPipeline()
std::shared_ptr< mc_rtc::gui::StateBuilder > gui() const noexcept
Definition: MCController.h:346
std::map< std::pair< std::string, std::string >, std::shared_ptr< mc_solver::CollisionsConstraint > > collision_constraints_
Definition: MCController.h:677
std::vector< mc_rbdyn::RobotConverter > converters_
Definition: MCController.h:651
const mc_rbdyn::Robots & robots() const noexcept
Definition: MCController.h:294
virtual bool resetObserverPipelines()
Reset the observers.
mc_rbdyn::Robot & robot(const std::string &name)
Definition: MCController.h:319
void removeContact(const Contact &c)
const double timeStep
Definition: MCController.h:694
const sva::PTransformd & anchorFrameReal() const
Definition: MCController.h:552
void removeRobot(const std::string &name)
mc_rbdyn::Robot & realRobot(const std::string &name)
Definition: MCController.h:380
MCController(const std::vector< std::shared_ptr< mc_rbdyn::RobotModule >> &robot_modules, double dt, const mc_rtc::Configuration &config, ControllerParameters params={})
bool hasObserverPipeline(const std::string &name) const
mc_rbdyn::Robot & loadRobot(mc_rbdyn::RobotModulePtr rm, const std::string &name, mc_rbdyn::Robots &robots, const mc_rbdyn::LoadRobotParameters ¶ms)
ContactSet contacts_
Definition: MCController.h:680
mc_rtc::DataStore & datastore() noexcept
Definition: MCController.h:349
bool hasRobot(const std::string &robot) const noexcept
Definition: MCController.h:289
Definition: mc_global_controller.h:23
Definition: MCController.h:750
const SolverT & solver() const noexcept
Definition: MCController.h:764
SolverT & solver() noexcept
Definition: MCController.h:766
BackendSpecificController(mc_rbdyn::RobotModulePtr robot, double dt, const mc_rtc::Configuration &config={})
Definition: MCController.h:751
BackendSpecificController(const std::vector< mc_rbdyn::RobotModulePtr > &robots, double dt, const mc_rtc::Configuration &config={}, ControllerParameters params={})
Definition: MCController.h:756
State observation pipeline.
Definition: ObserverPipeline.h:38
Definition: Collision.h:21
mc_rbdyn::Robots & robots() noexcept
Definition: Robots.h:51
Simplify access to values hold within a JSON file.
Definition: Configuration.h:166
Generic data store.
Definition: DataStore.h:133
Logs controller data to disk.
Definition: Logger.h:30
Definition: QPSolver.h:86
Backend
Definition: QPSolver.h:91