Flexiv AIDK APIs  1.2
Public Member Functions | List of all members
flexiv::ai::AIDKClient Class Reference

#include <aidk.hpp>

Public Member Functions

 AIDKClient (const std::string ip, float request_timeout)
 Constructor of client. More...
 
 ~AIDKClient ()
 Destructor of client. More...
 
bool is_ready () const noexcept
 Check if AI edge is ready. More...
 
AIStatus get_current_state () const noexcept
 Get current AI edge state code. More...
 
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. More...
 
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. More...
 
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. More...
 
uint64_t get_detected_time () const noexcept
 Get timestamp of detect request. More...
 
bool reload_configs (const std::string name) const noexcept
 Reload project config. More...
 
bool save_configs () const noexcept
 Save current project config. More...
 
bool warmup () const noexcept
 Warmup current project, if configured on NoemaEdge. More...
 
std::vector< std::string > all_direct_command () const noexcept
 All direct commands. More...
 
std::vector< std::string > get_detected_obj_names () const noexcept
 Function to get all current detect object names. More...
 
std::vector< int > get_detected_obj_nums () const noexcept
 Function to get all current detect object nums. More...
 
int get_detected_obj_num (const std::string &obj_name) const noexcept
 Function to get detected object number based of object name. More...
 
bool parse_result (const std::string &obj_name, const std::string &key, int index, std::vector< Result > &result) noexcept
 Function to parse detection result. More...
 
std::vector< float > get_camera_intrinsic () const noexcept
 Function to get camera intrinsic. More...
 
std::tuple< std::string, std::string, std::vector< std::string > > get_runtime_info () const noexcept
 Function to get runtime info. More...
 
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. More...
 
std::tuple< uint64_t, uint32_t > get_file_info (const std::string remote_file_path) const
 Function to get remote file info. More...
 
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. More...
 
bool receive_file (const std::string remote_file_path, const std::string local_file_path) const noexcept
 Receive remote file to local file path. More...
 
void send_folder (const std::string local_dir, const std::string remote_dir) const
 Copy local folder to remote folder. More...
 
void receive_folder (const std::string remote_dir, const std::string local_dir) const noexcept
 Copy remote folder to local folder. More...
 
bool remove_path (const std::string remote_file_path) const noexcept
 Remove remote files or folders. More...
 
bool make_remote_directory (const std::string remote_dir) const noexcept
 Make directory in remote. More...
 
std::unordered_map< std::string, value_variantget_direct_setting_variables ()
 Get settable variables. More...
 
Response set_direct_setting_variables (std::unordered_map< std::string, value_variant > &vars)
 Set variable. More...
 

Detailed Description

Examples
test_aidk_compute.cpp, test_aidk_compute_image.cpp, and test_aidk_others.cpp.

Constructor & Destructor Documentation

◆ AIDKClient()

flexiv::ai::AIDKClient::AIDKClient ( const std::string  ip,
float  request_timeout 
)

Constructor of client.

Parameters
ipstring of AI Noema App ip.
request_timeouttimeout of detect request(unit:second).

◆ ~AIDKClient()

flexiv::ai::AIDKClient::~AIDKClient ( )

Destructor of client.

Member Function Documentation

◆ all_direct_command()

std::vector<std::string> flexiv::ai::AIDKClient::all_direct_command ( ) const
noexcept

All direct commands.

Returns
string vector of all direct commands.

◆ detect()

bool flexiv::ai::AIDKClient::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.

Parameters
obj_nameobject name.
camera_idcamera id to use.
coordinate_idresult coordinate space id, 0 for world space, 1 for camera space.
camera_posecamera pose, can be list/ndarray, 7D or 4x4.
tcp_poseoptionally used. Robot tcp pose [x, y, z, qw, qx, qy, qz]
tcp_forceoptionally used. Robot tcp force & wrench. [x, y, z, wx, wy, wx]
commandcommand name, should always be "CUSTOM".
customcustom command.
Returns
success or not of detection request.

◆ detect_v1x()

bool flexiv::ai::AIDKClient::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.

Parameters
commanddirect command name.
camera_posecamera pose, can be list/ndarray, 7D or 4x4.
tcp_poseoptionally used. Robot tcp pose [x, y, z, qw, qx, qy, qz]
tcp_forceoptionally used. Robot tcp force & wrench. [x, y, z, wx, wy, wx]
Returns
success or not of detection request.

◆ detect_with_image()

bool flexiv::ai::AIDKClient::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.

Parameters
obj_nameobject name.
camera_idcamera id to use.
coordinate_idresult coordinate space id, 0 for world space, 1 for camera space.
camera_posecamera pose, can be list/ndarray, 7D or 4x4.
camera_intrinsiccamera intrinsic, vector of width, height, ppx, ppy, fx, fy.
tcp_poseoptionally used. Robot tcp pose [x, y, z, qw, qx, qy, qz]
tcp_forceoptionally used. Robot tcp force & wrench. [x, y, z, wx, wy, wx]
rgb_inputvector of uchar of encoded rgb image.
depth_inputvector of uchar of encoded depth image.
customcustom command.
Returns
success or not of detection request.

◆ get_camera_intrinsic()

std::vector<float> flexiv::ai::AIDKClient::get_camera_intrinsic ( ) const
noexcept

Function to get camera intrinsic.

Returns
vector of fx,fy,cx,cy,depth_scale.

◆ get_current_state()

AIStatus flexiv::ai::AIDKClient::get_current_state ( ) const
noexcept

Get current AI edge state code.

Returns
AIStatus struct.

◆ get_detected_obj_names()

std::vector<std::string> flexiv::ai::AIDKClient::get_detected_obj_names ( ) const
noexcept

Function to get all current detect object names.

Returns
vector of object names.

◆ get_detected_obj_num()

int flexiv::ai::AIDKClient::get_detected_obj_num ( const std::string &  obj_name) const
noexcept

Function to get detected object number based of object name.

Parameters
obj_namestring of object name.
Returns
num.

◆ get_detected_obj_nums()

std::vector<int> flexiv::ai::AIDKClient::get_detected_obj_nums ( ) const
noexcept

Function to get all current detect object nums.

Returns
vector of object nums.

◆ get_detected_time()

uint64_t flexiv::ai::AIDKClient::get_detected_time ( ) const
noexcept

Get timestamp of detect request.

Returns
timestamp in seconds.

◆ get_direct_setting_variables()

std::unordered_map<std::string, value_variant> flexiv::ai::AIDKClient::get_direct_setting_variables ( )

Get settable variables.

Returns
map of variable name and value.

◆ get_file_info()

std::tuple<uint64_t, uint32_t> flexiv::ai::AIDKClient::get_file_info ( const std::string  remote_file_path) const

Function to get remote file info.

Parameters
remote_file_pathstring of remote file path.
Returns
tuple of file modification time and file size.

◆ get_runtime_info()

std::tuple<std::string, std::string, std::vector<std::string> > flexiv::ai::AIDKClient::get_runtime_info ( ) const
noexcept

Function to get runtime info.

Returns
string of working directory, string of binary path, vector of string of supported paths..

◆ is_ready()

bool flexiv::ai::AIDKClient::is_ready ( ) const
noexcept

Check if AI edge is ready.

Returns
true/false.

◆ list_remote_files()

std::tuple<std::vector<std::string>, std::vector<std::string> > flexiv::ai::AIDKClient::list_remote_files ( const std::string  remote_dir) const
noexcept

List file and dir list under remote directory.

Parameters
remote_dirpath string of remote dir.
Returns
tuple of string list of file names and string list of folder names.

◆ make_remote_directory()

bool flexiv::ai::AIDKClient::make_remote_directory ( const std::string  remote_dir) const
noexcept

Make directory in remote.

Parameters
remote_dirpath string of remote dir
Returns
bool.

◆ parse_result()

bool flexiv::ai::AIDKClient::parse_result ( const std::string &  obj_name,
const std::string &  key,
int  index,
std::vector< Result > &  result 
)
noexcept

Function to parse detection result.

Parameters
obj_namestring of object name.
keystring of result key, one of SUPPORTED_KEYS.
indexindexed data or all data, -1 means get all data.
resultvector of struct Result
Returns
true/false.

◆ receive_file()

bool flexiv::ai::AIDKClient::receive_file ( const std::string  remote_file_path,
const std::string  local_file_path 
) const
noexcept

Receive remote file to local file path.

Parameters
remote_file_pathfile path string of remote file path.
local_file_pathstring of local file path.
Returns
bool.

◆ receive_folder()

void flexiv::ai::AIDKClient::receive_folder ( const std::string  remote_dir,
const std::string  local_dir 
) const
noexcept

Copy remote folder to local folder.

Parameters
local_dirstring of local directory
remote_dirstring of remote directory

◆ reload_configs()

bool flexiv::ai::AIDKClient::reload_configs ( const std::string  name) const
noexcept

Reload project config.

Parameters
nameproject name.
Returns
status.

◆ remove_path()

bool flexiv::ai::AIDKClient::remove_path ( const std::string  remote_file_path) const
noexcept

Remove remote files or folders.

Parameters
remote_file_pathpath string of remote file or directory
Returns
bool.

◆ save_configs()

bool flexiv::ai::AIDKClient::save_configs ( ) const
noexcept

Save current project config.

Returns
status.

◆ send_file()

bool flexiv::ai::AIDKClient::send_file ( const std::string  local_file_path,
const std::string  remote_file_path 
) const

Function to send local file to remote file path.

Parameters
local_file_pathstring of local file path.
remote_file_pathstring, must be absolute/relative path rather than single file.
Returns
bool.

◆ send_folder()

void flexiv::ai::AIDKClient::send_folder ( const std::string  local_dir,
const std::string  remote_dir 
) const

Copy local folder to remote folder.

Parameters
local_dirstring of local directory.
remote_dirstring of remote directory.

◆ set_direct_setting_variables()

Response flexiv::ai::AIDKClient::set_direct_setting_variables ( std::unordered_map< std::string, value_variant > &  vars)

Set variable.

Parameters
varsmap of variable name and value
Returns
struct of error code and message.

◆ warmup()

bool flexiv::ai::AIDKClient::warmup ( ) const
noexcept

Warmup current project, if configured on NoemaEdge.

Returns
status.

The documentation for this class was generated from the following file: