add map_msgs

This commit is contained in:
duongtd 2025-11-17 14:31:52 +07:00
parent 4c8e350dac
commit 93dec2e1a7
3 changed files with 42 additions and 0 deletions

View File

@ -15,3 +15,6 @@ endif()
if (NOT TARGET nav_msgs) if (NOT TARGET nav_msgs)
add_subdirectory(nav_msgs) add_subdirectory(nav_msgs)
endif() endif()
if(NOT TARGET map_msgs)
add_subdirectory(map_msgs)
endif()

20
map_msgs/CMakeLists.txt Normal file
View File

@ -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ư vin header-only
add_library(map_msgs INTERFACE)
# Include path ti thư mc cha file header
target_include_directories(map_msgs INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Liên kết vi std_msgs nếu bn có file Header.h trong include/std_msgs/
target_link_libraries(map_msgs INTERFACE std_msgs)

View File

@ -0,0 +1,19 @@
#ifndef OCCUPANCY_GRID_UPDATE_H
#define OCCUPANCY_GRID_UPDATE_H
#include <vector>
#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<int8_t> 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