Flexiv AIDK APIs  1.2
aidk.hpp
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #include <memory>
11 
12 #include "flexiv/ai/defs.hpp"
13 
14 namespace flexiv {
15 namespace ai {
16 
17 class AIDKImpl;
18 
20 {
21 public:
28  AIDKClient(const std::string ip, float request_timeout);
29 
33  ~AIDKClient();
34 
40  bool is_ready() const noexcept;
41 
47  AIStatus get_current_state() const noexcept;
48 
64  bool detect(const std::string obj_name, const std::string camera_id,
65  const int coordinate_id = 1,
66  const std::vector<double> &camera_pose = {0.0, 0.0, 0.0, 1.0,
67  0.0, 0.0, 0.0},
68  const std::vector<double> &tcp_pose = {0.0, 0.0, 0.0, 1.0, 0.0,
69  0.0, 0.0},
70  const std::vector<double> &tcp_force = {0.0, 0.0, 0.0, 0.0, 0.0,
71  0.0},
72  const std::string command = "CUSTOM",
73  const std::string custom = "");
74 
93  bool detect_with_image(
94  const std::string obj_name, const std::string camera_id,
95  const int coordinate_id = 1,
96  const std::vector<double> &camera_pose = {0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
97  0.0},
98  const std::vector<double> &camera_intrinsic = {0.0, 0.0, 0.0, 0.0, 0.0,
99  0.0},
100  const std::vector<double> &tcp_pose = {0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
101  0.0},
102  const std::vector<double> &tcp_force = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
103  const std::vector<u_char> &rgb_input = std::vector<u_char>(),
104  const std::vector<u_char> &depth_input = std::vector<u_char>(),
105  const std::string custom = "");
106 
117  bool detect_v1x(const std::string command,
118  const std::vector<double> &camera_pose = {0.0, 0.0, 0.0,
119  1.0, 0.0, 0.0,
120  0.0},
121  const std::vector<double> &tcp_pose = {0.0, 0.0, 0.0, 1.0,
122  0.0, 0.0, 0.0},
123  const std::vector<double> &tcp_force = {0.0, 0.0, 0.0, 0.0,
124  0.0, 0.0});
125 
131  uint64_t get_detected_time() const noexcept;
132 
139  bool reload_configs(const std::string name) const noexcept;
140 
146  bool save_configs() const noexcept;
147 
152  bool warmup() const noexcept;
153 
159  std::vector<std::string> all_direct_command() const noexcept;
160 
166  std::vector<std::string> get_detected_obj_names() const noexcept;
167 
173  std::vector<int> get_detected_obj_nums() const noexcept;
174 
181  int get_detected_obj_num(const std::string &obj_name) const noexcept;
182 
192  bool parse_result(const std::string &obj_name, const std::string &key,
193  int index, std::vector<Result> &result) noexcept;
194 
200  std::vector<float> get_camera_intrinsic() const noexcept;
201 
208  std::tuple<std::string, std::string, std::vector<std::string>>
209  get_runtime_info() const noexcept;
210 
218  std::tuple<std::vector<std::string>, std::vector<std::string>>
219  list_remote_files(const std::string remote_dir) const noexcept;
220 
227  std::tuple<uint64_t, uint32_t>
228  get_file_info(const std::string remote_file_path) const;
229 
238  bool send_file(const std::string local_file_path,
239  const std::string remote_file_path) const;
240 
248  bool receive_file(const std::string remote_file_path,
249  const std::string local_file_path) const noexcept;
250 
257  void send_folder(const std::string local_dir,
258  const std::string remote_dir) const;
259 
266  void receive_folder(const std::string remote_dir,
267  const std::string local_dir) const noexcept;
268 
275  bool remove_path(const std::string remote_file_path) const noexcept;
276 
283  bool make_remote_directory(const std::string remote_dir) const noexcept;
284 
290  std::unordered_map<std::string, value_variant>
292 
300  std::unordered_map<std::string, value_variant> &vars);
301 
302 private:
303  std::unique_ptr<AIDKImpl> pimpl;
304 };
305 
306 } /* namespace ai */
307 } /* namespace flexiv */
flexiv::ai::AIDKClient::get_detected_obj_nums
std::vector< int > get_detected_obj_nums() const noexcept
Function to get all current detect object nums.
flexiv::ai::AIDKClient::reload_configs
bool reload_configs(const std::string name) const noexcept
Reload project config.
flexiv::ai::AIDKClient::all_direct_command
std::vector< std::string > all_direct_command() const noexcept
All direct commands.
flexiv::ai::AIDKClient::AIDKClient
AIDKClient(const std::string ip, float request_timeout)
Constructor of client.
flexiv::ai::AIDKClient::list_remote_files
std::tuple< std::vector< std::string >, std::vector< std::string > > list_remote_files(const std::string remote_dir) const noexcept
List file and dir list under remote directory.
flexiv::ai::AIDKClient::detect_with_image
bool detect_with_image(const std::string obj_name, const std::string camera_id, const int coordinate_id=1, const std::vector< double > &camera_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &camera_intrinsic={0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_force={0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, const std::vector< u_char > &rgb_input=std::vector< u_char >(), const std::vector< u_char > &depth_input=std::vector< u_char >(), const std::string custom="")
Detect request with image input.
flexiv::ai::AIDKClient::make_remote_directory
bool make_remote_directory(const std::string remote_dir) const noexcept
Make directory in remote.
flexiv::ai::AIDKClient::get_file_info
std::tuple< uint64_t, uint32_t > get_file_info(const std::string remote_file_path) const
Function to get remote file info.
flexiv::ai::AIDKClient::send_folder
void send_folder(const std::string local_dir, const std::string remote_dir) const
Copy local folder to remote folder.
flexiv::ai::AIDKClient::get_camera_intrinsic
std::vector< float > get_camera_intrinsic() const noexcept
Function to get camera intrinsic.
flexiv::ai::Response
Definition: defs.hpp:167
flexiv::ai::AIDKClient::parse_result
bool parse_result(const std::string &obj_name, const std::string &key, int index, std::vector< Result > &result) noexcept
Function to parse detection result.
flexiv::ai::AIStatus
Definition: defs.hpp:157
flexiv::ai::AIDKClient::set_direct_setting_variables
Response set_direct_setting_variables(std::unordered_map< std::string, value_variant > &vars)
Set variable.
flexiv::ai::AIDKClient::remove_path
bool remove_path(const std::string remote_file_path) const noexcept
Remove remote files or folders.
flexiv::ai::AIDKClient::detect_v1x
bool detect_v1x(const std::string command, const std::vector< double > &camera_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_force={0.0, 0.0, 0.0, 0.0, 0.0, 0.0})
Detect request V1x.
flexiv::ai::AIDKClient::get_runtime_info
std::tuple< std::string, std::string, std::vector< std::string > > get_runtime_info() const noexcept
Function to get runtime info.
flexiv::ai::AIDKClient::receive_file
bool receive_file(const std::string remote_file_path, const std::string local_file_path) const noexcept
Receive remote file to local file path.
flexiv::ai::AIDKClient
Definition: aidk.hpp:19
flexiv
Definition: aidk.hpp:14
flexiv::ai::AIDKClient::receive_folder
void receive_folder(const std::string remote_dir, const std::string local_dir) const noexcept
Copy remote folder to local folder.
flexiv::ai::AIDKClient::get_detected_obj_num
int get_detected_obj_num(const std::string &obj_name) const noexcept
Function to get detected object number based of object name.
flexiv::ai::AIDKClient::get_current_state
AIStatus get_current_state() const noexcept
Get current AI edge state code.
flexiv::ai::AIDKClient::~AIDKClient
~AIDKClient()
Destructor of client.
flexiv::ai::AIDKClient::warmup
bool warmup() const noexcept
Warmup current project, if configured on NoemaEdge.
flexiv::ai::AIDKClient::get_detected_time
uint64_t get_detected_time() const noexcept
Get timestamp of detect request.
flexiv::ai::AIDKClient::detect
bool detect(const std::string obj_name, const std::string camera_id, const int coordinate_id=1, const std::vector< double > &camera_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_pose={0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}, const std::vector< double > &tcp_force={0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, const std::string command="CUSTOM", const std::string custom="")
Detect request.
flexiv::ai::AIDKClient::is_ready
bool is_ready() const noexcept
Check if AI edge is ready.
flexiv::ai::AIDKClient::get_direct_setting_variables
std::unordered_map< std::string, value_variant > get_direct_setting_variables()
Get settable variables.
defs.hpp
declaration of common constants and function
flexiv::ai::AIDKClient::save_configs
bool save_configs() const noexcept
Save current project config.
flexiv::ai::AIDKClient::send_file
bool send_file(const std::string local_file_path, const std::string remote_file_path) const
Function to send local file to remote file path.
flexiv::ai::AIDKClient::get_detected_obj_names
std::vector< std::string > get_detected_obj_names() const noexcept
Function to get all current detect object names.