group_info.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 
5 #include <vector>
6 
7 #include "Eigen/Eigen"
8 #include "info.hpp"
9 
10 namespace hebi {
11 
16 class GroupInfo final {
17 public:
18 #ifndef DOXYGEN_OMIT_INTERNAL
19 
24 #endif // DOXYGEN_OMIT_INTERNAL
25 
26 private:
30  const size_t number_of_modules_;
34  std::vector<Info> infos_;
35 
36 public:
40  GroupInfo(size_t number_of_modules);
41 
45  ~GroupInfo() noexcept; /* annotating specified destructor as noexcept is best-practice */
46 
50  size_t size() const;
51 
55  const Info& operator[](size_t index) const;
56 
61  bool writeGains(const std::string& file) const;
62 
67  FunctionCallResult writeSafetyParameters(const std::string& file) const {
68  auto res = hebiGroupInfoWriteSafetyParameters(internal_, file.c_str()) == HebiStatusSuccess;
69  if (res) {
70  return FunctionCallResult{true};
71  }
72  return FunctionCallResult{false, std::string{hebiSafetyParametersGetLastError()}};
73  }
74 
78  Eigen::VectorXd getSpringConstant() const;
79 
83  void getSpringConstant(Eigen::VectorXd& out) const;
84 };
85 
86 } // namespace hebi
A list of Info objects that can be received from a Group of modules; the size() must match the number...
Definition: group_info.hpp:16
size_t size() const
Returns the number of module infos in this group info.
Definition: group_info.cpp:16
struct HebiGroupInfo_ * HebiGroupInfoPtr
The C-style&#39;s API representation of a info object for a group of modules.
Definition: hebi.h:485
Definition: arm.cpp:5
Info objects have various fields representing the module state; which fields are populated depends on...
Definition: info.hpp:33
GroupInfo(size_t number_of_modules)
Create a group info with the specified number of modules.
Definition: group_info.cpp:5
bool writeGains(const std::string &file) const
Export the gains from this GroupInfo object into a file, creating it as necessary.
Definition: group_info.cpp:20
Used as a return.
Definition: util.hpp:28
Eigen::VectorXd getSpringConstant() const
Convenience function for returning spring constant values.
Definition: group_info.cpp:24
~GroupInfo() noexcept
Destructor cleans up group info object as necessary.
Definition: group_info.cpp:11
std::vector< Info > infos_
Definition: group_info.hpp:34
HebiGroupInfoPtr internal_
Definition: group_info.hpp:23
const char * hebiSafetyParametersGetLastError(void)
Misc Functions.
HebiStatusCode hebiGroupInfoWriteSafetyParameters(HebiGroupInfoPtr info, const char *file)
Export safety parameters from a GroupInfo object into a file.
const size_t number_of_modules_
Definition: group_info.hpp:30
FunctionCallResult writeSafetyParameters(const std::string &file) const
Export the safety parameters from this GroupInfo object into a file, creating it as necessary...
Definition: group_info.hpp:67


hebi_cpp_api_ros
Author(s): Chris Bollinger , Matthew Tesch
autogenerated on Thu May 28 2020 03:14:44