Bioscara
DALSA's DIY SCARA Robot Arm.
Loading...
Searching...
No Matches
gripper_hardware.hpp
Go to the documentation of this file.
1// Copyright 2023 ros2_control Development Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GRIPPER_HARDWARE_HPP_
16#define GRIPPER_HARDWARE_HPP_
17
18#include <memory>
19#include <string>
20#include <vector>
21#include <set>
22#include <unordered_map>
23#include <memory>
24#include <limits>
25
28
29#include "hardware_interface/handle.hpp"
30#include "hardware_interface/hardware_info.hpp"
31#include "hardware_interface/system_interface.hpp"
32#include "hardware_interface/types/hardware_interface_return_values.hpp"
33#include "rclcpp/macros.hpp"
34#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
35#include "rclcpp_lifecycle/state.hpp"
36
38{
39
46 class BioscaraGripperHardwareInterface : public hardware_interface::SystemInterface
47 {
48 public:
49 RCLCPP_SHARED_PTR_DEFINITIONS(BioscaraGripperHardwareInterface)
50
51 hardware_interface::CallbackReturn on_init(
52 const hardware_interface::HardwareComponentInterfaceParams &params) override;
53
62 hardware_interface::CallbackReturn on_shutdown(
63 const rclcpp_lifecycle::State &previous_state) override;
64
71 hardware_interface::CallbackReturn on_configure(
72 const rclcpp_lifecycle::State &previous_state) override;
73
80 hardware_interface::CallbackReturn on_cleanup(
81 const rclcpp_lifecycle::State &previous_state) override;
82
91 hardware_interface::CallbackReturn on_activate(
92 const rclcpp_lifecycle::State &previous_state) override;
93
102 hardware_interface::CallbackReturn on_deactivate(
103 const rclcpp_lifecycle::State &previous_state) override;
104
114 hardware_interface::return_type read(
115 const rclcpp::Time &time,
116 const rclcpp::Duration &period) override;
117
127 hardware_interface::return_type write(
128 const rclcpp::Time &time,
129 const rclcpp::Duration &period) override;
130
153 hardware_interface::CallbackReturn on_error(
154 const rclcpp_lifecycle::State &previous_state) override;
155
156 private:
164 {
165 float reduction = 1;
166 float offset = 0;
167 float min;
168 float max;
169 float init_pos;
170 };
171
178 std::unique_ptr<bioscara_hardware_drivers::BaseGripper> _gripper;
179
185
186 float _last_pos = std::numeric_limits<double>::quiet_NaN();
187 float _vel = std::numeric_limits<double>::quiet_NaN();
188 };
189
190} // namespace bioscara_hardware_interfaces
191
192#endif // GRIPPER_HARDWARE_HPP_
The bioscara gripper hardware interface class.
Definition gripper_hardware.hpp:47
hardware_interface::return_type write(const rclcpp::Time &time, const rclcpp::Duration &period) override
Writes commands to the hardware from the command interfaces.
Definition gripper_hardware.cpp:303
hardware_interface::CallbackReturn on_activate(const rclcpp_lifecycle::State &previous_state) override
Called on the transistion from the inactive to the active state.
Definition gripper_hardware.cpp:211
hardware_interface::return_type read(const rclcpp::Time &time, const rclcpp::Duration &period) override
Reads from the hardware and populates the state interfaces.
Definition gripper_hardware.cpp:271
hardware_interface::CallbackReturn on_error(const rclcpp_lifecycle::State &previous_state) override
Called when an error in any state or state transition is thrown.
Definition gripper_hardware.cpp:331
hardware_interface::CallbackReturn on_shutdown(const rclcpp_lifecycle::State &previous_state) override
Called on the transistion from the inactive, unconfigured and active to the finalized state.
Definition gripper_hardware.cpp:137
hardware_interface::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &previous_state) override
Called on the transistion from the inactive to the unconfigured state.
Definition gripper_hardware.cpp:192
hardware_interface::CallbackReturn on_init(const hardware_interface::HardwareComponentInterfaceParams &params) override
Definition gripper_hardware.cpp:27
float _last_pos
Definition gripper_hardware.hpp:186
gripper_config_t _gripper_cfg
configuration struct of the gripper.
Definition gripper_hardware.hpp:184
hardware_interface::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &previous_state) override
Called on the transistion from the active to the inactive state.
Definition gripper_hardware.cpp:252
hardware_interface::CallbackReturn on_configure(const rclcpp_lifecycle::State &previous_state) override
Called on the transistion from the unconfigured to the inactive state.
Definition gripper_hardware.cpp:163
std::unique_ptr< bioscara_hardware_drivers::BaseGripper > _gripper
Smart pointer to the local BaseGripper.
Definition gripper_hardware.hpp:178
File containing the Gripper class.
File containing the MockGripper class.
Definition arm_hardware.hpp:38
configuration structure holding the passed paramters from the ros2_control urdf
Definition gripper_hardware.hpp:164