Skip to content

Commit

Permalink
consai_visualizer_msgs->crane_visualization_interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Dec 23, 2024
1 parent 07b3044 commit 61f5868
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 100 deletions.
87 changes: 0 additions & 87 deletions consai_ros2/consai_visualizer_msgs/CMakeLists.txt

This file was deleted.

85 changes: 85 additions & 0 deletions crane_visualization_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
"$<BUILD_INTERFACE:${cpp_include_dir}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/proto>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
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()
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?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>consai_visualizer_msgs</name>
<name>crane_visualization_interfaces</name>
<version>0.1.0</version>
<description>Message types for CON-SAI visualization</description>
<maintainer email="macakasit@gmail.com">shotaak</maintainer>
<license>Apache License 2.0</license>
<maintainer email="ibis.ssl.team@gmail.com">ibis-ssl</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 61f5868

Please sign in to comment.