Skip to content

Commit b2d2232

Browse files
authored
Merge pull request #5 from idealworks/fix/costmap_footprint_topic
[nav2_costmap_2d] Add a footprint topic parameter
2 parents de9b9f0 + a6d5173 commit b2d2232

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

nav2_costmap_2d/include/nav2_costmap_2d/costmap_2d_ros.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ class Costmap2DROS : public nav2_util::LifecycleNode
383383
void getParameters();
384384
bool always_send_full_costmap_{false};
385385
std::string footprint_;
386+
std::string footprint_topic_;
386387
float footprint_padding_{0};
387388
std::string global_frame_; ///< The global frame for the costmap
388389
int map_height_meters_{0};

nav2_costmap_2d/src/costmap_2d_ros.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ void Costmap2DROS::init()
104104
declare_parameter("map_vis_z", rclcpp::ParameterValue(0.0));
105105
declare_parameter("footprint_padding", rclcpp::ParameterValue(0.01f));
106106
declare_parameter("footprint", rclcpp::ParameterValue(std::string("[]")));
107+
declare_parameter("footprint_topic", rclcpp::ParameterValue(std::string("footprint")));
107108
declare_parameter("global_frame", rclcpp::ParameterValue(std::string("map")));
108109
declare_parameter("height", rclcpp::ParameterValue(5));
109110
declare_parameter("width", rclcpp::ParameterValue(5));
@@ -212,7 +213,7 @@ Costmap2DROS::on_configure(const rclcpp_lifecycle::State & /*state*/)
212213

213214
// Create the publishers and subscribers
214215
footprint_sub_ = create_subscription<geometry_msgs::msg::Polygon>(
215-
"footprint",
216+
footprint_topic_,
216217
rclcpp::SystemDefaultsQoS(),
217218
std::bind(&Costmap2DROS::setRobotFootprintPolygon, this, std::placeholders::_1));
218219

@@ -393,6 +394,7 @@ Costmap2DROS::getParameters()
393394
get_parameter("always_send_full_costmap", always_send_full_costmap_);
394395
get_parameter("map_vis_z", map_vis_z_);
395396
get_parameter("footprint", footprint_);
397+
get_parameter("footprint_topic", footprint_topic_);
396398
get_parameter("footprint_padding", footprint_padding_);
397399
get_parameter("global_frame", global_frame_);
398400
get_parameter("height", map_height_meters_);

0 commit comments

Comments
 (0)