Flexiv RDK APIs  2.1
device.hpp
Go to the documentation of this file.
1 
6 #ifndef FLEXIV_RDK_DEVICE_HPP_
7 #define FLEXIV_RDK_DEVICE_HPP_
8 
9 #include "robot.hpp"
10 #include <map>
11 
12 namespace flexiv::rdk {
13 
14 using DeviceParamDataTypes
15  = std::variant<int, double, std::string, std::vector<double>, std::vector<std::string>>;
16 
21 class Device
22 {
23 public:
29  Device(const Robot& robot);
30  virtual ~Device();
31 
36  std::vector<std::string> list() const;
37 
43  bool exist(const std::string& name) const;
44 
52  bool enabled(const std::string& name) const;
53 
61  bool connected(const std::string& name) const;
62 
73  std::map<std::string, DeviceParamDataTypes> params(const std::string& name) const;
74 
82  void Enable(const std::string& name);
83 
91  void Disable(const std::string& name);
92 
104  void Command(const std::string& name,
105  const std::map<std::string, std::variant<bool, int, double>>& commands);
106 
107 private:
108  class Impl;
109  std::unique_ptr<Impl> pimpl_;
110 };
111 
112 } /* namespace flexiv::rdk */
113 
114 #endif /* FLEXIV_RDK_DEVICE_HPP_ */
Interface to control the peripheral device(s) connected to the robot.
Definition: device.hpp:22
void Enable(const std::string &name)
[Blocking] Enable the specified device.
void Command(const std::string &name, const std::map< std::string, std::variant< bool, int, double >> &commands)
[Blocking] Send command(s) to the specified device.
std::vector< std::string > list() const
[Non-blocking] A list of all existing devices.
Device(const Robot &robot)
[Non-blocking] Instantiate the device control interface.
bool connected(const std::string &name) const
[Blocking] Whether the specified device is connected.
std::map< std::string, DeviceParamDataTypes > params(const std::string &name) const
[Blocking] Configuration parameters of the specified device.
void Disable(const std::string &name)
[Blocking] Disable the specified device.
bool enabled(const std::string &name) const
[Blocking] Whether the specified device is enabled.
bool exist(const std::string &name) const
[Non-blocking] Whether the specified device already exists.
Main interface to control the robot, containing several function categories and background services.
Definition: robot.hpp:24