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

Interface to manage tools of the robot. All updates take effect immediately without a power cycle. However, the robot must be in IDLE mode when applying changes. More...

#include <tool.hpp>

Public Member Functions

 Tool (const Robot &robot)
 [Non-blocking] Instantiate the robot tool interface. More...
 
std::vector< std::string > list () const
 [Blocking] A list of all configured tools. More...
 
std::string name (JointGroup group) const
 [Blocking] Name of the active tool currently used by the specified joint group. More...
 
bool exist (const std::string &name) const
 [Blocking] Whether the specified tool already exists. More...
 
ToolParams params (JointGroup group) const
 [Blocking] Parameters of the active tool currently used by the specified joint group. More...
 
ToolParams params (const std::string &name) const
 [Blocking] Parameters of the specified tool. More...
 
void Add (const std::string &name, const ToolParams &params)
 [Blocking] Add a new tool with user-specified parameters. More...
 
void Switch (JointGroup group, const std::string &name)
 [Blocking] Switch active tool for the specified joint group. All following operations will default to use this tool. More...
 
void Update (const std::string &name, const ToolParams &params)
 [Blocking] Update the parameters of an existing tool. More...
 
void Remove (const std::string &name)
 [Blocking] Remove an existing tool. More...
 
ToolParams CalibratePayloadParams (bool tool_mounted)
 [Blocking] Calibrate the payload parameters (mass, CoM, and inertia) of a tool. More...
 

Detailed Description

Interface to manage tools of the robot. All updates take effect immediately without a power cycle. However, the robot must be in IDLE mode when applying changes.

Definition at line 40 of file tool.hpp.

Constructor & Destructor Documentation

◆ Tool()

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

[Non-blocking] Instantiate the robot tool interface.

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

Member Function Documentation

◆ Add()

void flexiv::rdk::Tool::Add ( const std::string &  name,
const ToolParams params 
)

[Blocking] Add a new tool with user-specified parameters.

Parameters
[in]nameName of the new tool, must be unique.
[in]paramsParameters of the new tool.
Exceptions
std::invalid_argumentif the specified tool already exists.
std::logic_errorif robot is not in the correct control mode.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
Applicable control modes: IDLE.
This function blocks until the request is successfully delivered.

◆ CalibratePayloadParams()

ToolParams flexiv::rdk::Tool::CalibratePayloadParams ( bool  tool_mounted)

[Blocking] Calibrate the payload parameters (mass, CoM, and inertia) of a tool.

Parameters
[in]tool_mountedWhether the tool to be calibrated is mounted on the robot flange when triggering this calibration process. See details below.
Exceptions
std::logic_errorif robot is not in the correct control mode.
std::runtime_errorif fault occurred during the calibration or failed to get the calibration result.
Note
Applicable control modes: IDLE.
This function blocks until the calibration is finished.
Warning
[tcp_location] in the returned struct will be zeros and should be ignored.
How to properly calibrate the payload parameters of a tool?
  1. Call Switch("Flange") to disable any active tool from the robot software.
  2. Physically mount the tool to be calibrated to robot flange.
  3. Call this function with [tool_mounted] set to TRUE, then wait for completion. If the robot has a force-torque (FT) sensor, then the returned result will be accurate enough and the optional steps can be skipped. If the robot does not have an FT sensor, then the optional steps are recommended to improve accuracy.
  4. (Optional) Physically unmount the tool from robot flange.
  5. (Optional) Call this function again but with [tool_mounted] set to FALSE, then wait for completion.
  6. Review the returned result and call Add() or Update() to apply the calibrated payload parameters to a new or existing tool. Note that [tcp_location] in the returned struct is invalid and cannot be used directly.

◆ exist()

bool flexiv::rdk::Tool::exist ( const std::string &  name) const

[Blocking] Whether the specified tool already exists.

Parameters
[in]nameName of the tool to check.
Returns
True if the specified tool exists.
Exceptions
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ list()

std::vector<std::string> flexiv::rdk::Tool::list ( ) const

[Blocking] A list of all configured tools.

Returns
Tool 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.

◆ name()

std::string flexiv::rdk::Tool::name ( JointGroup  group) const

[Blocking] Name of the active tool currently used by the specified joint group.

Parameters
[in]groupJoint group to get tool name for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted.
Returns
Name of the active tool. Return "Flange" if there's no active tool.
Exceptions
std::invalid_argumentif [group] is not an existing single-arm joint group in the connected robot.
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ params() [1/2]

ToolParams flexiv::rdk::Tool::params ( const std::string &  name) const

[Blocking] Parameters of the specified tool.

Parameters
[in]nameName of the tool to get parameters for, must be an existing one.
Returns
ToolParams data struct.
Exceptions
std::invalid_argumentif the specified tool does not exist.
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ params() [2/2]

ToolParams flexiv::rdk::Tool::params ( JointGroup  group) const

[Blocking] Parameters of the active tool currently used by the specified joint group.

Parameters
[in]groupJoint group to get tool parameters for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted.
Returns
ToolParams data struct.
Exceptions
std::invalid_argumentif [group] is not an existing single-arm joint group in the connected robot.
std::runtime_errorif failed to get a reply from the connected robot.
Note
This function blocks until a reply is received.

◆ Remove()

void flexiv::rdk::Tool::Remove ( const std::string &  name)

[Blocking] Remove an existing tool.

Parameters
[in]nameName of the tool to remove, must be an existing one but cannot be "Flange".
Exceptions
std::invalid_argumentif the specified tool does not exist.
std::logic_errorif robot is not in the correct control mode or trying to remove "Flange".
std::runtime_errorif failed to deliver the request to the connected robot.
Note
Applicable control modes: IDLE.
This function blocks until the request is successfully delivered.

◆ Switch()

void flexiv::rdk::Tool::Switch ( JointGroup  group,
const std::string &  name 
)

[Blocking] Switch active tool for the specified joint group. All following operations will default to use this tool.

Parameters
[in]groupJoint group to switch active tool for. Only existing single-arm joint groups like ARM_1 and ARM_2 are accepted.
[in]nameName of the tool to switch to, must be an existing one.
Exceptions
std::invalid_argumentif [group] is not an existing single-arm joint group in the connected robot.
std::invalid_argumentif the specified tool does not exist.
std::logic_errorif robot is not in the correct control mode.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
Applicable control modes: IDLE.
This function blocks until the request is successfully delivered.

◆ Update()

void flexiv::rdk::Tool::Update ( const std::string &  name,
const ToolParams params 
)

[Blocking] Update the parameters of an existing tool.

Parameters
[in]nameName of the tool to update, must be an existing one.
[in]paramsNew parameters for the specified tool.
Exceptions
std::invalid_argumentif the specified tool does not exist.
std::logic_errorif robot is not in the correct control mode.
std::runtime_errorif failed to deliver the request to the connected robot.
Note
Applicable control modes: IDLE.
This function blocks until the request is successfully delivered.

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