humoto
point_mass_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  {
16  /**
17  * @brief Class that groups together parmeters related to a robot foot
18  */
20  {
21  #define HUMOTO_CONFIG_SECTION_ID "PointMassState"
22  #define HUMOTO_CONFIG_CONSTRUCTOR PointMassState
23  #define HUMOTO_CONFIG_ENTRIES \
24  HUMOTO_CONFIG_COMPOUND_(position) \
25  HUMOTO_CONFIG_COMPOUND_(velocity) \
26  HUMOTO_CONFIG_COMPOUND_(acceleration)
27  #include HUMOTO_CONFIG_DEFINE_ACCESSORS
28 
29 
30  public:
31  etools::Vector3 position_;
32  etools::Vector3 velocity_;
33  etools::Vector3 acceleration_;
34 
35 
36  public:
37  /**
38  * @brief Default constructor.
39  */
41  {
42  setDefaults();
43  }
44 
45 
46  /**
47  * @brief Initialize state (everything is set to zeros).
48  */
49  void setDefaults()
50  {
51  position_.setZero();
52  velocity_.setZero();
53  acceleration_.setZero();
54  }
55 
56 
57  /**
58  * @brief Initialize state (everything is set to NaN).
59  */
60  void unset()
61  {
62  etools::unsetMatrix(position_);
63  etools::unsetMatrix(velocity_);
64  etools::unsetMatrix(acceleration_);
65  }
66 
67 
68  /**
69  * @brief Set state
70  *
71  * @param[in] position
72  * @param[in] velocity
73  * @param[in] acceleration
74  */
75  void set( const etools::Vector3 position,
76  const etools::Vector3 velocity = etools::Vector3::Zero(),
77  const etools::Vector3 acceleration = etools::Vector3::Zero())
78  {
79  position_ = position;
80  velocity_ = velocity;
81  acceleration_ = acceleration;
82  }
83 
84 
85  /**
86  * @brief Log
87  *
88  * @param[in,out] logger logger
89  * @param[in] parent parent
90  * @param[in] name name
91  */
93  const LogEntryName &parent = LogEntryName(),
94  const std::string &name = "point_mass_state") const
95  {
96  LogEntryName subname = parent; subname.add(name);
97 
98  logger.log(LogEntryName(subname).add("position") , position_);
99  logger.log(LogEntryName(subname).add("velocity") , velocity_);
100  logger.log(LogEntryName(subname).add("acceleration"), acceleration_);
101  }
102  };
103  }
104 }
PointMassState()
Default constructor.
#define HUMOTO_LOCAL
Definition: export_import.h:26
#define HUMOTO_GLOBAL_LOGGER_IF_DEFINED
Definition: logger.h:997
Default configurable base is strict.
Definition: config.h:353
Represents log entry name.
Definition: logger.h:169
void unset()
Initialize state (everything is set to NaN).
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.
Threaded logger: any data sent to this logger is wrapped in a message and pushed to a queue...
Definition: logger.h:555
The root namespace of HuMoTo.
Definition: config.h:12
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).