libfranka  0.8.0
FCI C++ API
Public Types | Public Member Functions | List of all members
franka::Gripper Class Reference

Maintains a network connection to the gripper, provides the current gripper state, and allows the execution of commands. More...

#include <gripper.h>

Public Types

using ServerVersion = uint16_t
 Version of the gripper server.
 

Public Member Functions

 Gripper (const std::string &franka_address)
 Establishes a connection with a gripper connected to a robot. More...
 
 Gripper (Gripper &&gripper) noexcept
 Move-constructs a new Gripper instance. More...
 
Gripperoperator= (Gripper &&gripper) noexcept
 Move-assigns this Gripper from another Gripper instance. More...
 
 ~Gripper () noexcept
 Closes the connection.
 
bool homing () const
 Performs homing of the gripper. More...
 
bool grasp (double width, double speed, double force, double epsilon_inner=0.005, double epsilon_outer=0.005) const
 Grasps an object. More...
 
bool move (double width, double speed) const
 Moves the gripper fingers to a specified width. More...
 
bool stop () const
 Stops a currently running gripper move or grasp. More...
 
GripperState readOnce () const
 Waits for a gripper state update and returns it. More...
 
ServerVersion serverVersion () const noexcept
 Returns the software version reported by the connected server. More...
 

Detailed Description

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.
Examples:
grasp_object.cpp.

Constructor & Destructor Documentation

◆ Gripper() [1/2]

franka::Gripper::Gripper ( const std::string &  franka_address)
explicit

Establishes a connection with a gripper connected to a robot.

Parameters
[in]franka_addressIP/hostname of the robot the gripper is connected to.
Exceptions
NetworkExceptionif the connection is unsuccessful.
IncompatibleVersionExceptionif this version of libfranka is not supported.

◆ Gripper() [2/2]

franka::Gripper::Gripper ( Gripper &&  gripper)
noexcept

Move-constructs a new Gripper instance.

Parameters
[in]gripperOther Gripper instance.

Member Function Documentation

◆ grasp()

bool franka::Gripper::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 \(d\) between the gripper fingers satisfies \((\text{width} - \text{epsilon_inner}) < d < (\text{width} + \text{epsilon_outer})\).

Parameters
[in]widthSize of the object to grasp. [m]
[in]speedClosing speed. [m/s]
[in]forceGrasping force. [N]
[in]epsilon_innerMaximum tolerated deviation when the actual grasped width is smaller than the commanded grasp width.
[in]epsilon_outerMaximum tolerated deviation when the actual grasped width is larger than the commanded grasp width.
Returns
True if an object has been grasped, false otherwise.
Exceptions
CommandExceptionif an error occurred.
NetworkExceptionif the connection is lost, e.g. after a timeout.
Examples:
grasp_object.cpp.

◆ homing()

bool franka::Gripper::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.

Returns
True if command was successful, false otherwise.
Exceptions
CommandExceptionif an error occurred.
NetworkExceptionif the connection is lost, e.g. after a timeout.
See also
GripperState for the maximum grasping width.
Examples:
grasp_object.cpp.

◆ move()

bool franka::Gripper::move ( double  width,
double  speed 
) const

Moves the gripper fingers to a specified width.

Parameters
[in]widthIntended opening width. [m]
[in]speedClosing speed. [m/s]
Returns
True if command was successful, false otherwise.
Exceptions
CommandExceptionif an error occurred.
NetworkExceptionif the connection is lost, e.g. after a timeout.

◆ operator=()

Gripper& franka::Gripper::operator= ( Gripper &&  gripper)
noexcept

Move-assigns this Gripper from another Gripper instance.

Parameters
[in]gripperOther Gripper instance.
Returns
Model instance.

◆ readOnce()

GripperState franka::Gripper::readOnce ( ) const

Waits for a gripper state update and returns it.

Returns
Current gripper state.
Exceptions
NetworkExceptionif the connection is lost, e.g. after a timeout.
InvalidOperationExceptionif another readOnce is already running.
Examples:
grasp_object.cpp.

◆ serverVersion()

ServerVersion franka::Gripper::serverVersion ( ) const
noexcept

Returns the software version reported by the connected server.

Returns
Software version of the connected server.

◆ stop()

bool franka::Gripper::stop ( ) const

Stops a currently running gripper move or grasp.

Returns
True if command was successful, false otherwise.
Exceptions
CommandExceptionif an error occurred.
NetworkExceptionif the connection is lost, e.g. after a timeout.
Examples:
grasp_object.cpp.

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