Class GroupCommand
Defined in File group_command.hpp
Class Documentation
-
class GroupCommand
A list of Command objects appropriate for sending to a Group of modules; the size() must match the number of modules in the group.
Public Functions
-
GroupCommand(size_t number_of_modules)
Create a group command with the specified number of modules.
-
~GroupCommand() noexcept = default
Destructor cleans up group command object as necessary.
-
GroupCommand(GroupCommand&&) = default
Allows moving result from “subview”.
-
GroupCommand subview(std::vector<int> indices) const
Creates a “subview” of this group command object, with shared access to a subset of the Command elements. Note that certain functions (clear, read/write gains, and read/write safety parameters and not currently supported on subviews)
The indices do not need to remain in order, and do not need to be unique; however, they must each be >= 0 and < size(); otherwise an out_of_range exception is thrown.
-
inline bool isSubview() const
Was this created as a subview of another GroupCommand?
-
size_t size() const
Returns the number of module commands in this group command.
-
void clear()
Clears all data in this GroupCommand object; this returns to the state the GroupCommand was at time of creation.
-
bool readGains(const std::string &file)
Import the gains from a file into this GroupCommand object.
- Parameters:
file – The filename (or path + filename) to the file to read from.
-
bool writeGains(const std::string &file) const
Export the gains from this GroupCommand object into a file, creating it as necessary.
- Parameters:
file – The filename (or path + filename) to the file to write to.
-
inline FunctionCallResult readSafetyParameters(const std::string &file)
Import the safety parameters from a file into this GroupCommand object.
- Parameters:
file – The filename (or path + filename) to the file to read from.
-
inline FunctionCallResult writeSafetyParameters(const std::string &file) const
Export the safety parameters from this GroupCommand object into a file, creating it as necessary.
- Parameters:
file – The filename (or path + filename) to the file to write to.
-
void setPosition(const Eigen::VectorXd &position)
Convenience function for setting position commands from Eigen vectors.
Note that if the vector is not the correct link, no action is taken.
-
void setVelocity(const Eigen::VectorXd &velocity)
Convenience function for setting velocity commands from Eigen vectors.
Note that if the vector is not the correct link, no action is taken.
-
void setEffort(const Eigen::VectorXd &effort)
Convenience function for setting effort commands from Eigen vectors.
Note that if the vector is not the correct link, no action is taken.
-
void setSpringConstant(const Eigen::VectorXd &springConstant)
Convenience function for setting spring constant commands from Eigen vectors.
Note that if the vector is not the correct link, no action is taken.
-
Eigen::VectorXd getPosition() const
Convenience function for returning commanded position values.
-
Eigen::VectorXd getVelocity() const
Convenience function for returning commanded velocity values.
-
Eigen::VectorXd getEffort() const
Convenience function for returning commanded effort values.
-
Eigen::VectorXd getSpringConstant() const
Convenience function for returning commanded spring constant values.
-
void getPosition(Eigen::VectorXd &out) const
Convenience function for returning commanded position values.
-
void getVelocity(Eigen::VectorXd &out) const
Convenience function for returning commanded velocity values.
-
void getEffort(Eigen::VectorXd &out) const
Convenience function for returning commanded effort values.
-
void getSpringConstant(Eigen::VectorXd &out) const
Convenience function for returning commanded spring constant values.
Public Members
-
std::shared_ptr<GroupCommandWrapper> internal_
Light wrapper around C-style group command object. NOTE: this should not be used except by library functions!
-
GroupCommand(size_t number_of_modules)