API
-
class Robot2FG7
Class for interfacing with the OnRobot 2FG7 gripper.
This class provides methods to initialize, control, and retrieve data from the OnRobot 2FG7 gripper.
Public Functions
-
void init(const std::string &address, int port = 502)
Initialize the gripper.
- Parameters:
address – The IP address of the gripper.
port – The port number for communication (default is 502).
-
bool get_state(double &measured_position, double &measured_velocity, double &measured_force, double &target_position, std::chrono::duration<long double> timeout = std::chrono::seconds(-1))
Get the current state of the gripper.
- Parameters:
measured_position – The measured position of the gripper (m).
measured_velocity – The measured velocity of the gripper (m/s).
measured_force – The measured force applied by the gripper (N).
target_position – The target position of the gripper (m).
timeout – Timeout duration (milliseconds) for the operation (default is infinite).
- Returns:
true if the state was successfully retrieved, false otherwise.
-
void set_position(double position)
Set the target position of the gripper.
- Parameters:
position – The target position to set (m).
-
void set_force(double force)
Set the target force of the gripper.
- Parameters:
force – The target force to set (N).
-
double get_min_position()
Get the minimum position limit of the gripper.
- Returns:
The minimum position limit (m).
-
double get_max_position()
Get the maximum position limit of the gripper.
- Returns:
The maximum position limit (m).
-
double get_min_force()
Get the minimum force limit of the gripper.
- Returns:
The minimum force limit (m).
-
double get_max_force()
Get the maximum force limit of the gripper.
- Returns:
The maximum force limit (N).
-
std::string get_serial()
Get the serial number of the gripper.
- Returns:
The serial number as a string.
-
std::string get_firmware()
Get the firmware version of the gripper.
- Returns:
The firmware version as a string.
-
void init(const std::string &address, int port = 502)