configuration_io.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
8 #include <mc_rtc/Configuration.h>
9 
10 /* Easily serialized/deserialized types */
11 #include <mc_rbdyn/Base.h>
12 #include <mc_rbdyn/BodySensor.h>
13 #include <mc_rbdyn/Collision.h>
14 #include <mc_rbdyn/Flexibility.h>
15 #include <mc_rbdyn/ForceSensor.h>
16 #include <mc_rbdyn/JointSensor.h>
18 #include <mc_rbdyn/RobotModule.h>
19 #include <mc_rbdyn/Springs.h>
20 #include <mc_rbdyn/polygon_utils.h>
21 
22 #include <Tasks/QPTasks.h>
23 
24 /* Serialized/deserialized from/to shared pointers */
27 #include <mc_rbdyn/PlanarSurface.h>
28 
29 /* Serialized/deserialized from/to shared pointers */
30 #include <sch-core/S_Object.h>
31 
32 /* Require a Robots instance to be deserialized */
33 #include <mc_rbdyn/Contact.h>
34 #include <mc_rtc/logging.h>
35 
36 #include <fstream>
37 
38 namespace mc_rtc
39 {
40 
41 /* This temporary macro makes the file much easier to skim through */
42 #define DECLARE_IO(...) \
43  template<> \
44  struct MC_RBDYN_DLLAPI ConfigurationLoader<__VA_ARGS__> \
45  { \
46  static __VA_ARGS__ load(const mc_rtc::Configuration &); \
47  static mc_rtc::Configuration save(const __VA_ARGS__ &); \
48  };
49 
50 DECLARE_IO(Eigen::Matrix<double, 6, Eigen::Dynamic>)
51 
52 DECLARE_IO(sva::RBInertiad)
53 
55 DECLARE_IO(rbd::Joint)
56 DECLARE_IO(rbd::Body)
57 DECLARE_IO(rbd::MultiBody)
58 DECLARE_IO(rbd::MultiBodyConfig)
59 
60 DECLARE_IO(tasks::qp::JointGains)
61 
65 DECLARE_IO(rbd::parsers::Geometry::Mesh)
66 DECLARE_IO(rbd::parsers::Geometry::Superellipsoid)
67 DECLARE_IO(rbd::parsers::Geometry)
68 DECLARE_IO(rbd::parsers::Material::Color)
69 DECLARE_IO(rbd::parsers::Material::Texture)
70 DECLARE_IO(rbd::parsers::Material)
72 
74 
79 DECLARE_IO(std::shared_ptr<mc_rbdyn::Surface>)
80 DECLARE_IO(std::shared_ptr<mc_rbdyn::PlanarSurface>)
81 DECLARE_IO(std::shared_ptr<mc_rbdyn::CylindricalSurface>)
82 DECLARE_IO(std::shared_ptr<mc_rbdyn::GripperSurface>)
92 
93 #undef DECLARE_IO
94 
95 template<>
97 {
98  static mc_rbdyn::RobotModule load(const mc_rtc::Configuration &);
99  static mc_rtc::Configuration save(const mc_rbdyn::RobotModule &,
100  bool save_mbc = true,
101  const std::vector<std::string> & filteredLinks = {},
102  bool fixed = false);
103 };
104 
105 template<>
107 {
108  static mc_rbdyn::RobotModulePtr load(const mc_rtc::Configuration &);
110  bool save_mbc = true,
111  const std::vector<std::string> & filteredLinks = {},
112  bool fixed = false);
113 };
114 
115 template<>
117 {
118  static mc_rbdyn::Contact load(const mc_rtc::Configuration &, const mc_rbdyn::Robots &);
119  static mc_rtc::Configuration save(const mc_rbdyn::Contact &);
120 };
121 
122 } // namespace mc_rtc
mc_rtc::Configuration
Simplify access to values hold within a JSON file.
Definition: Configuration.h:165
mc_rbdyn::Robots
Definition: Robots.h:15
CylindricalSurface.h
mc_rbdyn::RobotModule::Gripper
Definition: RobotModule.h:112
mc_rbdyn::S_ObjectPtr
std::shared_ptr< sch::S_Object > S_ObjectPtr
Definition: RobotModule.h:35
mc_rtc::gui::Sphere
auto Sphere(const std::string &name, GetRadius radius_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Sphere.h:20
polygon_utils.h
mc_rbdyn::Springs
Definition: Springs.h:16
GripperSurface.h
mc_rbdyn::Plane
Definition: polygon_utils.h:43
RobotModule.h
mc_rbdyn::PolygonInterpolator
Definition: PolygonInterpolator.h:25
BodySensor.h
Contact.h
mc_rbdyn::Base
Definition: Base.h:17
Base.h
mc_rbdyn::ForceSensor
Definition: ForceSensor.h:19
mc_rtc::gui::Box
auto Box(const std::string &name, GetSize size_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Box.h:20
Collision.h
Flexibility.h
mc_rbdyn::RobotModule
Definition: RobotModule.h:69
mc_rbdyn::Mimic
Stores mimic joint information.
Definition: Mimic.h:15
mc_rtc::gui::Cylinder
auto Cylinder(const std::string &name, GetParams params_fn, GetPos get_pos_fn, GetColor color_fn=mc_rtc::gui::Color::Red)
Definition: Cylinder.h:27
mc_rbdyn::BodySensor
Definition: BodySensor.h:19
mc_rtc::gui::Visual
auto Visual(const std::string &name, GetVisual get_visual_fn, GetPos get_pos_fn)
Definition: Visual.h:64
MC_RBDYN_DLLAPI
#define MC_RBDYN_DLLAPI
Definition: api.h:50
Configuration.h
mc_rbdyn::RobotModule::Gripper::Safety
Definition: RobotModule.h:115
ForceSensor.h
logging.h
JointSensor.h
mc_rbdyn::Contact
Definition: Contact.h:48
Springs.h
mc_control::fsm::Contact
mc_control::Contact Contact
Definition: Controller.h:22
mc_rtc::gui::plot::Type
Type
Definition: types.h:30
mc_rbdyn::RobotModulePtr
std::shared_ptr< RobotModule > RobotModulePtr
Definition: RobotModule.h:629
PolygonInterpolator.h
mc_rbdyn
Definition: generic_gripper.h:14
mc_rbdyn::JointSensor
Definition: JointSensor.h:17
mc_rtc::ConfigurationLoader
Definition: Configuration.h:55
mc_rbdyn::Collision
Definition: Collision.h:20
PlanarSurface.h
DECLARE_IO
#define DECLARE_IO(...)
Definition: configuration_io.h:42
mc_rbdyn::RobotModule::FrameDescription
Definition: RobotModule.h:208
mc_rtc
Definition: Contact.h:87
mc_rbdyn::Flexibility
Definition: Flexibility.h:24