7 namespace experimental {
16 virtual bool update(Eigen::VectorXd& aux_state) {
return true; }
18 virtual bool send() {
return true; }
24 template <
size_t AuxSize>
34 bool update(Eigen::VectorXd& aux_state)
override {
36 auto n = aux_state.size();
37 if (n != AuxSize && n != 0)
41 if (aux_state.size() == AuxSize)
43 for (
size_t i = 0; i < AuxSize; ++i)
45 if (!std::isnan(aux_state[i]))
46 setCommand(i, aux_state[i]);
50 return group_->getNextFeedback(feedback_);
55 return group_->sendCommand(command_);
64 if (!gains_cmd.readGains(gains_file))
67 return group_->sendCommandWithAcknowledgement(gains_cmd);
72 virtual void setCommand(
size_t index,
double value) = 0;
74 static std::shared_ptr<hebi::Group>
getGroup(
const std::vector<std::string>& families,
const std::vector<std::string>& names) {
77 if (!group || group->size() != AuxSize)
82 EndEffector(std::shared_ptr<hebi::Group> group) : command_(AuxSize), group_(group), feedback_(AuxSize) { }
110 template <
size_t AuxSize>
115 static std::unique_ptr<EffortEndEffector>
create(
const std::string& family,
const std::string& name) {
116 return create(std::vector<std::string> { family }, std::vector<std::string> { name });
120 static std::unique_ptr<EffortEndEffector>
create(
const std::vector<std::string>& families,
const std::vector<std::string>& names) {
127 return this->feedback_.getEfforts();
132 this->command_[index].actuator().effort().set(value);
std::shared_ptr< hebi::Group > group_
void setCommand(size_t index, double value) override
static std::unique_ptr< EffortEndEffector > create(const std::vector< std::string > &families, const std::vector< std::string > &names)
A list of Feedback objects that can be received from a Group of modules; the size() must match the nu...
EffortEndEffector(std::shared_ptr< hebi::Group > group)
bool loadGains(const std::string &gains_file)
EndEffectorBase()=default
static std::unique_ptr< EffortEndEffector > create(const std::string &family, const std::string &name)
bool update(Eigen::VectorXd &aux_state) override
static std::shared_ptr< hebi::Group > getGroup(const std::vector< std::string > &families, const std::vector< std::string > &names)
EndEffector(std::shared_ptr< hebi::Group > group)
hebi::GroupCommand command_
A list of Command objects appropriate for sending to a Group of modules; the size() must match the nu...
hebi::GroupFeedback feedback_
Maintains a registry of network-connected modules and returns Group objects to the user...
virtual bool update(Eigen::VectorXd &aux_state)
Eigen::VectorXd getState()
std::shared_ptr< Group > getGroupFromNames(const std::vector< std::string > &families, const std::vector< std::string > &names, int32_t timeout_ms=DEFAULT_TIMEOUT)
Get a group from modules with the given names and families.