pub struct Gripper { /* private fields */ }Expand description
Maintains a network connection to the gripper, provides the current gripper state, and
allows the execution of commands (port of franka::Gripper).
The underlying Network is Sync (see crate::network::TcpSession and
crate::network::UdpChannel), so the members of this struct are threadsafe, matching
libfranka’s documented guarantee for franka::Gripper – except that only one
Gripper::read_once should be in flight at a time, since concurrent callers would race to
claim the same UDP datagram.
Implementations§
Source§impl Gripper
impl Gripper
Sourcepub fn new(franka_address: &str) -> FrankaResult<Gripper>
pub fn new(franka_address: &str) -> FrankaResult<Gripper>
Establishes a connection with a gripper connected to a robot.
franka_address is the IP/hostname of the robot the gripper is connected to, as
"host" or "host:port"; the gripper command port (1338) is used unless an explicit
port is embedded in the address.
§Errors
Returns FrankaError::Network if the connection is unsuccessful and
FrankaError::IncompatibleVersion if this crate’s gripper protocol version is not
supported by the server.
Sourcepub fn server_version(&self) -> u16
pub fn server_version(&self) -> u16
Returns the software version reported by the connected server.
Sourcepub fn homing(&self) -> FrankaResult<bool>
pub fn homing(&self) -> FrankaResult<bool>
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.
§Errors
Returns FrankaError::Command if the command failed or was aborted, and
FrankaError::Network if the connection is lost, e.g. after a timeout.
See GripperState::max_width for the maximum grasping width.
Sourcepub fn grasp(
&self,
width: f64,
speed: f64,
force: f64,
epsilon_inner: f64,
epsilon_outer: f64,
) -> FrankaResult<bool>
pub fn grasp( &self, width: f64, speed: f64, force: f64, epsilon_inner: f64, epsilon_outer: f64, ) -> FrankaResult<bool>
Grasps an object.
An object is considered grasped if the distance d between the gripper fingers
satisfies (width - epsilon_inner) < d < (width + epsilon_outer).
epsilon_inner and epsilon_outer default to 0.005 in libfranka’s C++ overload; this
port takes both explicitly (there is no default-argument mechanism in a fn).
§Errors
Returns FrankaError::Command if the command failed or was aborted, and
FrankaError::Network if the connection is lost, e.g. after a timeout.
Sourcepub fn move_gripper(&self, width: f64, speed: f64) -> FrankaResult<bool>
pub fn move_gripper(&self, width: f64, speed: f64) -> FrankaResult<bool>
Moves the gripper fingers to a specified width.
§Errors
Returns FrankaError::Command if the command failed or was aborted, and
FrankaError::Network if the connection is lost, e.g. after a timeout.
Sourcepub fn stop(&self) -> FrankaResult<bool>
pub fn stop(&self) -> FrankaResult<bool>
Stops a currently running gripper move or grasp.
§Errors
Returns FrankaError::Command if the command failed or was aborted, and
FrankaError::Network if the connection is lost, e.g. after a timeout.
Sourcepub fn read_once(&self) -> FrankaResult<GripperState>
pub fn read_once(&self) -> FrankaResult<GripperState>
Waits for a gripper state update and returns it.
Port of Gripper::readOnce: first drains every datagram already queued on the UDP
socket (stale data from before this call), then blocks for one fresh state.
§Errors
Returns FrankaError::Network if the connection is lost, e.g. after a timeout.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Gripper
impl RefUnwindSafe for Gripper
impl Send for Gripper
impl Sync for Gripper
impl Unpin for Gripper
impl UnsafeUnpin for Gripper
impl UnwindSafe for Gripper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.