feat: IntrusionDetector plugin and EnvContext host services
- env_context.h: non-owning TF buffer, sensor reader and frame names; host calls setContext() after initialize() - IntrusionDetector reads raw LaserScan, looks up TF at the scan stamp and flags new points close to the unpadded footprint; a point counts only if the reference scan shows that spot was free - stall detector, env types, golden data and tests updated
This commit is contained in:
@@ -20,6 +20,20 @@ find_package(Boost REQUIRED COMPONENTS
|
||||
)
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
|
||||
# tf3 is installed outside catkin, as in move_base2.
|
||||
find_library(TF3_LIBRARY
|
||||
NAMES tf3
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu
|
||||
)
|
||||
if(NOT TF3_LIBRARY)
|
||||
message(FATAL_ERROR "tf3 not found — install tf3 (/usr/local/lib/libtf3.so) before building")
|
||||
endif()
|
||||
find_path(TF3_INCLUDE_DIRS NAMES tf3/LinearMath/Transform.h)
|
||||
if(NOT TF3_INCLUDE_DIRS)
|
||||
message(FATAL_ERROR "tf3 headers not found — install tf3 headers before building")
|
||||
endif()
|
||||
set(TF3_LIBRARIES ${TF3_LIBRARY})
|
||||
|
||||
if(NOT BUILDING_WITH_CATKIN)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
@@ -48,6 +62,8 @@ if(NOT BUILDING_WITH_CATKIN)
|
||||
set(PACKAGES_DIR
|
||||
robot_time
|
||||
robot_cpp
|
||||
robot_sensor_ports
|
||||
robot_sensor_msgs
|
||||
)
|
||||
|
||||
else()
|
||||
@@ -55,6 +71,8 @@ else()
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
robot_time
|
||||
robot_cpp
|
||||
robot_sensor_ports
|
||||
robot_sensor_msgs
|
||||
)
|
||||
|
||||
catkin_package(
|
||||
@@ -66,8 +84,11 @@ else()
|
||||
CATKIN_DEPENDS
|
||||
robot_time
|
||||
robot_cpp
|
||||
robot_sensor_ports
|
||||
robot_sensor_msgs
|
||||
DEPENDS
|
||||
Boost
|
||||
TF3
|
||||
)
|
||||
|
||||
include_directories(SYSTEM
|
||||
@@ -84,6 +105,7 @@ function(env_monitor_core_wire target)
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
${TF3_INCLUDE_DIRS}
|
||||
)
|
||||
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
if(BUILDING_WITH_CATKIN)
|
||||
@@ -94,6 +116,7 @@ function(env_monitor_core_wire target)
|
||||
target_link_libraries(${target}
|
||||
PUBLIC
|
||||
${catkin_LIBRARIES}
|
||||
${TF3_LIBRARY}
|
||||
PRIVATE
|
||||
Boost::boost
|
||||
Boost::system
|
||||
@@ -110,6 +133,7 @@ function(env_monitor_core_wire target)
|
||||
target_link_libraries(${target}
|
||||
PUBLIC
|
||||
${PACKAGES_DIR}
|
||||
${TF3_LIBRARY}
|
||||
PRIVATE
|
||||
Boost::boost
|
||||
Boost::system
|
||||
@@ -142,11 +166,12 @@ env_monitor_core_wire(env_monitor_core)
|
||||
# Detector của gói khác làm y như vậy: depend env_monitor_core, include env_monitor_core/env_detector.h.
|
||||
# ========================================================
|
||||
set(ENV_MONITOR_CORE_PLUGIN_TARGETS
|
||||
env_monitor_core_intrusion_detector
|
||||
env_monitor_core_contact_detector
|
||||
env_monitor_core_stall_detector
|
||||
env_monitor_core_unreachable_detector
|
||||
)
|
||||
foreach(plugin contact stall unreachable)
|
||||
foreach(plugin contact stall unreachable intrusion)
|
||||
set(target env_monitor_core_${plugin}_detector)
|
||||
add_library(${target} SHARED plugins/${plugin}_detector.cpp)
|
||||
env_monitor_core_wire(${target})
|
||||
@@ -237,6 +262,7 @@ if(BUILD_ENV_MONITOR_CORE_TESTS AND BUILDING_WITH_CATKIN AND CATKIN_ENABLE_TESTI
|
||||
env_monitor_test
|
||||
env_monitor_golden_test
|
||||
env_monitor_loading_test
|
||||
intrusion_detector_test
|
||||
)
|
||||
|
||||
foreach(test_name ${ENV_MONITOR_CORE_TESTS})
|
||||
@@ -252,6 +278,9 @@ if(BUILD_ENV_MONITOR_CORE_TESTS AND BUILDING_WITH_CATKIN AND CATKIN_ENABLE_TESTI
|
||||
${catkin_LIBRARIES}
|
||||
yaml-cpp
|
||||
)
|
||||
if(test_name STREQUAL "intrusion_detector_test")
|
||||
target_link_libraries(${test_name} env_monitor_core_intrusion_detector)
|
||||
endif()
|
||||
# Detector được nạp qua boost::dll từ devel/lib, đúng đường runtime đi: phải build xong trước khi test chạy.
|
||||
add_dependencies(${test_name} ${ENV_MONITOR_CORE_PLUGIN_TARGETS} env_monitor_core_test_stale_abi_detector)
|
||||
target_compile_definitions(${test_name} PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user