Skip to content

Commit

Permalink
Auto download messages lib
Browse files Browse the repository at this point in the history
  • Loading branch information
KiselevIlia committed Apr 1, 2024
1 parent 1ff438f commit 2f4fc8f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ 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 ()
include(FetchContent)
message(STATUS "Download TASFMessages library")

FetchContent_Declare(
TASFMessages
GIT_REPOSITORY "[email protected]:tiiuae/TASFMessages.git"
GIT_TAG main
SOURCE_DIR ${CMAKE_SOURCE_DIR}/dependency/TASFMessages
)
FetchContent_Populate(TASFMessages)
add_subdirectory(${tasfmessages_SOURCE_DIR})

if(gz-msgs10_FOUND)
set(GZ_MSG_VER 10)
Expand All @@ -50,6 +57,7 @@ include_directories(${CMAKE_BINARY_DIR})
include_directories(
include
${Boost_INCLUDE_DIR}
${tasfmessages_BINARY_DIR}
# ${MAVLINK_INCLUDE_DIRS}
)

Expand All @@ -75,11 +83,11 @@ 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}
PRIVATE gz_custom_messages
)

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_CUSTOM_MSGS}
PRIVATE gz_custom_messages
)
2 changes: 1 addition & 1 deletion include/groundtruth_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <gz/msgs.hh>
#include <gz/sim/Model.hh>
#include "common.h"
#include "gz_custom_messages/Groundtruth.pb.h"
#include "Groundtruth.pb.h"

namespace gz {
namespace sim {
Expand Down
2 changes: 1 addition & 1 deletion include/harmonic_collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <gz/transport/Node.hh>
#include <gz/sim/Model.hh>

#include "gz_custom_messages/CollisionObject.pb.h"
#include "CollisionObject.pb.h"

namespace gz {
using namespace sim;
Expand Down
2 changes: 1 addition & 1 deletion src/groundtruth_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ GZ_ADD_PLUGIN(GroundtruthPlugin,
GroundtruthPlugin::ISystemPostUpdate)

GZ_ADD_PLUGIN_ALIAS(GroundtruthPlugin,
"gz::sim::systems::GroundtruthPlugin")
"gz::GroundtruthPlugin")

bool GroundtruthPlugin::responseCallback(const gz::msgs::StringMsg &, gz::msgs::Groundtruth &rep)
{
Expand Down
2 changes: 1 addition & 1 deletion src/harmonic_collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void CollisionPlugin::Load(const EntityComponentManager &_ecm,
}
}

if (_sdf->HasElement("updateRate")) { ;
if (_sdf->HasElement("updateRate")) {
publish_rate_ = _sdf->GetElement("updateRate")->Get<int32_t>();
gzmsg << "Publish rate set to " << publish_rate_ << std::endl;
}
Expand Down

0 comments on commit 2f4fc8f

Please sign in to comment.