humoto
rigid_body_state.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA, 2014-2015 CNRS. Licensed under the Apache
5  License, Version 2.0. (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 rigidbody
15  {
17  {
18  #define HUMOTO_CONFIG_SECTION_ID "RigidBodyPose"
19  #define HUMOTO_CONFIG_CONSTRUCTOR RigidBodyPose
20  #define HUMOTO_CONFIG_ENTRIES \
21  HUMOTO_CONFIG_COMPOUND_(position) \
22  HUMOTO_CONFIG_COMPOUND_(rpy)
23  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
24 
25 
26  protected:
27  /**
28  * @brief Set default values
29  */
30  void setDefaults()
31  {
32  etools::unsetMatrix(position_);
33  etools::unsetMatrix(rpy_);
34  }
35 
36 
37  public:
38  etools::Vector3 position_;
39  etools::Vector3 rpy_;
40 
41 
42  public:
43  /**
44  * @brief Default constructor
45  */
47  {
48  setDefaults();
49  }
50 
51 
52  /**
53  * @brief Writes a pose to a stream
54  *
55  * @param[in,out] out output stream
56  * @param[in] pose
57  *
58  * @return output stream
59  *
60  * @attention No leading or trailing spaces.
61  */
62  friend std::ostream& operator<< ( std::ostream& out,
63  const RigidBodyPose & pose)
64  {
65  out << pose.position_.x() << " "
66  << pose.position_.y() << " "
67  << pose.position_.z() << " "
68  << pose.rpy_.x() << " "
69  << pose.rpy_.y() << " "
70  << pose.rpy_.z();
71 
72  return(out);
73  }
74 
75 
76  /**
77  * @brief Log
78  *
79  * @param[in,out] logger logger
80  * @param[in] parent parent
81  * @param[in] name name
82  */
84  const LogEntryName &parent = LogEntryName(),
85  const std::string &name = "rigid_body_pose") const
86  {
87  LogEntryName subname = parent;
88  subname.add(name);
89  logger.log(LogEntryName(subname).add("position"), position_);
90  logger.log(LogEntryName(subname).add("rpy") , rpy_);
91  }
92  };
93 
94 
95 
96  /**
97  * @brief Class that groups together parameters related to a robot foot
98  */
100  {
101  protected:
102  #define HUMOTO_CONFIG_SECTION_ID "RigidBodyState"
103  #define HUMOTO_CONFIG_CONSTRUCTOR RigidBodyState
104  #define HUMOTO_CONFIG_ENTRIES \
105  HUMOTO_CONFIG_PARENT_CLASS(PointMassState) \
106  HUMOTO_CONFIG_PARENT_CLASS(RotaryState)
107  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
108 
109 
110  public:
111  /**
112  * @brief Default constructor.
113  */
115  {
116  setDefaults();
117  }
118 
119 
120  /**
121  * @brief Initialize state (everything is set to zeros).
122  */
123  void setDefaults()
124  {
127  }
128 
129 
130  /**
131  * @brief Initialize state (everything is set to NaN).
132  */
133  void unset()
134  {
137  }
138 
139 
140  /**
141  * @brief Log
142  *
143  * @param[in,out] logger logger
144  * @param[in] parent parent
145  * @param[in] name name
146  */
148  const LogEntryName &parent= LogEntryName(),
149  const std::string &name = "rigid_body_state") const
150  {
151  PointMassState::log(logger, parent, name);
152  RotaryState::log(logger, parent, name);
153  }
154  };
155  }
156 }
void unset()
Initialize state (everything is set to NaN).
Definition: rotary_state.h:266
Class that groups together parameters related to a robot foot.
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="rotary_state") const
Log.
Definition: rotary_state.h:292
#define HUMOTO_LOCAL
Definition: export_import.h:26
void setDefaults()
Set default values.
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
Definition: logger.h:997
Default configurable base is strict.
Definition: config.h:353
RigidBodyState()
Default constructor.
Represents log entry name.
Definition: logger.h:169
void unset()
Initialize state (everything is set to NaN).
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="rigid_body_state") const
Log.
Class that groups together parameters related to a robot foot.
Definition: rotary_state.h:225
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="rigid_body_pose") const
Log.
void unsetMatrix(Eigen::DenseBase< t_Derived > &matrix)
Unset matrix (initialize to NaN)
Definition: eigentools.h:178
void log(humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="point_mass_state") const
Log.
void unset()
Initialize state (everything is set to NaN).
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
Definition: logger.h:555
RigidBodyPose()
Default constructor.
The root namespace of HuMoTo.
Definition: config.h:12
void setDefaults()
Initialize state (everything is set to zeros).
Definition: rotary_state.h:255
Class that groups together parmeters related to a robot foot.
LogEntryName & add(const char *name)
extends entry name with a subname
Definition: logger.h:232
void setDefaults()
Initialize state (everything is set to zeros).
void setDefaults()
Initialize state (everything is set to zeros).