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]))
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) { }
87 std::shared_ptr<hebi::Group> group_;
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);
void setCommand(size_t index, double value) override
Definition: end_effector.hpp:131
static std::unique_ptr< EffortEndEffector > create(const std::vector< std::string > &families, const std::vector< std::string > &names)
Definition: end_effector.hpp:120
A list of Feedback objects that can be received from a Group of modules; the size() must match the nu...
Definition: group_feedback.hpp:18
bool loadGains(const std::string &gains_file)
Definition: end_effector.hpp:62
EndEffectorBase()=default
static std::unique_ptr< EffortEndEffector > create(const std::string &family, const std::string &name)
Definition: end_effector.hpp:115
virtual void setCommand(size_t index, double value)=0
bool update(Eigen::VectorXd &aux_state) override
Definition: end_effector.hpp:34
virtual bool send()
Definition: end_effector.hpp:18
static std::shared_ptr< hebi::Group > getGroup(const std::vector< std::string > &families, const std::vector< std::string > &names)
Definition: end_effector.hpp:74
EndEffector(std::shared_ptr< hebi::Group > group)
Definition: end_effector.hpp:82
Definition: end_effector.hpp:111
hebi::GroupCommand command_
Definition: end_effector.hpp:84
A list of Command objects appropriate for sending to a Group of modules; the size() must match the nu...
Definition: group_command.hpp:19
bool send() override
Definition: end_effector.hpp:54
Maintains a registry of network-connected modules and returns Group objects to the user.
Definition: lookup.hpp:24
Definition: end_effector.hpp:12
virtual bool update(Eigen::VectorXd &aux_state)
Definition: end_effector.hpp:16
Eigen::VectorXd getState()
Definition: end_effector.hpp:126
Definition: end_effector.hpp:25
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.
Definition: lookup.cpp:27