Skip to content

Commit

Permalink
Merge pull request #26 from aock/humble
Browse files Browse the repository at this point in the history
ROS2 - Humble
  • Loading branch information
mklpiening authored Nov 17, 2023
2 parents b93b1c1 + c6fd189 commit 1be1c64
Show file tree
Hide file tree
Showing 76 changed files with 4,180 additions and 3,052 deletions.
64 changes: 46 additions & 18 deletions hdf5_map_io/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,76 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.8)
project(hdf5_map_io)

set(CMAKE_CXX_STANDARD 14)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(catkin REQUIRED)
# DEFAULT RELEASE
if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(LVR2 REQUIRED)
find_package(MPI)
find_package(PkgConfig REQUIRED)

catkin_package(
INCLUDE_DIRS include
LIBRARIES hdf5_map_io
DEPENDS LVR2 MPI
)

# HighFive
set(HIGHFIVE_EXAMPLES FALSE)
set(HIGHFIVE_UNIT_TESTS FALSE)

find_library(LVR2_LIBRARY NAMES lvr2)


include_directories(
include
${LVR2_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME}
add_library(${PROJECT_NAME} SHARED
src/hdf5_map_io.cpp
)

find_library(LVR2_LIBRARY NAMES lvr2)
target_include_directories(${PROJECT_NAME} PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PUBLIC
${LVR2_LIBRARY}
${MPI_CXX_LIBRARIES}
rclcpp::rclcpp
)

target_compile_definitions(${PROJECT_NAME} PRIVATE "HDF5_MAP_IO_BUILDING_DLL")

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/
DESTINATION include
)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
ament_export_include_directories("include/${PROJECT_NAME}")
ament_export_libraries(${PROJECT_NAME})

# Export modern CMake targets
ament_export_targets(export_${PROJECT_NAME})

ament_export_dependencies(
rclcpp
)

ament_package()
12 changes: 10 additions & 2 deletions hdf5_map_io/package.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<package format="2">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>hdf5_map_io</name>
<version>1.1.0</version>
<description>The hdf5_map_io package</description>
Expand All @@ -8,8 +9,15 @@
<url type="website">http://wiki.ros.org/ros_mesh_tools/hdf5_map_io</url>
<author email="spuetz@uos.de">Sebastian Pütz</author>

<buildtool_depend>catkin</buildtool_depend>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>boost</depend>
<depend>lvr2</depend>

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

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
100 changes: 66 additions & 34 deletions label_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,84 @@
cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.8)
project(label_manager)

find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
genmsg
mesh_msgs
message_generation
roscpp
sensor_msgs
std_msgs
tf
)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

add_service_files(FILES
DeleteLabel.srv
GetLabelGroups.srv
GetLabeledClusterGroup.srv
)
find_package(ament_cmake REQUIRED)

generate_messages(DEPENDENCIES
mesh_msgs
std_msgs

find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(actionlib_msgs REQUIRED)
find_package(mesh_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)

find_package(Boost COMPONENTS
system
filesystem
)

catkin_package(
CATKIN_DEPENDS
actionlib actionlib_msgs genmsg mesh_msgs message_generation message_runtime roscpp sensor_msgs std_msgs tf

rosidl_generate_interfaces(${PROJECT_NAME}
"srv/DeleteLabel.srv"
"srv/GetLabelGroups.srv"
"srv/GetLabeledClusterGroup.srv"
DEPENDENCIES
mesh_msgs
std_msgs
ADD_LINTER_TESTS
)


include_directories(
include ${catkin_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
include
)


add_executable(${PROJECT_NAME}
add_executable(${PROJECT_NAME}_node
src/manager.cpp
src/manager_node.cpp)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}

add_dependencies(${PROJECT_NAME}_node
${PROJECT_NAME}
)

target_link_libraries(${PROJECT_NAME}_node
Boost::system
Boost::filesystem
)

ament_target_dependencies(${PROJECT_NAME}_node
rclcpp
rclcpp_action
rclcpp_components
actionlib_msgs
mesh_msgs
sensor_msgs
std_msgs
)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
install(TARGETS ${PROJECT_NAME}_node
ARCHIVE DESTINATION lib/${PROJECT_NAME}
LIBRARY DESTINATION lib/${PROJECT_NAME}
RUNTIME DESTINATION bin/${PROJECT_NAME}
)

rosidl_get_typesupport_target(cpp_typesupport_target
${PROJECT_NAME} "rosidl_typesupport_cpp")
target_link_libraries(${PROJECT_NAME}_node
"${cpp_typesupport_target}")


ament_export_dependencies(rosidl_default_runtime)
ament_package()

65 changes: 41 additions & 24 deletions label_manager/include/label_manager/manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,63 @@
#define LABEL_MANAGER_H_

#include <vector>
#include <chrono>
#include <functional>
#include <memory>
#include <string>

#include "mesh_msgs/msg/mesh_face_cluster_stamped.hpp"
#include "mesh_msgs/srv/get_labeled_clusters.hpp"
#include "label_manager/srv/get_label_groups.hpp"
#include "label_manager/srv/get_labeled_cluster_group.hpp"
#include "label_manager/srv/delete_label.hpp"

#include "rclcpp/rclcpp.hpp"

#include <ros/ros.h>
#include <mesh_msgs/MeshFaceClusterStamped.h>
#include <mesh_msgs/GetLabeledClusters.h>
#include <label_manager/GetLabelGroups.h>
#include <label_manager/GetLabeledClusterGroup.h>
#include <label_manager/DeleteLabel.h>

namespace label_manager
{

class LabelManager
class LabelManager : public rclcpp::Node
{
public:
LabelManager(ros::NodeHandle& nodeHandle);
LabelManager(std::string handle_str = "");

private:
ros::NodeHandle nh;
ros::Subscriber clusterLabelSub;
ros::Publisher newClusterLabelPub;
ros::ServiceServer srv_get_labeled_clusters;
ros::ServiceServer srv_get_label_groups;
ros::ServiceServer srv_get_labeled_cluster_group;
ros::ServiceServer srv_delete_label;
// Subscriber
rclcpp::Subscription<mesh_msgs::msg::MeshFaceClusterStamped>::SharedPtr
clusterLabelSub;

// Publisher
rclcpp::Publisher<mesh_msgs::msg::MeshFaceCluster>::SharedPtr
newClusterLabelPub;

// Service (Servers)
rclcpp::Service<mesh_msgs::srv::GetLabeledClusters>::SharedPtr
srv_get_labeled_clusters;
rclcpp::Service<label_manager::srv::GetLabelGroups>::SharedPtr
srv_get_label_groups;
rclcpp::Service<label_manager::srv::GetLabeledClusterGroup>::SharedPtr
srv_get_labeled_cluster_group;
rclcpp::Service<label_manager::srv::DeleteLabel>::SharedPtr
srv_delete_label;

std::string folderPath;

void clusterLabelCallback(const mesh_msgs::MeshFaceClusterStamped::ConstPtr& msg);
void clusterLabelCallback(const mesh_msgs::msg::MeshFaceClusterStamped& msg);

bool service_getLabeledClusters(
mesh_msgs::GetLabeledClusters::Request& req,
mesh_msgs::GetLabeledClusters::Response& res);
const std::shared_ptr<mesh_msgs::srv::GetLabeledClusters::Request> req,
std::shared_ptr<mesh_msgs::srv::GetLabeledClusters::Response> res);
bool service_getLabelGroups(
label_manager::GetLabelGroups::Request& req,
label_manager::GetLabelGroups::Response& res);
const std::shared_ptr<label_manager::srv::GetLabelGroups::Request> req,
std::shared_ptr<label_manager::srv::GetLabelGroups::Response> res);
bool service_getLabeledClusterGroup(
label_manager::GetLabeledClusterGroup::Request& req,
label_manager::GetLabeledClusterGroup::Response& res);
const std::shared_ptr<label_manager::srv::GetLabeledClusterGroup::Request> req,
std::shared_ptr<label_manager::srv::GetLabeledClusterGroup::Response> res);
bool service_deleteLabel(
label_manager::DeleteLabel::Request& req,
label_manager::DeleteLabel::Response& res);
const std::shared_ptr<label_manager::srv::DeleteLabel::Request> req,
std::shared_ptr<label_manager::srv::DeleteLabel::Response> res);

bool writeIndicesToFile(const std::string& fileName, const std::vector<uint>& indices, const bool append);
std::vector<uint> readIndicesFromFile(const std::string& fileName);
Expand Down
50 changes: 24 additions & 26 deletions label_manager/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<package>
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>label_manager</name>
<description>
Serving and persisting label information
</description>
<version>1.1.0</version>
<description>Serving and persisting label information</description>
<maintainer email="spuetz@uos.de">Sebastian Pütz</maintainer>

<url type="website">http://wiki.ros.org/ros_mesh_tools/label_manager</url>
Expand All @@ -13,27 +13,25 @@

<license>BSD-3</license>

<build_depend>actionlib_msgs</build_depend>
<build_depend>actionlib</build_depend>
<build_depend>genmsg</build_depend>
<build_depend>mesh_msgs</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>tf</build_depend>

<run_depend>actionlib_msgs</run_depend>
<run_depend>actionlib</run_depend>
<run_depend>genmsg</run_depend>
<run_depend>mesh_msgs</run_depend>
<run_depend>message_generation</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>tf</run_depend>

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

<depend>rclcpp</depend>
<depend>rclcpp_action</depend>
<depend>rclcpp_components</depend>
<depend>actionlib_msgs</depend>
<depend>mesh_msgs</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>


<exec_depend>rosidl_default_runtime</exec_depend>

<test_depend>ament_lint_common</test_depend>

<member_of_group>rosidl_interface_packages</member_of_group>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading

0 comments on commit 1be1c64

Please sign in to comment.