BipedalLocomotion::RobotInterface::YarpRobotControl class

YarpRobotControl Yarp implementation of the IRobotControl interface.

Base classes

class IRobotControl
Robot control interface.

Constructors, destructors, conversion operators

YarpRobotControl()
Constructor.
~YarpRobotControl()
Destructor.

Public functions

auto initialize(std::weak_ptr<ParametersHandler::IParametersHandler> handler) -> bool final
auto setDriver(std::shared_ptr<yarp::dev::PolyDriver> robotDevice) -> bool
Set the driver required to control the robot.
auto checkMotionDone(bool& motionDone, bool& isTimeExpired, std::vector<std::pair<std::string, double>>& info) -> bool final
Check if the motion set through the position control mode ended.
auto setControlMode(const std::vector<IRobotControl::ControlMode>& controlModes) -> bool final
Set the control mode.
auto setControlMode(const IRobotControl::ControlMode& mode) -> bool final
Set the desired control mode.
auto setControlModeAsync(const std::vector<IRobotControl::ControlMode>& controlModes) -> std::future<bool> final
Set the control mode in an asynchronous thread.
auto setControlModeAsync(const IRobotControl::ControlMode& mode) -> std::future<bool> final
Set the desired control mode in an asynchronous thread.
auto setReferences(Eigen::Ref<const Eigen::VectorXd> desiredJointValues, const std::vector<IRobotControl::ControlMode>& controlModes, std::optional<Eigen::Ref<const Eigen::VectorXd>> currentJointValues = {}) -> bool final
Set the desired reference.
auto setReferences(Eigen::Ref<const Eigen::VectorXd> desiredJointValues, const IRobotControl::ControlMode& mode, std::optional<Eigen::Ref<const Eigen::VectorXd>> currentJointValues = {}) -> bool final
Set the desired reference.
auto getJointList() const -> std::vector<std::string> final
Get the list of the controlled joints.
auto getJointLimits(Eigen::Ref<Eigen::VectorXd> lowerLimits, Eigen::Ref<Eigen::VectorXd> upperLimits) const -> bool final
Get the actuated joints limits.
auto isValid() const -> bool final
Check if the class is valid.

Function documentation

bool BipedalLocomotion::RobotInterface::YarpRobotControl::initialize(std::weak_ptr<ParametersHandler::IParametersHandler> handler) final

   Initialize the Interface
   @param handler pointer to a parameter handler interface
   @note the following parameters are required by the class
   |             Parameter name             |   Type   |                                          Description                                         | Mandatory |
   |:--------------------------------------:|:--------:|:--------------------------------------------------------------------------------------------:|:---------:|
   |            `reading_timeout`           |   `int`  |    Timeout used while reading from the YARP interfaces in microseconds. (Positive Number)    |     No    |
   |         `max_reading_attempts`         |   `int`  |      Max number of attempts used for reading from the YARP interfaces. (Positive Number)     |     No    |
   |         `positioning_duration`         | `double` | Duration of the trajectory generated when the joint is controlled in position mode [seconds] |    Yes    |
   |         `positioning_tolerance`        | `double` |                    Max Admissible error for position control joint [rad]                     |    Yes    |
   | `position_direct_max_admissible_error` | `double` |                 Max admissible error for position direct control joint [rad]                 |    Yes    |
   @return True/False in case of success/failure.

clang-format on

bool BipedalLocomotion::RobotInterface::YarpRobotControl::setDriver(std::shared_ptr<yarp::dev::PolyDriver> robotDevice)

Set the driver required to control the robot.

Parameters
robotDevice device used to control the robot.
Returns True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::checkMotionDone(bool& motionDone, bool& isTimeExpired, std::vector<std::pair<std::string, double>>& info) final

Check if the motion set through the position control mode ended.

Parameters
motionDone out true if the motion ended.
isTimeExpired
info out vector containing the list of the joint whose motion did not finish yet.
Returns True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::setControlMode(const std::vector<IRobotControl::ControlMode>& controlModes) final

Set the control mode.

Parameters
controlModes vector containing the control mode for each joint.
Returns True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::setControlMode(const IRobotControl::ControlMode& mode) final

Set the desired control mode.

Returns True/False in case of success/failure.

std::future<bool> BipedalLocomotion::RobotInterface::YarpRobotControl::setControlModeAsync(const std::vector<IRobotControl::ControlMode>& controlModes) final

Set the control mode in an asynchronous thread.

Parameters
controlModes vector containing the control mode for each joint.
Returns An std::future object to a boolean True/False in case of success/failure.

std::future<bool> BipedalLocomotion::RobotInterface::YarpRobotControl::setControlModeAsync(const IRobotControl::ControlMode& mode) final

Set the desired control mode in an asynchronous thread.

Returns An std::future object to a boolean True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::setReferences(Eigen::Ref<const Eigen::VectorXd> desiredJointValues, const std::vector<IRobotControl::ControlMode>& controlModes, std::optional<Eigen::Ref<const Eigen::VectorXd>> currentJointValues = {}) final

Set the desired reference.

Parameters
desiredJointValues desired joint values.
controlModes vector containing the control mode for each joint.
currentJointValues
Returns True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::setReferences(Eigen::Ref<const Eigen::VectorXd> desiredJointValues, const IRobotControl::ControlMode& mode, std::optional<Eigen::Ref<const Eigen::VectorXd>> currentJointValues = {}) final

Set the desired reference.

Parameters
desiredJointValues desired joint values.
mode
currentJointValues
Returns True/False in case of success/failure.

std::vector<std::string> BipedalLocomotion::RobotInterface::YarpRobotControl::getJointList() const final

Get the list of the controlled joints.

Returns A vector containing the name of the controlled joints.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::getJointLimits(Eigen::Ref<Eigen::VectorXd> lowerLimits, Eigen::Ref<Eigen::VectorXd> upperLimits) const final

Get the actuated joints limits.

Parameters
lowerLimits vector to be filled with the lower limits of the actuated joints.
upperLimits vector to be filled with the upper limits of the actuated joints.
Returns True/False in case of success/failure.

bool BipedalLocomotion::RobotInterface::YarpRobotControl::isValid() const final

Check if the class is valid.

Returns True if it is valid, false otherwise.