36 commands_[i].actuator().position().set(position[i]);
42 commands_[i].actuator().velocity().set(static_cast<float>(velocity[i]));
48 commands_[i].actuator().effort().set(static_cast<float>(effort[i]));
55 commands_[i].settings().actuator().springConstant().set(static_cast<float>(springConstant[i]));
61 const auto& cmd =
commands_[i].actuator().position();
62 res[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
69 const auto& cmd =
commands_[i].actuator().velocity();
70 res[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
77 const auto& cmd =
commands_[i].actuator().effort();
78 res[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
85 const auto& cmd =
commands_[i].settings().actuator().springConstant();
86 res[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
97 const auto& cmd =
commands_[i].actuator().position();
98 out[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
107 const auto& cmd =
commands_[i].actuator().velocity();
108 out[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
117 const auto& cmd =
commands_[i].actuator().effort();
118 out[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
127 const auto& cmd =
commands_[i].settings().actuator().springConstant();
128 out[i] = (cmd) ? cmd.get() : std::numeric_limits<float>::quiet_NaN();
GroupCommand(size_t number_of_modules)
Create a group command with the specified number of modules.
HebiStatusCode hebiGroupCommandReadGains(HebiGroupCommandPtr command, const char *file)
Import gains from a file into a GroupCommand object.
Eigen::VectorXd getPosition() const
Convenience function for returning commanded position values.
Command objects have various fields that can be set; when sent to the module, these fields control in...
bool writeGains(const std::string &file) const
Export the gains from this GroupCommand object into a file, creating it as necessary.
~GroupCommand() noexcept
Destructor cleans up group command object as necessary.
Eigen::VectorXd getSpringConstant() const
Convenience function for returning commanded spring constant values.
Eigen::VectorXd getEffort() const
Convenience function for returning commanded effort values.
HebiGroupCommandPtr hebiGroupCommandCreate(size_t size)
Creates a GroupCommand for a group with the specified number of modules.
void hebiGroupCommandClear(HebiGroupCommandPtr command)
Clears all data in the GroupCommand object.
size_t size() const
Returns the number of module commands in this group command.
HebiCommandPtr hebiGroupCommandGetModuleCommand(HebiGroupCommandPtr command, size_t module_index)
Get an individual command for a particular module at index module_index.
const size_t number_of_modules_
void hebiGroupCommandRelease(HebiGroupCommandPtr command)
Frees resources created by the GroupCommand object.
bool readGains(const std::string &file)
Import the gains from a file into this GroupCommand object.
Command & operator[](size_t index)
Access the command for an individual module.
HebiGroupCommandPtr internal_
std::vector< Command > commands_
void setVelocity(const Eigen::VectorXd &velocity)
Convenience function for setting velocity commands from Eigen vectors.
HebiStatusCode hebiGroupCommandWriteGains(HebiGroupCommandPtr command, const char *file)
Export gains from a GroupCommand object into a file.
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.
void clear()
Clears all data in this GroupCommand object; this returns to the state the GroupCommand was at time o...
Eigen::VectorXd getVelocity() const
Convenience function for returning commanded velocity values.