Interface with the robot device(s).
More...
#include <device.hpp>
|
| Device (const Robot &robot) |
| [Non-blocking] Create an instance and initialize device control interface. More...
|
|
const std::map< std::string, bool > | list () const |
| [Blocking] Get a list of existing devices and their status (enabled/disabled). More...
|
|
bool | exist (const std::string &name) const |
| [Blocking] Whether the specified device already exists. More...
|
|
const std::map< std::string, std::variant< int, double, std::string, std::vector< double >, std::vector< std::string > > > | params (const std::string &name) const |
| [Blocking] Get configuration parameters of the specified device. More...
|
|
void | Enable (const std::string &name) |
| [Blocking] Enable the specified device. More...
|
|
void | Disable (const std::string &name) |
| [Blocking] Disable the specified device. More...
|
|
void | Command (const std::string &name, const std::map< std::string, std::variant< bool, int, double >> &commands) |
| [Blocking] Send command(s) for the specified device. More...
|
|
Interface with the robot device(s).
Definition at line 19 of file device.hpp.
◆ Device()
flexiv::rdk::Device::Device |
( |
const Robot & |
robot | ) |
|
[Non-blocking] Create an instance and initialize device control interface.
- Parameters
-
- Exceptions
-
std::runtime_error | if the initialization sequence failed. |
◆ Command()
void flexiv::rdk::Device::Command |
( |
const std::string & |
name, |
|
|
const std::map< std::string, std::variant< bool, int, double >> & |
commands |
|
) |
| |
[Blocking] Send command(s) for the specified device.
- Parameters
-
[in] | name | Name of the device to send command(s) to, must be an existing device. |
[in] | commands | A map of {command_name, command_value}. For example, {{"setSpeed", 6000}, {"openLaser", true}}. All commands in the map will be sent to the device simultaneously. Make sure the command name(s) are valid and can be accepted by the specified device. |
- Exceptions
-
std::logic_error | if the specified device does not exist or not enabled yet. |
std::runtime_error | if failed to deliver the request to the connected robot. |
- Note
- This function blocks until the request is successfully delivered.
◆ Disable()
void flexiv::rdk::Device::Disable |
( |
const std::string & |
name | ) |
|
[Blocking] Disable the specified device.
- Parameters
-
[in] | name | Name of the device to disable, must be an existing device. |
- Exceptions
-
std::logic_error | if the specified device does not exist. |
std::runtime_error | if failed to deliver the request to the connected robot. |
- Note
- This function blocks until the request is successfully delivered.
◆ Enable()
void flexiv::rdk::Device::Enable |
( |
const std::string & |
name | ) |
|
[Blocking] Enable the specified device.
- Parameters
-
[in] | name | Name of the device to enable, must be an existing device. |
- Exceptions
-
std::logic_error | if the specified device does not exist. |
std::runtime_error | if failed to deliver the request to the connected robot. |
- Note
- This function blocks until the request is successfully delivered.
◆ exist()
bool flexiv::rdk::Device::exist |
( |
const std::string & |
name | ) |
const |
[Blocking] Whether the specified device already exists.
- Parameters
-
[in] | name | Name of the device to check. |
- Returns
- True if the specified device exists.
- Exceptions
-
std::runtime_error | if failed to get a reply from the connected robot. |
- Note
- This function blocks until a reply is received.
◆ list()
const std::map<std::string, bool> flexiv::rdk::Device::list |
( |
| ) |
const |
[Blocking] Get a list of existing devices and their status (enabled/disabled).
- Returns
- A map of {device_name, is_enabled}. For example, {{"Mirka-AIROS-550CV", true}, {"LinearRail", false}}.
- Exceptions
-
std::runtime_error | if failed to get a reply from the connected robot. |
- Note
- This function blocks until a reply is received.
◆ params()
const std::map<std::string, std::variant<int, double, std::string, std::vector<double>, std::vector<std::string> > > flexiv::rdk::Device::params |
( |
const std::string & |
name | ) |
const |
[Blocking] Get configuration parameters of the specified device.
- Parameters
-
[in] | name | Name of the device to get parameters for, must be an existing one. |
- Returns
- A map of {param_name, param_value}. Booleans are represented by int 1 and 0. For example, {{"maxVel", 0.5}, {"absolutePosition", {0.7, -0.4, 0.05}}, {"conveyorName", "conveyor0"}}.
- Exceptions
-
std::logic_error | if the specified device does not exist. |
std::runtime_error | if failed to get a reply from the connected robot. |
- Note
- This function blocks until a reply is received.
The documentation for this class was generated from the following file: