HEBI C++ API  3.10.0
group_feedback.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 
5 #include <memory>
6 #include <vector>
7 
8 #include "Eigen/Eigen"
9 #include "feedback.hpp"
11 
12 namespace hebi {
13 
18 class GroupFeedback final {
19 public:
20 #ifndef DOXYGEN_OMIT_INTERNAL
21 
25  std::shared_ptr<GroupFeedbackWrapper> internal_;
26 #endif // DOXYGEN_OMIT_INTERNAL
27 
28 private:
32  const size_t number_of_modules_;
36  std::vector<Feedback> feedbacks_;
40  const bool is_subview_{};
41 
45  GroupFeedback(std::shared_ptr<GroupFeedbackWrapper>, std::vector<int> indices);
46 
47 public:
51  GroupFeedback(size_t number_of_modules);
52 #ifndef DOXYGEN_OMIT_INTERNAL
53 
58  GroupFeedback(HebiGroupFeedbackPtr group_feedback);
59 #endif // DOXYGEN_OMIT_INTERNAL
60 
64  ~GroupFeedback() noexcept = default;
65 
69  GroupFeedback(GroupFeedback&&) = default;
70 
79  GroupFeedback subview(std::vector<int> indices) const;
80 
84  bool isSubview() const { return is_subview_; }
85 
89  size_t size() const;
90 
94  const Feedback& operator[](size_t index) const;
95 
104  double getTime() const;
105 
114  uint64_t getTimeUs() const;
115 
119  Eigen::VectorXd getBoardTemperature() const;
123  Eigen::VectorXd getProcessorTemperature() const;
127  Eigen::VectorXd getVoltage() const;
131  Eigen::VectorXd getDeflection() const;
135  Eigen::VectorXd getDeflectionVelocity() const;
139  Eigen::VectorXd getMotorVelocity() const;
143  Eigen::VectorXd getMotorCurrent() const;
147  Eigen::VectorXd getMotorSensorTemperature() const;
151  Eigen::VectorXd getMotorWindingCurrent() const;
155  Eigen::VectorXd getMotorWindingTemperature() const;
159  Eigen::VectorXd getMotorHousingTemperature() const;
160 
164  Eigen::VectorXd getPosition() const;
168  Eigen::VectorXd getVelocity() const;
172  Eigen::VectorXd getEffort() const;
173 
177  Eigen::VectorXd getPositionCommand() const;
181  Eigen::VectorXd getVelocityCommand() const;
185  Eigen::VectorXd getEffortCommand() const;
186 
190  Eigen::MatrixX3d getAccelerometer() const;
194  Eigen::MatrixX3d getGyro() const;
195 
199  void getBoardTemperature(Eigen::VectorXd& out) const;
203  void getProcessorTemperature(Eigen::VectorXd& out) const;
207  void getVoltage(Eigen::VectorXd& out) const;
211  void getDeflection(Eigen::VectorXd& out) const;
215  void getDeflectionVelocity(Eigen::VectorXd& out) const;
219  void getMotorVelocity(Eigen::VectorXd& out) const;
223  void getMotorCurrent(Eigen::VectorXd& out) const;
227  void getMotorSensorTemperature(Eigen::VectorXd& out) const;
231  void getMotorWindingCurrent(Eigen::VectorXd& out) const;
235  void getMotorWindingTemperature(Eigen::VectorXd& out) const;
239  void getMotorHousingTemperature(Eigen::VectorXd& out) const;
240 
244  void getPosition(Eigen::VectorXd& out) const;
248  void getVelocity(Eigen::VectorXd& out) const;
252  void getEffort(Eigen::VectorXd& out) const;
253 
257  void getPositionCommand(Eigen::VectorXd& out) const;
261  void getVelocityCommand(Eigen::VectorXd& out) const;
265  void getEffortCommand(Eigen::VectorXd& out) const;
266 
270  void getAccelerometer(Eigen::MatrixX3d& out) const;
274  void getGyro(Eigen::MatrixX3d& out) const;
275 };
276 
277 } // namespace hebi
A list of Feedback objects that can be received from a Group of modules; the size() must match the nu...
Definition: group_feedback.hpp:18
Eigen::VectorXd getVelocity() const
Convenience function for returning feedback velocity values.
Definition: group_feedback.cpp:158
Eigen::MatrixX3d getGyro() const
Convenience function for returning feedback gyroscope values.
Definition: group_feedback.cpp:217
GroupFeedback subview(std::vector< int > indices) const
Creates a "subview" of this group feedback object, with shared access to a subset of the Feedback ele...
Definition: group_feedback.cpp:24
Eigen::VectorXd getDeflection() const
Convenience function for returning feedback deflection values.
Definition: group_feedback.cpp:84
Eigen::VectorXd getVelocityCommand() const
Convenience function for returning commanded velocity values.
Definition: group_feedback.cpp:183
Eigen::VectorXd getMotorCurrent() const
Convenience function for returning feedback motor current values.
Definition: group_feedback.cpp:108
Eigen::VectorXd getBoardTemperature() const
Convenience function for returning feedback board temperature values.
Definition: group_feedback.cpp:59
Definition: arm.cpp:10
Eigen::VectorXd getPosition() const
Convenience function for returning feedback position values.
Definition: group_feedback.cpp:150
Eigen::VectorXd getEffort() const
Convenience function for returning feedback effort values.
Definition: group_feedback.cpp:166
Eigen::VectorXd getMotorWindingTemperature() const
Convenience function for returning feedback motor winding temperature values.
Definition: group_feedback.cpp:133
double getTime() const
Gets a single wall-clock timestamp (in seconds since the epoch) associated with the entire group feed...
Definition: group_feedback.cpp:36
Eigen::MatrixX3d getAccelerometer() const
Convenience function for returning feedback accelerometer values.
Definition: group_feedback.cpp:200
Feedback objects have various fields representing feedback from modules; which fields are populated d...
Definition: feedback.hpp:32
~GroupFeedback() noexcept=default
Destructor cleans up group feedback object as necessary.
Eigen::VectorXd getEffortCommand() const
Convenience function for returning commanded effort values.
Definition: group_feedback.cpp:191
Eigen::VectorXd getVoltage() const
Convenience function for returning feedback voltage values.
Definition: group_feedback.cpp:75
const Feedback & operator[](size_t index) const
Access the feedback for an individual module.
Definition: group_feedback.cpp:34
Eigen::VectorXd getMotorHousingTemperature() const
Convenience function for returning feedback motor housing temperature values.
Definition: group_feedback.cpp:141
uint64_t getTimeUs() const
Gets a single wall-clock timestamp (in microseconds since the epoch) associated with the entire group...
Definition: group_feedback.cpp:48
size_t size() const
Returns the number of module feedbacks in this group feedback.
Definition: group_feedback.cpp:32
Eigen::VectorXd getPositionCommand() const
Convenience function for returning commanded position values.
Definition: group_feedback.cpp:175
bool isSubview() const
Was this created as a subview of another GroupFeedback?
Definition: group_feedback.hpp:84
Eigen::VectorXd getProcessorTemperature() const
Convenience function for returning feedback processor temperature values.
Definition: group_feedback.cpp:67
Eigen::VectorXd getMotorWindingCurrent() const
Convenience function for returning feedback motor winding current values.
Definition: group_feedback.cpp:124
Eigen::VectorXd getMotorVelocity() const
Convenience function for returning feedback motor velocity values.
Definition: group_feedback.cpp:100
Eigen::VectorXd getDeflectionVelocity() const
Convenience function for returning feedback deflection velocity values.
Definition: group_feedback.cpp:92
Eigen::VectorXd getMotorSensorTemperature() const
Convenience function for returning feedback motor sensor temperature values.
Definition: group_feedback.cpp:116