From 777edda7e108f80d954d2501484d3007d05315ac Mon Sep 17 00:00:00 2001 From: KiselevIlia Date: Fri, 29 Mar 2024 20:07:57 +0400 Subject: [PATCH] Use TASFMessage library --- CMakeLists.txt | 11 +++++++++-- include/groundtruth_plugin.h | 2 +- include/harmonic_collision.h | 2 +- msgs/CollisionObject.proto | 11 ----------- msgs/Groundtruth.proto | 6 +----- 5 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 msgs/CollisionObject.proto diff --git a/CMakeLists.txt b/CMakeLists.txt index bc17948..fd45e38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,11 @@ if(NOT ${gz-transport13_VERSION} EQUAL 13.1.0) message(FATAL_ERROR "gz-transport13 must be version 13.1.0. You have ${gz-transport13_VERSION}") endif () +find_library(GZ_CUSTOM_MSGS NAMES gz_custom_messages PATHS /usr/local/bin) +if (NOT GZ_CUSTOM_MSGS) + message(FATAL_ERROR "Please install messages library from https://github.com/tiiuae/TASFMessages") +endif () + if(gz-msgs10_FOUND) set(GZ_MSG_VER 10) set(Protobuf_IMPORT_DIRS ${gz-msgs10_INCLUDE_DIRS}) @@ -72,17 +77,19 @@ install(TARGETS set(CPACK_PACKAGE_CONTACT "Auterion") include(CPack) -add_library(collision_plugin SHARED src/harmonic_collision.cpp ${PROTO_SRCS}) +add_library(collision_plugin SHARED src/harmonic_collision.cpp) set_property(TARGET collision_plugin PROPERTY CXX_STANDARD 17) target_link_libraries(collision_plugin PRIVATE gz-sim${GAZEBO_VERSION}::gz-sim${GAZEBO_VERSION} + PRIVATE ${GZ_CUSTOM_MSGS} ) -add_library(groundtruth_plugin SHARED src/groundtruth_plugin.cpp ${GT_PROTO_SRCS}) +add_library(groundtruth_plugin SHARED src/groundtruth_plugin.cpp) target_link_libraries(groundtruth_plugin PRIVATE gz-sim${GAZEBO_VERSION}::gz-sim${GAZEBO_VERSION} PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER} PRIVATE gz-msgs10::gz-msgs10 + PRIVATE ${GZ_CUSTOM_MSGS} ) # ln -s ./libgroundtruth_plugin.so /usr/lib/x86_64-linux-gnu/gz-sim-8/plugins # ln -s ./libcollision_plugin.so /usr/lib/x86_64-linux-gnu/gz-sim-8/plugins \ No newline at end of file diff --git a/include/groundtruth_plugin.h b/include/groundtruth_plugin.h index b8f0dfe..758cb07 100644 --- a/include/groundtruth_plugin.h +++ b/include/groundtruth_plugin.h @@ -7,7 +7,7 @@ #include #include #include "common.h" -#include "Groundtruth.pb.h" +#include "gz_custom_messages/Groundtruth.pb.h" namespace gz { namespace sim { diff --git a/include/harmonic_collision.h b/include/harmonic_collision.h index 7c2df37..62efc4d 100644 --- a/include/harmonic_collision.h +++ b/include/harmonic_collision.h @@ -5,7 +5,7 @@ #include #include -#include "CollisionObject.pb.h" +#include "gz_custom_messages/CollisionObject.pb.h" namespace gz { using namespace sim; diff --git a/msgs/CollisionObject.proto b/msgs/CollisionObject.proto deleted file mode 100644 index 3c1e2d9..0000000 --- a/msgs/CollisionObject.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto2"; - -package gz.msgs; - -message CollisionObject -{ - required string object = 1; - required string device_name = 2; - required int32 sequence_id = 3; - optional int32 threshold = 4 [default = 255]; -} \ No newline at end of file diff --git a/msgs/Groundtruth.proto b/msgs/Groundtruth.proto index b27b1c7..0341cd9 100644 --- a/msgs/Groundtruth.proto +++ b/msgs/Groundtruth.proto @@ -1,12 +1,8 @@ syntax = "proto3"; package gz.msgs; -option java_package = "com.gz.msgs"; -option java_outer_classname = "GroundtruthProtos"; -/// \ingroup gz.msgs -/// \interface Groundtruth /// \brief Data from a Groundtruth plugin -/// This is for GPS message. +/// For use gz::msgs::Groundtruth message Groundtruth {