Flexiv RDK APIs  1.9.0
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 {
13 namespace rdk {
14 
15 using DeviceParamDataTypes
16  = std::variant<int, double, std::string, std::vector<double>, std::vector<std::string>>;
17 
22 class Device
23 {
24 public:
30  Device(const Robot& robot);
31  virtual ~Device();
32 
37  std::vector<std::string> list() const;
38 
44  bool exist(const std::string& name) const;
45 
53  bool enabled(const std::string& name) const;
54 
62  bool connected(const std::string& name) const;
63 
74  std::map<std::string, DeviceParamDataTypes> params(const std::string& name) const;
75 
83  void Enable(const std::string& name);
84 
92  void Disable(const std::string& name);
93 
105  void Command(const std::string& name,
106  const std::map<std::string, std::variant<bool, int, double>>& commands);
107 
108 private:
109  class Impl;
110  std::unique_ptr<Impl> pimpl_;
111 };
112 
113 } /* namespace rdk */
114 } /* namespace flexiv */
115 
116 #endif /* FLEXIV_RDK_DEVICE_HPP_ */
Interface to control the peripheral device(s) connected to the robot.
Definition: device.hpp:23
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:25