group_command.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "hebi.h"
4 #include "Eigen/Eigen"
5 #include "command.hpp"
6 #include <vector>
7 
8 namespace hebi {
9 
14 class GroupCommand final
15 {
16  public:
17  #ifndef DOXYGEN_OMIT_INTERNAL
18 
23  #endif // DOXYGEN_OMIT_INTERNAL
24 
25  private:
29  const size_t number_of_modules_;
33  std::vector<Command> commands_;
34 
35  public:
39  GroupCommand(size_t number_of_modules);
40 
44  ~GroupCommand() noexcept; /* annotating specified destructor as noexcept is best-practice */
45 
49  size_t size() const;
50 
54  Command& operator[](size_t index);
55 
59  const Command& operator[](size_t index) const;
60 
65  bool readGains(const std::string& file);
66 
71  bool writeGains(const std::string& file) const;
72 
79  void setPosition(const Eigen::VectorXd& position);
86  void setVelocity(const Eigen::VectorXd& velocity);
93  void setEffort(const Eigen::VectorXd& effort);
100  void setSpringConstant(const Eigen::VectorXd& springConstant);
101 
105  Eigen::VectorXd getPosition() const;
109  Eigen::VectorXd getVelocity() const;
113  Eigen::VectorXd getEffort() const;
117  Eigen::VectorXd getSpringConstant() const;
118 
122  void getPosition(Eigen::VectorXd& out) const;
126  void getVelocity(Eigen::VectorXd& out) const;
130  void getEffort(Eigen::VectorXd& out) const;
134  void getSpringConstant(Eigen::VectorXd& out) const;
135 
136 };
137 
138 } // namespace hebi
GroupCommand(size_t number_of_modules)
Create a group command with the specified number of modules.
Command objects have various fields that can be set; when sent to the module, these fields control in...
Definition: command.hpp:30
Definition: color.hpp:5
Definition: LDLT.h:16
Eigen::VectorXd getVelocity() const
Convenience function for returning commanded velocity values.
~GroupCommand() noexcept
Destructor cleans up group command object as necessary.
size_t size() const
Returns the number of module commands in this group command.
const size_t number_of_modules_
Eigen::VectorXd getSpringConstant() const
Convenience function for returning commanded spring constant values.
Eigen::VectorXd getPosition() const
Convenience function for returning commanded position values.
Eigen::VectorXd getEffort() const
Convenience function for returning commanded effort values.
bool readGains(const std::string &file)
Import the gains from a file into this GroupCommand object.
A list of Command objects appropriate for sending to a Group of modules; the size() must match the nu...
HebiGroupCommandPtr internal_
std::vector< Command > commands_
bool writeGains(const std::string &file) const
Export the gains from this GroupCommand object into a file, creating it as necessary.
void setVelocity(const Eigen::VectorXd &velocity)
Convenience function for setting velocity commands from Eigen vectors.
void setSpringConstant(const Eigen::VectorXd &springConstant)
Convenience function for setting spring constant commands from Eigen vectors.
void setPosition(const Eigen::VectorXd &position)
Convenience function for setting position commands from Eigen vectors.
void setEffort(const Eigen::VectorXd &effort)
Convenience function for setting effort commands from Eigen vectors.
struct _HebiGroupCommand * HebiGroupCommandPtr
The C-style&#39;s API representation of a group command.
Definition: hebi.h:338


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:08:14