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 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