From 72d99f21add505a4fc49bac060bf2b0f0a7fe048 Mon Sep 17 00:00:00 2001 From: Alex Moriarty Date: Tue, 13 Jun 2023 14:06:57 -0300 Subject: [PATCH] [WIP] try using libcxx-serial-dev This branch is for testing with `libcxx-serial-dev` See https://github.com/PickNikRobotics/ros2_robotiq_gripper/issues/21 This may be more out of date than the upstream Signed-off-by: Alex Moriarty --- robotiq_description/package.xml | 2 -- robotiq_driver/CMakeLists.txt | 6 +++--- .../include/robotiq_driver/robotiq_gripper_interface.hpp | 8 +++++++- robotiq_driver/package.xml | 4 +++- robotiq_driver/src/hardware_interface.cpp | 9 ++++++++- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/robotiq_description/package.xml b/robotiq_description/package.xml index 3bc3a67..ee1ebec 100644 --- a/robotiq_description/package.xml +++ b/robotiq_description/package.xml @@ -9,8 +9,6 @@ ament_cmake - serial - ament_lint_auto ament_lint_common diff --git a/robotiq_driver/CMakeLists.txt b/robotiq_driver/CMakeLists.txt index b89d558..e9ffba9 100644 --- a/robotiq_driver/CMakeLists.txt +++ b/robotiq_driver/CMakeLists.txt @@ -12,7 +12,7 @@ find_package(hardware_interface REQUIRED) find_package(pluginlib REQUIRED) find_package(rclcpp REQUIRED) find_package(rclcpp_lifecycle REQUIRED) -find_package(serial REQUIRED) +find_package(cxx-serial REQUIRED) set(THIS_PACKAGE_INCLUDE_DEPENDS ament_cmake @@ -20,7 +20,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS pluginlib rclcpp rclcpp_lifecycle - serial + cxx-serial ) add_library( @@ -46,7 +46,7 @@ pluginlib_export_plugin_description_file(hardware_interface hardware_interface_p add_executable(gripper_interface_test src/gripper_interface_test.cpp) target_include_directories(gripper_interface_test PRIVATE include) -ament_target_dependencies(gripper_interface_test serial) +ament_target_dependencies(gripper_interface_test cxx-serial) target_link_libraries(gripper_interface_test ${PROJECT_NAME}) # INSTALL diff --git a/robotiq_driver/include/robotiq_driver/robotiq_gripper_interface.hpp b/robotiq_driver/include/robotiq_driver/robotiq_gripper_interface.hpp index 8fef23c..006f6d0 100644 --- a/robotiq_driver/include/robotiq_driver/robotiq_gripper_interface.hpp +++ b/robotiq_driver/include/robotiq_driver/robotiq_gripper_interface.hpp @@ -31,7 +31,13 @@ #include #include -#include +// define this HAVE_STDINT_H to work with headers installed from libcxx-serial-dev +// Possible bug or missing CMake configuration +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H +#include +#undef HAVE_STDINT_H +#endif /** * @brief This class is responsible for communicating with the gripper via a serial port, and maintaining a record of diff --git a/robotiq_driver/package.xml b/robotiq_driver/package.xml index ff40513..c054119 100644 --- a/robotiq_driver/package.xml +++ b/robotiq_driver/package.xml @@ -13,7 +13,9 @@ pluginlib rclcpp rclcpp_lifecycle - serial + + + cxx-serial ament_lint_auto ament_lint_common diff --git a/robotiq_driver/src/hardware_interface.cpp b/robotiq_driver/src/hardware_interface.cpp index 60baa70..844d40b 100644 --- a/robotiq_driver/src/hardware_interface.cpp +++ b/robotiq_driver/src/hardware_interface.cpp @@ -37,7 +37,14 @@ #include "hardware_interface/actuator_interface.hpp" #include "hardware_interface/types/hardware_interface_type_values.hpp" #include "rclcpp/rclcpp.hpp" -#include + +// define this HAVE_STDINT_H to work with headers installed from libcxx-serial-dev +// Possible bug or missing CMake configuration +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H +#include +#undef HAVE_STDINT_H +#endif constexpr uint8_t kGripperMinPos = 3; constexpr uint8_t kGripperMaxPos = 230;