Flexiv RDK APIs  1.8.0
Public Member Functions | List of all members
flexiv::rdk::FileIO Class Reference

Interface to exchange files with the robot. Only certain types of file can be transferred. More...

#include <file_io.hpp>

Public Member Functions

 FileIO (const Robot &robot)
 [Non-blocking] Instantiate the file exchange interface. More...
 
std::vector< std::string > traj_files_list () const
 [Blocking] A list of all trajectory files currently stored in the connected robot. More...
 
std::vector< std::string > projects_list () const
 [Blocking] A list of all user projects currently stored in the connected robot. More...
 
void UploadTrajFile (const std::string &file_dir, const std::string &file_name)
 [Blocking] Upload a local trajectory file (.traj) to the robot. More...
 
std::string DownloadTrajFile (const std::string &file_name)
 [Blocking] Download a trajectory file (.traj) from the robot. More...
 
void DownloadTrajFile (const std::string &file_name, const std::string &save_dir)
 [Blocking] Download a trajectory file (.traj) from the robot and save to the specified directory. More...
 
void UploadProject (const std::string &project_dir)
 [Blocking] Upload a local project to the robot. More...
 
void DownloadProject (const std::string &project_name, const std::string &save_dir)
 [Blocking] Download a project from the robot and save to the specified directory. More...
 

Detailed Description

Interface to exchange files with the robot. Only certain types of file can be transferred.

Definition at line 18 of file file_io.hpp.

Constructor & Destructor Documentation

◆ FileIO()

flexiv::rdk::FileIO::FileIO ( const Robot robot)

[Non-blocking] Instantiate the file exchange interface.

Parameters
[in]robotReference to the instance of flexiv::rdk::Robot.
Exceptions
std::runtime_errorif the initialization sequence failed.

Member Function Documentation

◆ DownloadProject()

void flexiv::rdk::FileIO::DownloadProject ( const std::string &  project_name,
const std::string &  save_dir 
)

[Blocking] Download a project from the robot and save to the specified directory.

Parameters
[in]project_nameFull name of the project to download. E.g. "polish_table".
[in]save_dirRelative or absolute path of the directory to save the downloaded project. E.g. /home/user/Documents/.
Exceptions
std::invalid_argumentif the specified project does not exist.
std::runtime_errorif failed to download or save the project.
std::filesystem::filesystem_errorif failed to create the specified directory.
Note
This function blocks until the project is successfully downloaded.

◆ DownloadTrajFile() [1/2]

std::string flexiv::rdk::FileIO::DownloadTrajFile ( const std::string &  file_name)

[Blocking] Download a trajectory file (.traj) from the robot.

Parameters
[in]file_nameFull name of the trajectory file to download, including the extension. E.g. PolishSpiral.traj.
Returns
String content of the trajectory file.
Exceptions
std::invalid_argumentif the specified file does not exist.
std::runtime_errorif failed to download the file.
Note
This function blocks until the file is successfully downloaded.

◆ DownloadTrajFile() [2/2]

void flexiv::rdk::FileIO::DownloadTrajFile ( const std::string &  file_name,
const std::string &  save_dir 
)

[Blocking] Download a trajectory file (.traj) from the robot and save to the specified directory.

Parameters
[in]file_nameFull name of the trajectory file to download, including the extension. E.g. "PolishSpiral.traj".
[in]save_dirRelative or absolute path of the directory to save the downloaded file. E.g. /home/user/Documents/. Do not include the file name here. The specified directory will be created if not yet exist.
Exceptions
std::invalid_argumentif the specified file does not exist.
std::runtime_errorif failed to download or save the file.
std::filesystem::filesystem_errorif failed to create the specified directory.
Note
This function blocks until the file is successfully downloaded.

◆ projects_list()

std::vector<std::string> flexiv::rdk::FileIO::projects_list ( ) const

[Blocking] A list of all user projects currently stored in the connected robot.

Returns
Project names as a string list.
Exceptions
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ traj_files_list()

std::vector<std::string> flexiv::rdk::FileIO::traj_files_list ( ) const

[Blocking] A list of all trajectory files currently stored in the connected robot.

Returns
Trajectory filenames as a string list.
Exceptions
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ UploadProject()

void flexiv::rdk::FileIO::UploadProject ( const std::string &  project_dir)

[Blocking] Upload a local project to the robot.

Parameters
[in]project_dirRelative or absolute path of the project directory, which should contain a .proj file and a .plan file.
Exceptions
std::invalid_argumentif failed to find the specified directory or the project files are incomplete.
std::logic_errorif robot is not in the correct control mode.
std::length_errorif any of the project files is too large to transfer. Maximum file size is 1 MB.
std::runtime_errorif failed to upload the project.
Note
Applicable control modes: IDLE.
This function blocks until the project is successfully uploaded.
Warning
If the uploaded project was created by Flexiv Elements with a software package version different from the connected robot, the project might not be executable before it's converted to the compatible version.

◆ UploadTrajFile()

void flexiv::rdk::FileIO::UploadTrajFile ( const std::string &  file_dir,
const std::string &  file_name 
)

[Blocking] Upload a local trajectory file (.traj) to the robot.

Parameters
[in]file_dirRelative or absolute path of the directory that contains the file to upload, e.g. /home/user/Documents/. Do not include the file name here.
[in]file_nameFull name of the trajectory file to upload, including the extension. E.g. PolishSpiral.traj. Do not include the directory path here.
Exceptions
std::invalid_argumentif failed to find or load the specified file.
std::length_errorif the file is too large to transfer. Maximum file size is 1 MB.
std::runtime_errorif failed to upload the file.
Note
This function blocks until the file is successfully uploaded.

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