From 75d157e4cc5ad1147019f1bc2c6e4ea748454d98 Mon Sep 17 00:00:00 2001 From: Connor Hoang Date: Sat, 27 Dec 2025 22:39:13 -0500 Subject: [PATCH 1/2] Now able to pass in specific bounding values to get_obstacle_bounding_box() and defaults to larger size if no args --- src/occupancy_field.cpp | 5 +++-- src/occupancy_field.hpp | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/occupancy_field.cpp b/src/occupancy_field.cpp index 30ed647..b63d3ba 100644 --- a/src/occupancy_field.cpp +++ b/src/occupancy_field.cpp @@ -81,8 +81,9 @@ OccupancyField::OccupancyField(std::shared_ptr node) { RCLCPP_DEBUG_STREAM(node->get_logger(), "occupancy field ready"); }; -std::array OccupancyField::get_obstacle_bounding_box() { - unsigned int x_min = UINT8_MAX, x_max = 0, y_min = UINT8_MAX, y_max = 0; +std::array OccupancyField::get_obstacle_bounding_box(unsigned int x_min_arg, unsigned int y_min_arg) { + unsigned int x_min = x_min_arg, x_max = 0, y_min = y_min_arg, y_max = 0; + for (unsigned int i = 0; i < this->occupied_coordinates.cols(); i++) { if (this->occupied_coordinates(0, i) < x_min) { x_min = this->occupied_coordinates(0, i); diff --git a/src/occupancy_field.hpp b/src/occupancy_field.hpp index 088d98f..0da7980 100644 --- a/src/occupancy_field.hpp +++ b/src/occupancy_field.hpp @@ -28,9 +28,12 @@ class OccupancyField { * Returns: the upper and lower bounds of x and y such that the resultant * bounding box contains all of the obstacles in the map. The format of * the return value is ((x_lower, x_upper), (y_lower, y_upper)) + * May pass in specific values if known as x_min_arg and y_min_arg to minimize compute time. */ - std::array get_obstacle_bounding_box(); - + std::array get_obstacle_bounding_box( + unsigned int x_min_arg = UINT16_MAX, + unsigned int y_min_arg = UINT16_MAX + ); /** * Compute the closest obstacle to the specified (x,y) coordinate in * the map. If the (x,y) coordinate is out of the map boundaries, nan From 46ecf8e0d0f14f01585635f861800562c9b3e46e Mon Sep 17 00:00:00 2001 From: Connor Hoang Date: Mon, 6 Jul 2026 14:26:00 -0700 Subject: [PATCH 2/2] renamed --- CMakeLists.txt | 2 +- package.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1dc98..23b0274 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(robot_localization_cpp) +project(ISR_robot_localization_cpp) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) diff --git a/package.xml b/package.xml index c4e8ef8..f47eaec 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ - robot_localization_cpp + ISR_robot_localization_cpp 0.0.0 TODO: Package description achakraborty