Flexiv RDK APIs  1.5
Public Member Functions | List of all members
flexiv::rdk::Device Class Reference

Interface with the robot device(s). More...

#include <device.hpp>

Public Member Functions

 Device (const Robot &robot)
 [Non-blocking] Create an instance and initialize device control interface. More...
 
const std::map< std::string, bool > list () const
 [Blocking] Request 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...
 
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< int, double >> &cmds)
 [Blocking] Send command(s) for the specified device. More...
 

Detailed Description

Interface with the robot device(s).

Definition at line 19 of file device.hpp.

Constructor & Destructor Documentation

◆ Device()

flexiv::rdk::Device::Device ( const Robot robot)

[Non-blocking] Create an instance and initialize device control interface.

Parameters
[in]robotReference to the instance of flexiv::rdk::Robot.
Exceptions
std::runtime_errorif the initialization sequence failed.

Member Function Documentation

◆ Command()

void flexiv::rdk::Device::Command ( const std::string &  name,
const std::map< std::string, std::variant< int, double >> &  cmds 
)

[Blocking] Send command(s) for the specified device.

Parameters
[in]nameName of the device to send command(s) for, must be an existing device.
[in]cmdsA map of {command_name, command_value}. Use int 1 and 0 to represent booleans. For example, {{"setSpeed", 6000}, {"startMotor", 1}}.
Exceptions
std::logic_errorif the specified device does not exist or not enabled yet.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
This function blocks until the request is successfully delivered.
Warning
Commanding a disabled or nonexistent device will trigger an error on the robot.

◆ Disable()

void flexiv::rdk::Device::Disable ( const std::string &  name)

[Blocking] Disable the specified device.

Parameters
[in]nameName of the device to disable, must be an existing device.
Exceptions
std::logic_errorif the specified device does not exist.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
This function blocks until the request is successfully delivered.
Warning
Disabling a nonexistent device will trigger an error on the connected robot.

◆ Enable()

void flexiv::rdk::Device::Enable ( const std::string &  name)

[Blocking] Enable the specified device.

Parameters
[in]nameName of the device to enable, must be an existing device.
Exceptions
std::logic_errorif the specified device does not exist.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
This function blocks until the request is successfully delivered.
Warning
Enabling a nonexistent device will trigger an error on the connected robot.

◆ exist()

bool flexiv::rdk::Device::exist ( const std::string &  name) const

[Blocking] Whether the specified device already exists.

Parameters
[in]nameName of the device to check.
Returns
True if the specified device exists.
Exceptions
std::runtime_errorif 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] Request 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_errorif 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: