Skip to content

Commit 49ab363

Browse files
committed
wip
1 parent a5a884c commit 49ab363

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

robotiq_hande_driver/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ add_executable(hande_driver src/hande_driver.cpp)
1111
target_include_directories(hande_driver PUBLIC
1212
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
1313
$<INSTALL_INTERFACE:include>)
14-
target_compile_features(hande_driver PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
14+
target_compile_features(hande_driver PUBLIC c_std_99 cxx_std_20) # Require C99 and C++17
1515

1616
install(TARGETS hande_driver
1717
DESTINATION lib/${PROJECT_NAME})
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef ROBOTIQ_HANDE_DRIVER__HANDE_HARDWARE_INTERFACE_HPP_
2+
#define ROBOTIQ_HANDE_DRIVER__HANDE_HARDWARE_INTERFACE_HPP_
3+
4+
#include <string>
5+
#include "hardware_interface/system_interface.hpp"
6+
7+
namespace robotiq_hande_driver {
8+
9+
class RobotiqHandeHardwareInterface : public hardware_interface::SystemInterface
10+
{
11+
public:
12+
RobotiqHandeHardwareInterface();
13+
hardware_interface::CallbackReturn on_configure(const rclcpp_lifecycle::State& previous_state) override;
14+
hardware_interface::CallbackReturn on_cleanup(const rclcpp_lifecycle::State& previous_state) override;
15+
hardware_interface::CallbackReturn on_shutdown(const rclcpp_lifecycle::State& previous_state) override;
16+
hardware_interface::CallbackReturn on_activate(const rclcpp_lifecycle::State& previous_state) override;
17+
hardware_interface::CallbackReturn on_deactivate(const rclcpp_lifecycle::State& previous_state) override;
18+
hardware_interface::CallbackReturn on_error(const rclcpp_lifecycle::State& previous_state) override;
19+
20+
hardware_interface::CallbackReturn on_init(const hardware_interface::HardwareInfo& info) override;
21+
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
22+
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
23+
hardware_interface::return_type read(const rclcpp::Time& time, const rclcpp::Duration& period) override;
24+
hardware_interface::return_type write(const rclcpp::Time& time, const rclcpp::Duration& period) override;
25+
26+
private:
27+
//TODO: composition of the modbus communication
28+
std::string tty_port_;
29+
30+
};
31+
32+
}
33+
#endif // ROBOTIQ_HANDE_DRIVER__HANDE_HARDWARE_INTERFACE_HPP_
File renamed without changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "robotiq_hande_driver/hande_hardware_interface.hpp"
2+
#include "rclcpp/rclcpp.hpp"
3+
4+
const auto logger = rclcpp::get_logger("RobotiqHandeHardwareInterface");
5+
6+
namespace robotiq_hande_driver {
7+
8+
RobotiqHandeHardwareInterface::RobotiqHandeHardwareInterface() {}
9+
10+
hardware_interface::CallbackReturn RobotiqHandeHardwareInterface::on_init(const hardware_interface::HardwareInfo& info)
11+
{
12+
if (hardware_interface::SystemInterface::on_init(info) != CallbackReturn::SUCCESS) {
13+
return hardware_interface::CallbackReturn::ERROR;
14+
}
15+
16+
tty_port_ = info_.hardware_parameters["tty"];
17+
18+
//TODO: Initialize modbus communication
19+
20+
RCLCPP_INFO(logger, std::format("Initialized ModbusRTU on {} ", tty_port_));
21+
return hardware_interface::CallbackReturn::SUCCESS;
22+
}
23+
24+
25+
// CallbackReturn::SUCCESS or return CallbackReturn::ERROR
26+
27+
}

0 commit comments

Comments
 (0)