Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,21 @@ find_package(message_filters REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(nav2_dynamic_msgs REQUIRED)

set(dep_pkgs
rclcpp
nav2_costmap_2d
pluginlib
radar_msgs
message_filters
tf2_ros
nav2_dynamic_msgs)

# === Build ===

include_directories(include)

add_library(${lib_name} SHARED
src/radar_layer.cpp)

ament_target_dependencies(${lib_name} ${dep_pkgs})
ament_target_dependencies(${lib_name}
rclcpp
nav2_costmap_2d
pluginlib
radar_msgs
message_filters
tf2_ros
nav2_dynamic_msgs)

# === Installation ===

Expand All @@ -65,16 +63,12 @@ if(BUILD_TESTING)
ament_lint_auto_find_test_dependencies()

# Unit Test
find_package(Catch2 2 REQUIRED)
find_package(Catch2 REQUIRED)
set(test_dependencies
Catch2
)
add_executable(catch_tests test/test_radar_layer.cpp)
target_link_libraries(catch_tests Catch2::Catch2 ${lib_name})
ament_target_dependencies(catch_tests
${test_dependencies}
${dep_pkgs}
)
target_link_libraries(catch_tests Catch2::Catch2WithMain ${lib_name})
add_test(NAME catch_tests COMMAND catch_tests)
endif()

Expand All @@ -83,5 +77,4 @@ endif()
# This allows the plugin to be discovered as a plugin of required type.

pluginlib_export_plugin_description_file(nav2_costmap_2d radar_layer.xml)
ament_target_dependencies(${lib_name} ${dep_pkgs})
ament_package()
13 changes: 10 additions & 3 deletions test/test_radar_layer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do
// this in one cpp file
#define CATCH_CONFIG_MAIN
#include <math.h>

#include <catch2/catch.hpp>
#if __has_include(<catch2/catch_all.hpp>)
#include <catch2/catch_all.hpp>
#include <catch2/catch_approx.hpp>
using Catch::Approx;
#elif __has_include(<catch2/catch.hpp>)
#include <catch2/catch.hpp>
#else
#error "Catch2 headers not found. Please install Catch2 (v2 or v3)."
#endif
#include <iostream>
#include <limits>
#include <memory>
Expand Down
Loading