Class Gripper
Defined in File gripper.h
Class Documentation
-
class Gripper
Maintains a network connection to the gripper, provides the current gripper state, and allows the execution of commands.
Note
The members of this class are threadsafe.
Public Types
-
using ServerVersion = uint16_t
Version of the gripper server.
Public Functions
-
explicit Gripper(const std::string &franka_address)
Establishes a connection with a gripper connected to a robot.
- Parameters:
franka_address – [in] IP/hostname of the robot the gripper is connected to.
- Throws:
NetworkException – if the connection is unsuccessful.
IncompatibleVersionException – if this version of
libfranka
is not supported.
-
Gripper(Gripper &&gripper) noexcept
Move-constructs a new Gripper instance.
- Parameters:
gripper – [in] Other Gripper instance.
-
~Gripper() noexcept
Closes the connection.
-
bool homing() const
Performs homing of the gripper.
After changing the gripper fingers, a homing needs to be done. This is needed to estimate the maximum grasping width.
See also
GripperState for the maximum grasping width.
- Throws:
CommandException – if an error occurred.
NetworkException – if the connection is lost, e.g. after a timeout.
- Returns:
True if command was successful, false otherwise.
-
bool grasp(double width, double speed, double force, double epsilon_inner = 0.005, double epsilon_outer = 0.005) const
Grasps an object.
An object is considered grasped if the distance
between the gripper fingers satisfies .- Parameters:
width – [in] Size of the object to grasp in
.speed – [in] Closing speed in
.force – [in] Grasping force in
.epsilon_inner – [in] Maximum tolerated deviation when the actual grasped width is smaller than the commanded grasp width.
epsilon_outer – [in] Maximum tolerated deviation when the actual grasped width is larger than the commanded grasp width.
- Throws:
CommandException – if an error occurred.
NetworkException – if the connection is lost, e.g. after a timeout.
- Returns:
True if an object has been grasped, false otherwise.
-
bool move(double width, double speed) const
Moves the gripper fingers to a specified width.
- Parameters:
width – [in] Intended opening width in
.speed – [in] Closing speed in
.
- Throws:
CommandException – if an error occurred.
NetworkException – if the connection is lost, e.g. after a timeout.
- Returns:
True if command was successful, false otherwise.
-
bool stop() const
Stops a currently running gripper move or grasp.
- Throws:
CommandException – if an error occurred.
NetworkException – if the connection is lost, e.g. after a timeout.
- Returns:
True if command was successful, false otherwise.
-
GripperState readOnce() const
Waits for a gripper state update and returns it.
- Throws:
NetworkException – if the connection is lost, e.g. after a timeout.
InvalidOperationException – if another readOnce is already running.
- Returns:
Current gripper state.
-
ServerVersion serverVersion() const noexcept
Returns the software version reported by the connected server.
- Returns:
Software version of the connected server.
-
using ServerVersion = uint16_t