diff --git a/CMakeLists.txt b/CMakeLists.txt index 0258689..e269f81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,4 +14,7 @@ if (NOT TARGET sensor_msgs) endif() if (NOT TARGET nav_msgs) add_subdirectory(nav_msgs) +endif() +if(NOT TARGET map_msgs) + add_subdirectory(map_msgs) endif() \ No newline at end of file diff --git a/map_msgs/CMakeLists.txt b/map_msgs/CMakeLists.txt new file mode 100644 index 0000000..fb2d9a8 --- /dev/null +++ b/map_msgs/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(map_msgs) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +if (NOT TARGET std_msgs) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../common_msgs/std_msgs ${CMAKE_BINARY_DIR}/std_msgs_build) +endif() + +# Thư viện header-only +add_library(map_msgs INTERFACE) + +# Include path tới thư mục chứa file header +target_include_directories(map_msgs INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/ +target_link_libraries(map_msgs INTERFACE std_msgs) diff --git a/map_msgs/include/map_msgs/OccupancyGridUpdate.h b/map_msgs/include/map_msgs/OccupancyGridUpdate.h new file mode 100644 index 0000000..8cbf6bc --- /dev/null +++ b/map_msgs/include/map_msgs/OccupancyGridUpdate.h @@ -0,0 +1,19 @@ +#ifndef OCCUPANCY_GRID_UPDATE_H +#define OCCUPANCY_GRID_UPDATE_H + +#include +#include "std_msgs/Header.h" +namespace map_msgs +{ +struct OccupancyGridUpdate +{ + std_msgs::Header header; // Thời gian và frame của bản đồ cập nhật + int32_t x = 0; // Tọa độ x của góc trên bên trái của vùng cập nhật trong bản đồ + int32_t y = 0; // Tọa độ y của góc trên bên trái của vùng cập nhật trong bản đồ + uint32_t width = 0; // Chiều rộng của vùng cập nhật + uint32_t height = 0; // Chiều cao của vùng cập nhật + std::vector data; // Dữ liệu cập nhật của vùng (giá trị từ -1 đến 100, trong đó -1 là không biết, 0 là không có chướng ngại vật, và 100 là chướng ngại vật chắc chắn + OccupancyGridUpdate() = default; +}; +} // namespace map_msgs +#endif \ No newline at end of file