Franky 1.1.0
A High-Level Motion API for Franka
Loading...
Searching...
No Matches
gripper.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <franka/exception.h>
4#include <franka/gripper.h>
5
6#include <future>
7
8namespace franky {
9
13struct GripperException : public std::runtime_error {
14 using std::runtime_error::runtime_error;
15};
16
21class Gripper : public franka::Gripper {
22 public:
23 explicit Gripper(const std::string &franka_address) : franka::Gripper(franka_address) {}
24
25 Gripper(Gripper &&gripper) noexcept : franka::Gripper(std::move(gripper)) {}
26
40 std::shared_future<bool> graspAsync(
41 double width, double speed, double force, double epsilon_inner = 0.005, double epsilon_outer = 0.005);
42
50 std::shared_future<bool> moveAsync(double width, double speed);
51
57 bool open(double speed);
58
65 std::shared_future<bool> openAsync(double speed);
66
72 std::shared_future<bool> homingAsync();
73
79 std::shared_future<bool> stopAsync();
80
84 [[nodiscard]] inline double width() const { return state().width; }
85
89 [[nodiscard]] inline bool is_grasped() const { return state().is_grasped; }
90
94 [[nodiscard]] inline double max_width() const { return state().max_width; }
95
99 [[nodiscard]] inline franka::GripperState state() const { return readOnce(); }
100
101 private:
102 std::shared_future<bool> current_future_;
103
104 std::shared_future<bool> setCurrentFuture(std::future<bool> future);
105};
106
107} // namespace franky
A wrapper around the franka::Gripper class that adds asynchronous functionality.
Definition gripper.hpp:21
double width() const
Current opening width of the gripper [m].
Definition gripper.hpp:84
std::shared_future< bool > graspAsync(double width, double speed, double force, double epsilon_inner=0.005, double epsilon_outer=0.005)
Asynchronous variant of the franka::Gripper::grasp function.
Definition gripper.cpp:4
double max_width() const
Maximum width of the gripper [m].
Definition gripper.hpp:94
bool open(double speed)
Opens the gripper fully.
Definition gripper.cpp:14
bool is_grasped() const
Whether the gripper is grasping.
Definition gripper.hpp:89
std::shared_future< bool > moveAsync(double width, double speed)
Asynchronous variant of the franka::Gripper::move function.
Definition gripper.cpp:10
std::shared_future< bool > openAsync(double speed)
Asynchronous variant of the open function.
Definition gripper.cpp:16
std::shared_future< bool > stopAsync()
Asynchronous variant of the franka::Gripper::stop function.
Definition gripper.cpp:24
franka::GripperState state() const
Current gripper state.
Definition gripper.hpp:99
Gripper(Gripper &&gripper) noexcept
Definition gripper.hpp:25
Gripper(const std::string &franka_address)
Definition gripper.hpp:23
std::shared_future< bool > homingAsync()
Asynchronous variant of the franka::Gripper::homing function.
Definition gripper.cpp:20
Definition dynamics_limit.cpp:8
Exception thrown by the gripper class.
Definition gripper.hpp:13