2 Commits

Author SHA1 Message Date
af66991a3e build: bỏ dependency PCL không dùng
Gói không include một header pcl/ nào — đây là di sản từ thời còn dùng pcl_ros.

Trên robot aarch64 có VTK 9.1 build kèm MPI, chuỗi PCL -> VTK -> VTK::mpi ->
MPI::MPI_C làm CMake gãy ở generate step: root project khai LANGUAGES CXX nên
find_package(MPI COMPONENTS C) không bao giờ thành công và target MPI::MPI_C
không được tạo. Component io là chỗ kéo VTK vào. Máy dev không dính vì không
cài VTK cmake package, find_VTK() tìm không thấy rồi bỏ qua trong im lặng.

Bỏ find_package, DEPENDS PCL, PCL_INCLUDE_DIRS, PCL_LIBRARIES,
link_directories(PCL_LIBRARY_DIRS) và PCL_DEFINITIONS.
2026-08-25 12:38:48 +07:00
d60e1e8db7 feat: đặt tên thread map-update (cm_<tên costmap>) cho top -H / pidstat -t
Đo CPU thật của costmap ở mức OS không cần bật metrics nội bộ: thread hiện ra
là cm_local_costma / cm_global_costm thay vì lẫn vào amr_control_node.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 10:24:04 +07:00
2 changed files with 11 additions and 11 deletions

View File

@@ -22,7 +22,6 @@ find_package(Boost REQUIRED COMPONENTS system thread filesystem)
# does not produce. QUIET, not REQUIRED: a robot without GTest installed must # does not produce. QUIET, not REQUIRED: a robot without GTest installed must
# still configure. The test block below requires it where it is actually used. # still configure. The test block below requires it where it is actually used.
find_package(GTest QUIET) find_package(GTest QUIET)
find_package(PCL REQUIRED COMPONENTS common io)
find_package(yaml-cpp REQUIRED) find_package(yaml-cpp REQUIRED)
if (NOT BUILDING_WITH_CATKIN) if (NOT BUILDING_WITH_CATKIN)
@@ -81,7 +80,7 @@ else()
INCLUDE_DIRS include INCLUDE_DIRS include
LIBRARIES robot_costmap_2d plugins LIBRARIES robot_costmap_2d plugins
CATKIN_DEPENDS robot_std_msgs robot_sensor_msgs geometry_msgs robot_nav_msgs robot_map_msgs robot_laser_geometry robot_visualization_msgs robot_voxel_grid robot_tf3_geometry_msgs robot_tf3_sensor_msgs data_convert robot_xmlrpcpp robot_cpp robot_time CATKIN_DEPENDS robot_std_msgs robot_sensor_msgs geometry_msgs robot_nav_msgs robot_map_msgs robot_laser_geometry robot_visualization_msgs robot_voxel_grid robot_tf3_geometry_msgs robot_tf3_sensor_msgs data_convert robot_xmlrpcpp robot_cpp robot_time
DEPENDS PCL Boost DEPENDS Boost
) )
include_directories( include_directories(
@@ -90,17 +89,15 @@ else()
${EIGEN3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${GTEST_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${TF3_INCLUDE_DIR} ${TF3_INCLUDE_DIR}
) )
link_directories(${PCL_LIBRARY_DIRS})
endif() endif()
# Define macro để dùng trong code # Define macro để dùng trong code
add_definitions(-DROBOT_COSTMAP_2D_DIR="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DROBOT_COSTMAP_2D_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
# Eigen và PCL definitions # Eigen definitions
add_definitions(${EIGEN3_DEFINITIONS} ${PCL_DEFINITIONS}) add_definitions(${EIGEN3_DEFINITIONS})
# ======================================================== # ========================================================
# Core library: robot_costmap_2d # Core library: robot_costmap_2d
@@ -126,7 +123,6 @@ if(BUILDING_WITH_CATKIN)
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
${EIGEN3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${TF3_INCLUDE_DIR} ${TF3_INCLUDE_DIR}
) )
@@ -135,7 +131,6 @@ if(BUILDING_WITH_CATKIN)
PRIVATE Boost::boost Boost::system Boost::thread Boost::filesystem PRIVATE Boost::boost Boost::system Boost::thread Boost::filesystem
PRIVATE yaml-cpp PRIVATE yaml-cpp
PRIVATE dl PRIVATE dl
PRIVATE ${PCL_LIBRARIES}
PRIVATE ${TF3_LIBRARY} PRIVATE ${TF3_LIBRARY}
) )
@@ -147,7 +142,6 @@ else()
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
${EIGEN3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${TF3_INCLUDE_DIR} ${TF3_INCLUDE_DIR}
) )
@@ -158,7 +152,6 @@ else()
Boost::boost Boost::system Boost::thread Boost::filesystem Boost::boost Boost::system Boost::thread Boost::filesystem
yaml-cpp yaml-cpp
dl dl
${PCL_LIBRARIES}
${TF3_LIBRARY} ${TF3_LIBRARY}
) )
@@ -274,7 +267,7 @@ else()
message(STATUS "Version: ${PROJECT_VERSION}") message(STATUS "Version: ${PROJECT_VERSION}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "Libraries: robot_costmap_2d, plugins") message(STATUS "Libraries: robot_costmap_2d, plugins")
message(STATUS "Dependencies: robot_std_msgs, robot_sensor_msgs, geometry_msgs, robot_nav_msgs, robot_map_msgs, robot_laser_geometry, robot_visualization_msgs, robot_voxel_grid, tf3, robot_tf3_geometry_msgs, robot_tf3_sensor_msgs, data_convert, robot_xmlrpcpp, robot_cpp, robot_time, Eigen3, PCL, Boost, yaml-cpp") message(STATUS "Dependencies: robot_std_msgs, robot_sensor_msgs, geometry_msgs, robot_nav_msgs, robot_map_msgs, robot_laser_geometry, robot_visualization_msgs, robot_voxel_grid, tf3, robot_tf3_geometry_msgs, robot_tf3_sensor_msgs, data_convert, robot_xmlrpcpp, robot_cpp, robot_time, Eigen3, Boost, yaml-cpp")
message(STATUS "=================================") message(STATUS "=================================")
endif() endif()

View File

@@ -51,6 +51,8 @@
#include <boost/dll/import.hpp> #include <boost/dll/import.hpp>
#include <pthread.h>
using namespace std; using namespace std;
namespace robot_costmap_2d namespace robot_costmap_2d
@@ -630,6 +632,11 @@ void Costmap2DROBOT::checkMovement()
void Costmap2DROBOT::mapUpdateLoop(double frequency) void Costmap2DROBOT::mapUpdateLoop(double frequency)
{ {
// Name the thread so `top -H` / `pidstat -t` can attribute CPU to this
// costmap directly (kernel limit: 15 chars + NUL).
std::string thread_name = "cm_" + name_;
pthread_setname_np(pthread_self(), thread_name.substr(0, 15).c_str());
std::cout << robot::Time::now().toNSec()<< " :Costmap2DROBOT::mapUpdateLoop updateMap\n"; std::cout << robot::Time::now().toNSec()<< " :Costmap2DROBOT::mapUpdateLoop updateMap\n";
robot::Rate r(frequency); robot::Rate r(frequency);
while (!map_update_thread_shutdown_) while (!map_update_thread_shutdown_)