feat(directional_layer): rewrite as a direction field provider
DirectionalLayer no longer derives from StaticLayer and never writes the master grid. It receives an OccupancyGrid of direction codes (0 = no constraint, 1..8 = direction_index + 1) on direction_topic, validates it against the master geometry and global frame, and publishes an immutable DirectionField snapshot with a DISABLED / PENDING / READY state and a generation counter. Every static map on map_topic drops the snapshot and returns the layer to PENDING until a grid for that map arrives. direction_field.h holds the core API used by planners: grid validation, DirectionField with bounds-checked codeAt(), a half-open-cell DDA (traverseGridSegment), allowedDirectionMask() and checkSegment(). LayeredCostmap::getDirectionFieldSnapshot() exposes the snapshot through the DirectionFieldProvider interface without adding data members. Tests: direction_field_test (7) and directional_layer_test (5) pass.
This commit is contained in:
@@ -112,6 +112,7 @@ add_library(robot_costmap_2d SHARED
|
||||
src/observation_buffer.cpp
|
||||
src/layer.cpp
|
||||
src/layered_costmap.cpp
|
||||
src/direction_field.cpp
|
||||
src/costmap_math.cpp
|
||||
src/footprint.cpp
|
||||
src/costmap_layer.cpp
|
||||
@@ -239,6 +240,9 @@ if(BUILDING_WITH_CATKIN)
|
||||
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
install(FILES config/directional_layer_params.yaml
|
||||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config)
|
||||
|
||||
## Mark cpp header files for installation
|
||||
install(DIRECTORY include/${PROJECT_NAME}/
|
||||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
@@ -255,6 +259,9 @@ else()
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
install(FILES config/directional_layer_params.yaml
|
||||
DESTINATION share/${PROJECT_NAME}/config)
|
||||
|
||||
# Export targets
|
||||
install(EXPORT ${PROJECT_NAME}-targets
|
||||
FILE ${PROJECT_NAME}-targets.cmake
|
||||
@@ -294,6 +301,12 @@ if(BUILD_COSTMAP_TESTS)
|
||||
find_package(Boost REQUIRED COMPONENTS system thread filesystem)
|
||||
find_library(TF3_LIBRARY NAMES tf3 PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu)
|
||||
|
||||
add_executable(direction_field_test test/direction_field_test.cpp)
|
||||
target_link_libraries(direction_field_test PRIVATE robot_costmap_2d GTest::GTest GTest::Main)
|
||||
|
||||
add_executable(directional_layer_test test/directional_layer_test.cpp)
|
||||
target_link_libraries(directional_layer_test PRIVATE plugins robot_costmap_2d GTest::GTest GTest::Main Boost::thread ${TF3_LIBRARY})
|
||||
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/array_parser_test.cpp)
|
||||
add_executable(test_array_parser test/array_parser_test.cpp)
|
||||
target_link_libraries(test_array_parser PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user