From 61f586814df7bb6bfd8c93e8eaea5ecb3ab685bd Mon Sep 17 00:00:00 2001 From: Kotaro Yoshimoto Date: Tue, 24 Dec 2024 08:28:12 +0900 Subject: [PATCH] consai_visualizer_msgs->crane_visualization_interfaces --- .../consai_visualizer_msgs/CMakeLists.txt | 87 ------------------- crane_visualization_interfaces/CMakeLists.txt | 85 ++++++++++++++++++ .../__init__.py | 0 .../manual_conversions.hpp | 0 .../package.xml | 6 +- .../proto/CMakeLists.txt | 20 ++--- .../proto/ObjectsArray.proto | 2 + .../src/manual_conversions.cpp | 0 8 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 consai_ros2/consai_visualizer_msgs/CMakeLists.txt create mode 100644 crane_visualization_interfaces/CMakeLists.txt rename {consai_ros2/consai_visualizer_msgs/consai_visualizer_msgs => crane_visualization_interfaces/crane_visualization_interfaces}/__init__.py (100%) rename {consai_ros2/consai_visualizer_msgs => crane_visualization_interfaces}/include/consai_visualizer_msgs/manual_conversions.hpp (100%) rename {consai_ros2/consai_visualizer_msgs => crane_visualization_interfaces}/package.xml (84%) rename {consai_ros2/consai_visualizer_msgs => crane_visualization_interfaces}/proto/CMakeLists.txt (53%) rename {consai_ros2/consai_visualizer_msgs => crane_visualization_interfaces}/proto/ObjectsArray.proto (95%) rename {consai_ros2/consai_visualizer_msgs => crane_visualization_interfaces}/src/manual_conversions.cpp (100%) diff --git a/consai_ros2/consai_visualizer_msgs/CMakeLists.txt b/consai_ros2/consai_visualizer_msgs/CMakeLists.txt deleted file mode 100644 index 7f845d29c..000000000 --- a/consai_ros2/consai_visualizer_msgs/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(consai_visualizer_msgs) - -add_compile_options(-g) - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) -find_package(std_msgs REQUIRED) -find_package(builtin_interfaces REQUIRED) -find_package(rclcpp REQUIRED) -find_package(proto2ros REQUIRED) - -find_package(Protobuf REQUIRED) - -add_subdirectory(proto) - -### proto -> ROS msg -proto2ros_generate( - ${PROJECT_NAME}_messages_gen - PROTOS proto/ObjectsArray.proto - IMPORT_DIRS proto - # CONFIG_OVERLAYS config/overlay.yaml - INTERFACES_OUT_VAR ros_messages - PYTHON_OUT_VAR py_sources - CPP_OUT_VAR cpp_sources - INCLUDE_OUT_VAR cpp_include_dir - APPEND_PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}/proto" - DEPENDS ${PROJECT_NAME}_proto_gen -) - -## ROS msg -> C++ / Python -rosidl_generate_interfaces( - ${PROJECT_NAME} ${ros_messages} - DEPENDENCIES builtin_interfaces proto2ros -) -add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_messages_gen) - -## 変換ライブラリ -add_library(${PROJECT_NAME}_conversions SHARED ${cpp_sources} src/manual_conversions.cpp) - -target_include_directories(${PROJECT_NAME}_conversions PUBLIC - "$" - "$" - "$" - "$" -) -rosidl_get_typesupport_target(${PROJECT_NAME}_cpp_msgs ${PROJECT_NAME} "rosidl_typesupport_cpp") -target_link_libraries(${PROJECT_NAME}_conversions - ${${PROJECT_NAME}_cpp_msgs} ${PROJECT_NAME}_proto protobuf::libprotobuf) -ament_target_dependencies(${PROJECT_NAME}_conversions - builtin_interfaces proto2ros rclcpp) - -rosidl_generated_python_package_add( - ${PROJECT_NAME}_additional_modules - MODULES ${proto_py_sources} ${py_sources} - PACKAGES ${PROJECT_NAME} - DESTINATION ${PROJECT_NAME} -) - -# Install generated C++ .pb.h and conversion headers -set(cpp_headers ${cpp_sources} ${proto_cpp_sources}) -list(FILTER cpp_headers INCLUDE REGEX ".*\.(hpp|h)$") -install( - FILES ${cpp_headers} - DESTINATION include/${PROJECT_NAME}/${PROJECT_NAME}/ -) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/proto/ObjectsArray.pb.h - DESTINATION include/${PROJECT_NAME}/ -) - -# Install C++ Protobuf messages and conversion libraries -install( - TARGETS - ${PROJECT_NAME}_proto - ${PROJECT_NAME}_conversions - EXPORT ${PROJECT_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) -ament_export_dependencies(builtin_interfaces proto2ros rclcpp) -ament_export_targets(${PROJECT_NAME}) - -ament_package() diff --git a/crane_visualization_interfaces/CMakeLists.txt b/crane_visualization_interfaces/CMakeLists.txt new file mode 100644 index 000000000..20da29a27 --- /dev/null +++ b/crane_visualization_interfaces/CMakeLists.txt @@ -0,0 +1,85 @@ +cmake_minimum_required(VERSION 3.8) +project(crane_visualization_interfaces) + +add_compile_options(-g) + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(rclcpp REQUIRED) +find_package(proto2ros REQUIRED) + +find_package(Protobuf REQUIRED) + +add_subdirectory(proto) + +### proto -> ROS msg +proto2ros_generate( + ${PROJECT_NAME}_messages_gen + PROTOS proto/ObjectsArray.proto + IMPORT_DIRS proto + INTERFACES_OUT_VAR ros_messages + PYTHON_OUT_VAR py_sources + CPP_OUT_VAR cpp_sources + INCLUDE_OUT_VAR cpp_include_dir + APPEND_PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}/proto" + DEPENDS ${PROJECT_NAME}_proto_gen +) + +## ROS msg -> C++ / Python +rosidl_generate_interfaces( + ${PROJECT_NAME} ${ros_messages} + DEPENDENCIES builtin_interfaces proto2ros +) +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_messages_gen) + +## 変換ライブラリ +add_library(${PROJECT_NAME}_conversions SHARED ${cpp_sources} src/manual_conversions.cpp) +target_include_directories(${PROJECT_NAME}_conversions PUBLIC + "$" + "$" + "$" + "$" +) +rosidl_get_typesupport_target(${PROJECT_NAME}_cpp_msgs ${PROJECT_NAME} "rosidl_typesupport_cpp") +target_link_libraries(${PROJECT_NAME}_conversions + ${${PROJECT_NAME}_cpp_msgs} ${PROJECT_NAME}_proto protobuf::libprotobuf) +ament_target_dependencies(${PROJECT_NAME}_conversions + builtin_interfaces proto2ros rclcpp) + +rosidl_generated_python_package_add( + ${PROJECT_NAME}_additional_modules + MODULES ${proto_py_sources} ${py_sources} + PACKAGES ${PROJECT_NAME} + DESTINATION ${PROJECT_NAME} +) + +# C++ファイルインストール +set(cpp_headers ${cpp_sources} ${proto_cpp_sources}) +list(FILTER cpp_headers INCLUDE REGEX ".*\.(hpp|h)$") +install( + FILES ${cpp_headers} + DESTINATION include/${PROJECT_NAME}/${PROJECT_NAME}/ +) + +#install( +# FILES ${CMAKE_CURRENT_BINARY_DIR}/proto/ObjectsArray.pb.h +# DESTINATION include/${PROJECT_NAME}/ +#) + +# ライブラリインストール +install( + TARGETS + ${PROJECT_NAME}_proto + ${PROJECT_NAME}_conversions + EXPORT ${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) +ament_export_dependencies(builtin_interfaces proto2ros rclcpp) +ament_export_targets(${PROJECT_NAME}) + +ament_package() diff --git a/consai_ros2/consai_visualizer_msgs/consai_visualizer_msgs/__init__.py b/crane_visualization_interfaces/crane_visualization_interfaces/__init__.py similarity index 100% rename from consai_ros2/consai_visualizer_msgs/consai_visualizer_msgs/__init__.py rename to crane_visualization_interfaces/crane_visualization_interfaces/__init__.py diff --git a/consai_ros2/consai_visualizer_msgs/include/consai_visualizer_msgs/manual_conversions.hpp b/crane_visualization_interfaces/include/consai_visualizer_msgs/manual_conversions.hpp similarity index 100% rename from consai_ros2/consai_visualizer_msgs/include/consai_visualizer_msgs/manual_conversions.hpp rename to crane_visualization_interfaces/include/consai_visualizer_msgs/manual_conversions.hpp diff --git a/consai_ros2/consai_visualizer_msgs/package.xml b/crane_visualization_interfaces/package.xml similarity index 84% rename from consai_ros2/consai_visualizer_msgs/package.xml rename to crane_visualization_interfaces/package.xml index 43f49508f..a11c84c86 100644 --- a/consai_ros2/consai_visualizer_msgs/package.xml +++ b/crane_visualization_interfaces/package.xml @@ -1,11 +1,11 @@ - consai_visualizer_msgs + crane_visualization_interfaces 0.1.0 Message types for CON-SAI visualization - shotaak - Apache License 2.0 + ibis-ssl + MIT ament_cmake rosidl_default_generators diff --git a/consai_ros2/consai_visualizer_msgs/proto/CMakeLists.txt b/crane_visualization_interfaces/proto/CMakeLists.txt similarity index 53% rename from consai_ros2/consai_visualizer_msgs/proto/CMakeLists.txt rename to crane_visualization_interfaces/proto/CMakeLists.txt index a6bb5840e..a5ec14a23 100644 --- a/consai_ros2/consai_visualizer_msgs/proto/CMakeLists.txt +++ b/crane_visualization_interfaces/proto/CMakeLists.txt @@ -1,26 +1,26 @@ find_package(Protobuf REQUIRED) protobuf_generate( - LANGUAGE python - OUT_VAR proto_py_sources - PROTOS ObjectsArray.proto + LANGUAGE python + OUT_VAR proto_py_sources + PROTOS ObjectsArray.proto ) protobuf_generate( - LANGUAGE cpp - OUT_VAR proto_cpp_sources - PROTOS ObjectsArray.proto + LANGUAGE cpp + OUT_VAR proto_cpp_sources + PROTOS ObjectsArray.proto ) -add_library(${PROJECT_NAME}_proto SHARED ${proto_cpp_sources} ) +add_library(${PROJECT_NAME}_proto SHARED ${proto_cpp_sources}) #target_include_directories(${PROJECT_NAME}_proto PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") target_compile_options(${PROJECT_NAME}_proto PUBLIC -Wno-deprecated-declarations) target_link_libraries(${PROJECT_NAME}_proto protobuf::libprotobuf) add_custom_target( - ${PROJECT_NAME}_proto_gen ALL DEPENDS - ${proto_py_sources} - ${proto_cpp_sources} + ${PROJECT_NAME}_proto_gen ALL DEPENDS + ${proto_py_sources} + ${proto_cpp_sources} ) set(PROTO_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE) diff --git a/consai_ros2/consai_visualizer_msgs/proto/ObjectsArray.proto b/crane_visualization_interfaces/proto/ObjectsArray.proto similarity index 95% rename from consai_ros2/consai_visualizer_msgs/proto/ObjectsArray.proto rename to crane_visualization_interfaces/proto/ObjectsArray.proto index ab48b5d87..a4a9c1f47 100644 --- a/consai_ros2/consai_visualizer_msgs/proto/ObjectsArray.proto +++ b/crane_visualization_interfaces/proto/ObjectsArray.proto @@ -1,3 +1,5 @@ +// This proto schema is based on https://github.com/SSL-Roots/consai_ros2/tree/main/consai_visualizer_msgs/msg + syntax = "proto3"; package visualizer; diff --git a/consai_ros2/consai_visualizer_msgs/src/manual_conversions.cpp b/crane_visualization_interfaces/src/manual_conversions.cpp similarity index 100% rename from consai_ros2/consai_visualizer_msgs/src/manual_conversions.cpp rename to crane_visualization_interfaces/src/manual_conversions.cpp