7 number_of_modules_(number_of_modules)
49 commands_[i].actuator().position().set(position[i]);
56 commands_[i].actuator().velocity().set(static_cast<float>(velocity[i]));
63 commands_[i].actuator().effort().set(static_cast<float>(effort[i]));
71 commands_[i].settings().actuator().springConstant().set(static_cast<float>(springConstant[i]));
80 res[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
90 res[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
100 res[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
109 const auto&
cmd =
commands_[i].settings().actuator().springConstant();
110 res[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
125 out[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
138 out[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
151 out[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
163 const auto&
cmd =
commands_[i].settings().actuator().springConstant();
164 out[i] = (
cmd) ?
cmd.get() : std::numeric_limits<float>::quiet_NaN();
HebiStatusCode hebiGroupCommandWriteGains(HebiGroupCommandPtr cmd, const char *file)
Export gains from a GroupCommand object into a file.
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...
Eigen::VectorXd getVelocity() const
Convenience function for returning commanded velocity values.
~GroupCommand() noexcept
Destructor cleans up group command object as necessary.
HebiGroupCommandPtr hebiGroupCommandCreate(size_t size)
Creates a GroupCommand for a group with the specified number of modules.
size_t size() const
Returns the number of module commands in this group command.
const size_t number_of_modules_
HebiCommandPtr hebiGroupCommandGetModuleCommand(HebiGroupCommandPtr cmd, size_t module_index)
Get an individual command for a particular module at index module_index.
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.
HebiStatusCode hebiGroupCommandReadGains(HebiGroupCommandPtr cmd, const char *file)
Import gains from a file into a 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.
void hebiGroupCommandRelease(HebiGroupCommandPtr cmd)
Frees resources created by the GroupCommand object.
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.