Franky  0.9.1
A High-Level Motion API for Franka
gripper.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <future>
4 
5 #include <franka/exception.h>
6 #include <franka/gripper.h>
7 
8 namespace franky {
9 
13 struct GripperException : public std::runtime_error {
14  using std::runtime_error::runtime_error;
15 };
16 
20 class Gripper : public franka::Gripper {
21  public:
22  explicit Gripper(const std::string &franka_address) : franka::Gripper(franka_address) {}
23 
24  Gripper(Gripper &&gripper) noexcept: franka::Gripper(std::move(gripper)) {}
25 
39  std::future<bool> graspAsync(
40  double width, double speed, double force, double epsilon_inner = 0.005, double epsilon_outer = 0.005) const;
41 
48  std::future<bool> moveAsync(double width, double speed) const;
49 
55  bool open(double speed);
56 
63  std::future<bool> openAsync(double speed);
64 
69  std::future<bool> homingAsync();
70 
75  std::future<bool> stopAsync();
76 
80  [[nodiscard]] inline double width() const {
81  return state().width;
82  }
83 
87  [[nodiscard]] inline bool is_grasped() const {
88  return state().is_grasped;
89  }
90 
94  [[nodiscard]] inline double max_width() const {
95  return state().max_width;
96  }
97 
101  [[nodiscard]] inline franka::GripperState state() const {
102  return readOnce();
103  }
104 
105 };
106 
107 } // namespace franky
A wrapper around the franka::Gripper class that adds asynchronous functionality.
Definition: gripper.hpp:20
double width() const
Current opening width of the gripper [m].
Definition: gripper.hpp:80
std::future< bool > moveAsync(double width, double speed) const
Asynchronous variant of the franka::Gripper::move function.
Definition: gripper.cpp:10
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:87
std::future< bool > graspAsync(double width, double speed, double force, double epsilon_inner=0.005, double epsilon_outer=0.005) const
Asynchronous variant of the franka::Gripper::grasp function.
Definition: gripper.cpp:5
std::future< bool > openAsync(double speed)
Asynchronous variant of the open function.
Definition: gripper.cpp:18
std::future< bool > homingAsync()
Asynchronous variant of the franka::Gripper::homing function.
Definition: gripper.cpp:22
std::future< bool > stopAsync()
Asynchronous variant of the franka::Gripper::stop function.
Definition: gripper.cpp:26
franka::GripperState state() const
Current gripper state.
Definition: gripper.hpp:101
Gripper(Gripper &&gripper) noexcept
Definition: gripper.hpp:24
Gripper(const std::string &franka_address)
Definition: gripper.hpp:22
Definition: gripper.cpp:3
Exception thrown by the gripper class.
Definition: gripper.hpp:13