humoto
common.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
5  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6 
7  @brief
8 */
9 
10 #pragma once
11 
12 namespace humoto
13 {
14  namespace pepper_ik
15  {
16  /// Root position and orientation
17  static const char * ROOT_VARIABLES_ID = "root_vel";
18  /// Joint angles
19  static const char * JOINTS_VARIABLES_ID = "joints_vel";
20 
21 
22  /**
23  * @brief Parameters of the WBC problem.
24  */
26  {
27  #define HUMOTO_CONFIG_SECTION_ID "WBCParameters"
28  #define HUMOTO_CONFIG_CONSTRUCTOR WBCParameters
29  #define HUMOTO_CONFIG_ENTRIES \
30  HUMOTO_CONFIG_SCALAR_(control_interval_ms) \
31  HUMOTO_CONFIG_SCALAR_(joint_angle_error_tolerance) \
32  HUMOTO_CONFIG_SCALAR_(motion_parameters_tolerance) \
33  HUMOTO_CONFIG_SCALAR_(maximal_number_of_iterations)
34  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
35 
36 
37  protected:
38  /**
39  * @brief Initialize to default values
40  */
41  void setDefaults()
42  {
43  control_interval_ms_ = 10;
44  joint_angle_error_tolerance_ = 1e-2;
45  maximal_number_of_iterations_ = 3;
46  motion_parameters_tolerance_ = 1e-3;
47  }
48 
49  void finalize()
50  {
51  control_interval_ = convertMillisecondToSecond(control_interval_ms_);
52  }
53 
54 
55  public:
57  std::size_t control_interval_ms_;
58 
61 
63 
64 
65  public:
67  {
68  setDefaults();
69  finalize();
70  }
71  };
72 
73 
74 
75  /**
76  * @brief Desired motion parameters
77  */
79  {
80  #define HUMOTO_CONFIG_SECTION_ID "MotionParameters"
81  #define HUMOTO_CONFIG_CONSTRUCTOR MotionParameters
82  #define HUMOTO_CONFIG_ENTRIES \
83  HUMOTO_CONFIG_COMPOUND_(base_orientation_rpy) \
84  HUMOTO_CONFIG_COMPOUND_(base_com_position) \
85  HUMOTO_CONFIG_COMPOUND_(body_com_position)
86  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
87 
88 
89  public:
90  etools::Vector3 base_com_position_;
91  etools::Vector3 body_com_position_;
92 
93  etools::Vector3 base_orientation_rpy_;
94 
95 
96  public:
98  {
99  setDefaults();
100  }
101 
102 
103  /**
104  * @brief Initialize to default values
105  */
106  void setDefaults()
107  {
108  base_com_position_.x() = 0.002531976618098;
109  base_com_position_.y() = 0.0;
110  base_com_position_.z() = 0.125564931735602;
111 
112  body_com_position_.x() = -0.00402863432226587;
113  body_com_position_.y() = 0.0;
114  body_com_position_.z() = 0.75;
115 
116  base_orientation_rpy_.x() = 0;
117  base_orientation_rpy_.y() = 0;
118  base_orientation_rpy_.z() = 0;
119  }
120  };
121  }
122 }
void finalize()
This function is called automaticaly after reading a configuration file. Does nothing by default...
Definition: common.h:49
static const char * ROOT_VARIABLES_ID
Root position and orientation.
Definition: common.h:17
static const char * JOINTS_VARIABLES_ID
Joint angles.
Definition: common.h:19
#define HUMOTO_LOCAL
Definition: export_import.h:26
Desired motion parameters.
Definition: common.h:78
etools::Vector3 base_com_position_
Definition: common.h:90
Default configurable base is strict.
Definition: config.h:353
double HUMOTO_LOCAL convertMillisecondToSecond(const std::size_t milliseconds)
Converts milliseconds to seconds.
Definition: time.h:22
etools::Vector3 body_com_position_
Definition: common.h:91
void setDefaults()
Initialize to default values.
Definition: common.h:41
void setDefaults()
Initialize to default values.
Definition: common.h:106
std::size_t maximal_number_of_iterations_
Definition: common.h:62
The root namespace of HuMoTo.
Definition: config.h:12
std::size_t control_interval_ms_
Definition: common.h:57
Parameters of the WBC problem.
Definition: common.h:25
etools::Vector3 base_orientation_rpy_
Definition: common.h:93