Flexiv RDK APIs  1.7.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 
40  std::map<std::string, bool> list() const;
41 
49  bool exist(const std::string& name) const;
50 
61  std::map<std::string, DeviceParamDataTypes> params(const std::string& name) const;
62 
70  void Enable(const std::string& name);
71 
79  void Disable(const std::string& name);
80 
92  void Command(const std::string& name,
93  const std::map<std::string, std::variant<bool, int, double>>& commands);
94 
95 private:
96  class Impl;
97  std::unique_ptr<Impl> pimpl_;
98 };
99 
100 } /* namespace rdk */
101 } /* namespace flexiv */
102 
103 #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.
Device(const Robot &robot)
[Non-blocking] Instantiate the device control interface.
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.
std::map< std::string, bool > list() const
[Blocking] A list of existing devices and their status (enabled/disabled).
bool exist(const std::string &name) const
[Blocking] Whether the specified device already exists.
Main interface to control the robot, containing several function categories and background services.
Definition: robot.hpp:25