1010#include < tsid/tasks/task-se3-equality.hpp>
1111#include < tsid/trajectories/trajectory-euclidian.hpp>
1212
13+ // Allow to define a field, it's default value and its convenient chainable setter in one keyword.
14+ #define DEFINE_FIELD (type, name, value ) \
15+ type name = value; \
16+ Settings & set_##name(type v) \
17+ { \
18+ name = v; \
19+ return *this ; \
20+ }
21+
1322namespace simple_mpc
1423{
1524
@@ -18,13 +27,6 @@ namespace simple_mpc
1827 public:
1928 struct Settings
2029 {
21- #define DEFINE_FIELD (type, name, value ) \
22- type name = value; \
23- Settings & set_##name(type v) \
24- { \
25- name = v; \
26- return *this ; \
27- }
2830
2931 // Physical quantities
3032 DEFINE_FIELD (double , friction_coefficient, 0.3 )
@@ -38,23 +40,18 @@ namespace simple_mpc
3840 0.01 ) // Min force for one foot contact (express as a multiple of the robot weight)
3941
4042 // Tasks gains
41- DEFINE_FIELD (double , kp_base, 10 )
42- DEFINE_FIELD (double , kp_posture, 10 )
43- DEFINE_FIELD (double , kp_contact, 10 )
43+ DEFINE_FIELD (double , kp_base, 0 . )
44+ DEFINE_FIELD (double , kp_posture, 0 . )
45+ DEFINE_FIELD (double , kp_contact, 0 . )
4446
4547 // Tasks weights
46- DEFINE_FIELD (double , w_base, 10 .)
47- DEFINE_FIELD (double , w_posture, 1.0 )
48- DEFINE_FIELD (double , w_contact_motion, 1.0 )
49- DEFINE_FIELD (double , w_contact_force, 1.0 )
50-
51- static Settings Default ()
52- {
53- return {};
54- } // Work-around c++ bug to have a default constructor of nested class
48+ DEFINE_FIELD (double , w_base, -1 .) // Disabled by default
49+ DEFINE_FIELD (double , w_posture, -1 .) // Disabled by default
50+ DEFINE_FIELD (double , w_contact_motion, -1 .) // Disabled by default
51+ DEFINE_FIELD (double , w_contact_force, -1 .) // Disabled by default
5552 };
5653
57- KinodynamicsID (const simple_mpc::RobotModelHandler & model_handler, const Settings settings = Settings::Default() )
54+ KinodynamicsID (const simple_mpc::RobotModelHandler & model_handler, const Settings settings)
5855 : settings_(settings)
5956 , model_handler_(model_handler)
6057 , data_handler_(model_handler_)
0 commit comments