Skip to content

Commit fe89b10

Browse files
committed
making tf faster, long term usage test corrected, general code quality imp
Signed-off-by: silanus23 <berkantali23@outlook.com>
1 parent 17b0e18 commit fe89b10

4 files changed

Lines changed: 140 additions & 110 deletions

File tree

nav2_bringup/params/nav2_params.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,8 @@ local_costmap:
231231
height: 3
232232
resolution: 0.05
233233
robot_radius: 0.22
234-
plugins: ["voxel_layer", "inflation_layer", "bounded_tracking_error_layer"]
234+
plugins: ["voxel_layer", "inflation_layer"]
235235
filters: ["keepout_filter"]
236-
bounded_tracking_error_layer:
237-
plugin: "nav2_costmap_2d::BoundedTrackingErrorLayer"
238-
enabled: True
239-
look_ahead: 5.0
240-
step: 5
241-
corridor_width: 2.0
242-
tracking_feedback_topic: "tracking_feedback"
243-
path_topic: "plan"
244-
wall_thickness: 2
245236
keepout_filter:
246237
plugin: "nav2_costmap_2d::KeepoutFilter"
247238
enabled: KEEPOUT_ZONE_ENABLED

nav2_costmap_2d/include/nav2_costmap_2d/bounded_tracking_error_layer.hpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef NAV2_COSTMAP_2D__BOUNDED_TRACKING_ERROR_LAYER_HPP_
1616
#define NAV2_COSTMAP_2D__BOUNDED_TRACKING_ERROR_LAYER_HPP_
1717

18+
#include <atomic>
1819
#include <vector>
1920
#include <memory>
2021
#include <mutex>
@@ -25,7 +26,6 @@
2526
#include "nav2_costmap_2d/layer.hpp"
2627
#include "nav_msgs/msg/path.hpp"
2728
#include "nav2_msgs/msg/tracking_feedback.hpp"
28-
#include "nav2_costmap_2d/costmap_layer.hpp"
2929
#include "nav2_util/path_utils.hpp"
3030
#include "nav2_util/geometry_utils.hpp"
3131
#include "nav2_util/robot_utils.hpp"
@@ -147,6 +147,22 @@ class BoundedTrackingErrorLayer : public nav2_costmap_2d::Layer
147147
rcl_interfaces::msg::SetParametersResult
148148
dynamicParametersCallback(std::vector<rclcpp::Parameter> parameters);
149149

150+
/**
151+
* @brief Draws a wall line on the costmap using Bresenham's algorithm with thickness.
152+
* @param master_grid Reference to the costmap to draw on.
153+
* @param x0 Start x coordinate in map cells.
154+
* @param y0 Start y coordinate in map cells.
155+
* @param x1 End x coordinate in map cells.
156+
* @param y1 End y coordinate in map cells.
157+
* @param map_size_x Width of the map in cells.
158+
* @param map_size_y Height of the map in cells.
159+
*/
160+
void drawWallLine(
161+
nav2_costmap_2d::Costmap2D & master_grid,
162+
unsigned int x0, unsigned int y0,
163+
unsigned int x1, unsigned int y1,
164+
unsigned int map_size_x, unsigned int map_size_y);
165+
150166
nav2_msgs::msg::TrackingFeedback last_tracking_feedback_;
151167

152168
private:
@@ -156,11 +172,11 @@ class BoundedTrackingErrorLayer : public nav2_costmap_2d::Layer
156172
nav_msgs::msg::Path last_path_;
157173
rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr dyn_params_handler_;
158174

159-
size_t temp_step_;
175+
size_t step_size_;
160176
int step_;
161-
double width_;
177+
double corridor_width_;
162178
double look_ahead_;
163-
bool enabled_;
179+
std::atomic<bool> enabled_;
164180
std::string path_topic_;
165181
std::string tracking_feedback_topic_;
166182
int wall_thickness_;

0 commit comments

Comments
 (0)