Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>robot_localization_cpp</name>
<name>ISR_robot_localization_cpp</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="achakraborty@olin.edu">achakraborty</maintainer>
Expand Down
5 changes: 3 additions & 2 deletions src/occupancy_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ OccupancyField::OccupancyField(std::shared_ptr<rclcpp::Node> node) {
RCLCPP_DEBUG_STREAM(node->get_logger(), "occupancy field ready");
};

std::array<double, 4> OccupancyField::get_obstacle_bounding_box() {
unsigned int x_min = UINT8_MAX, x_max = 0, y_min = UINT8_MAX, y_max = 0;
std::array<double, 4> 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);
Expand Down
7 changes: 5 additions & 2 deletions src/occupancy_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double, 4> get_obstacle_bounding_box();

std::array<double, 4> 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
Expand Down