Skip to content

Commit

Permalink
[WIP] try using libcxx-serial-dev
Browse files Browse the repository at this point in the history
This branch is for testing with `libcxx-serial-dev`
See #21

This may be more out of date than the upstream

Signed-off-by: Alex Moriarty <[email protected]>
  • Loading branch information
moriarty committed Jun 13, 2023
1 parent cf7a883 commit 72d99f2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 0 additions & 2 deletions robotiq_description/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>serial</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down
6 changes: 3 additions & 3 deletions robotiq_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ 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
hardware_interface
pluginlib
rclcpp
rclcpp_lifecycle
serial
cxx-serial
)

add_library(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
#include <string>
#include <vector>

#include <serial/serial.h>
// 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 <serial.h>
#undef HAVE_STDINT_H
#endif

/**
* @brief This class is responsible for communicating with the gripper via a serial port, and maintaining a record of
Expand Down
4 changes: 3 additions & 1 deletion robotiq_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>serial</depend>
<!-- WARNING: cxx-serial is not a valid rosdep key -->
<!-- TODO: either release serial or point cxx-serial to libcxx-serial-dev -->
<depend>cxx-serial</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
9 changes: 8 additions & 1 deletion robotiq_driver/src/hardware_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@
#include "hardware_interface/actuator_interface.hpp"
#include "hardware_interface/types/hardware_interface_type_values.hpp"
#include "rclcpp/rclcpp.hpp"
#include <serial/serial.h>

// 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 <serial.h>
#undef HAVE_STDINT_H
#endif

constexpr uint8_t kGripperMinPos = 3;
constexpr uint8_t kGripperMaxPos = 230;
Expand Down

0 comments on commit 72d99f2

Please sign in to comment.