Skip to content

Commit

Permalink
Update configuration for the library package
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanscherzinger committed Apr 17, 2024
1 parent e6e6dbb commit f5b8451
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 158 deletions.
136 changes: 19 additions & 117 deletions schunk_egu_egk_gripper_library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(schunk_gripper)
cmake_minimum_required(VERSION 3.22)
project(schunk_egu_egk_gripper_library)

# Set C++ standard to 17 if not set
if(NOT CMAKE_CXX_STANDARD)
Expand All @@ -12,146 +12,48 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

# Find required packages
#find_package(PythonInterp 3.10 REQUIRED)
#find_package(Python3 3.10 REQUIRED)
find_package(ament_cmake REQUIRED)
find_package(ament_index_cpp REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(control_msgs REQUIRED)
find_package(action_msgs REQUIRED)
find_package(rosidl_default_generators)
find_package(rclcpp_components REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(diagnostic_updater REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(CURL REQUIRED)

# Additional include directories
include_directories(
include
${CURL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
)

# Generate ROS interfaces
set(msg_files
"msg/State.msg"
)

set(srv_files
"srv/BrakeTest.srv"
"srv/Acknowledge.srv"
"srv/ChangeIp.srv"
"srv/Stop.srv"
"srv/FastStop.srv"
"srv/GripperInfo.srv"
"srv/Softreset.srv"
"srv/ParameterGet.srv"
"srv/ParameterSet.srv"
"srv/PrepareForShutdown.srv"
"srv/ReleaseForManualMovement.srv"
)
set(action_files
"action/GripWithPositionAndVelocity.action"
"action/GripWithPosition.action"
"action/GripWithVelocity.action"
"action/Grip.action"
"action/MoveToAbsolutePosition.action"
"action/MoveToRelativePosition.action"
"action/ReleaseWorkpiece.action"
)

rosidl_generate_interfaces(${PROJECT_NAME}
${msg_files}
${srv_files}
${action_files}
DEPENDENCIES sensor_msgs control_msgs action_msgs diagnostic_msgs
)

# Export dependencies
ament_export_dependencies(rosidl_default_runtime)
ament_export_include_directories(include)
ament_export_dependencies(sensor_msgs control_msgs action_msgs diagnostic_msgs)

#--------------------------------------------------------------------------------
# Build
#--------------------------------------------------------------------------------

# The driver
add_library(schunk_gripper_driver SHARED
src/schunk_gripper_wrapper.cpp
add_library(${PROJECT_NAME}
SHARED
src/schunk_gripper_lib.cpp
src/communication.cpp
)
target_include_directories(schunk_gripper_driver PUBLIC
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
${CURL_INCLUDE_DIR}
)
target_link_libraries(schunk_gripper_driver
target_link_libraries(${PROJECT_NAME}
${CURL_LIBRARIES}
${cpp_typesupport_target}
)
ament_target_dependencies(schunk_gripper_driver
rclcpp
sensor_msgs
control_msgs
rclcpp_action
rclcpp_components
diagnostic_updater
diagnostic_msgs
)

rosidl_get_typesupport_target(cpp_typesupport_target "${PROJECT_NAME}" "rosidl_typesupport_cpp")
# Register schunk_gripper_driver as a component node
rclcpp_components_register_nodes(schunk_gripper_driver "SchunkGripperNode")

# Example
add_executable(schunk_gripper_example
src/gripper_example.cpp
)
ament_target_dependencies(schunk_gripper_example
rclcpp
sensor_msgs
control_msgs
rclcpp_action
rclcpp_components
diagnostic_updater
diagnostic_msgs
)
target_link_libraries(schunk_gripper_example
"${cpp_typesupport_target}"
schunk_gripper_driver
)

#--------------------------------------------------------------------------------
# Install
#--------------------------------------------------------------------------------
install(TARGETS
schunk_gripper_driver

install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
install(TARGETS
schunk_gripper_example
DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY
include/
DESTINATION include
)
install(DIRECTORY
launch
DESTINATION share/${PROJECT_NAME}/

install(
DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)

#--------------------------------------------------------------------------------
# Test
#--------------------------------------------------------------------------------
if(BUILD_TESTING)
endif()

# Ament package configuration
ament_package()
enable_testing()

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <iomanip>
#include <type_traits>
#include <sstream>
#include <schunk_gripper/json.hpp>
#include <schunk_egu_egk_gripper_library/json.hpp>

//Control double word
#define FAST_STOP 0x01000000
Expand Down Expand Up @@ -400,4 +400,4 @@ inline void AnybusCom::updateSaveData(std::vector<paramtype> &vector, const size
}
}
}
#endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef SCHUNK_GRIPPER_HPP
#define SCHUNK_GRIPPER_HPP

#include "schunk_gripper/communication.hpp"
#include "schunk_egu_egk_gripper_library/communication.hpp"
#include <chrono>
#include <thread>
#include <mutex>
Expand Down Expand Up @@ -97,4 +97,4 @@ inline void Gripper::changeVectorParameter(const char inst[7], std::vector<param
std::string instance = inst;
postParameter(instance, value); //Post
}
#endif
#endif
42 changes: 8 additions & 34 deletions schunk_egu_egk_gripper_library/package.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
<?xml version="1.0"?>

<package format="3">
<name>schunk_gripper</name>
<version>0.0.0</version>
<description>The schunk_gripper package</description>

<name>schunk_egu_egk_gripper_library</name>
<version>1.0.0</version>
<description>Standalone C++ library for Schunk's EGU/EGK grippers</description>
<author>Viktora Krimer</author>
<author>Fabian Reinwald</author>
<maintainer email="[email protected]">Viktoria Krimer</maintainer>

<license>BSD</license>
<license>MIT</license>
<license>curl</license>
<maintainer email="[email protected]">Stefan Scherzinger</maintainer>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>

<depend>ament_index_cpp</depend>
<depend>rclcpp</depend>
<depend>action_msgs</depend>
<depend>control_msgs</depend>
<depend>sensor_msgs</depend>
<depend>diagnostic_msgs</depend>
<depend>diagnostic_updater</depend>
<depend>rclcpp_action</depend>
<depend>rclcpp_components</depend>
<license>todo</license>

<exec_depend>ros2launch</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>

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

<member_of_group>rosidl_interface_packages</member_of_group>

<!-- The export tag contains other, unspecified, tags -->
<buildtool_depend>cmake</buildtool_depend>
<export>
<!-- Other tools can request additional information be placed here -->
<build_type>ament_cmake</build_type>

<build_type>cmake</build_type>
</export>

</package>
4 changes: 2 additions & 2 deletions schunk_egu_egk_gripper_library/src/communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* and posting a ByteString if any action needs to be performed by the gripper.
*/

#include "schunk_gripper/communication.hpp"
#include "schunk_egu_egk_gripper_library/communication.hpp"
//Write server response for storage in the Program
size_t writeCallback(void* contents, size_t size, size_t nmemb, void* userp)
{
Expand Down Expand Up @@ -352,4 +352,4 @@ void AnybusCom::getMetadata(const std::string &instance)
AnybusCom::~AnybusCom()
{
curl_easy_cleanup(curl);
}
}
2 changes: 1 addition & 1 deletion schunk_egu_egk_gripper_library/src/schunk_gripper_lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
*/

#include "schunk_gripper/schunk_gripper_lib.hpp"
#include "schunk_egu_egk_gripper_library/schunk_gripper_lib.hpp"

std::recursive_mutex lock_mutex; //Locks if something is receiving or posting data
//Commands for using in ROS
Expand Down

0 comments on commit f5b8451

Please sign in to comment.