Skip to content

Commit 1e2489d

Browse files
authored
Use the new declare_or_get_parameter API for nav2_costmap_2d (ros-navigation#132)
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
1 parent 75689b1 commit 1e2489d

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

nav2_gradient_costmap_plugin/src/gradient_layer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ GradientLayer::GradientLayer()
6767
void
6868
GradientLayer::onInitialize()
6969
{
70-
auto node = node_.lock();
71-
declareParameter("enabled", rclcpp::ParameterValue(true));
72-
node->get_parameter(name_ + "." + "enabled", enabled_);
70+
auto node = node_.lock();
71+
node->declare_or_get_parameter(name_ + "." + "enabled", true);
7372

7473
need_recalculation_ = false;
7574
current_ = true;
@@ -172,7 +171,7 @@ GradientLayer::updateCosts(
172171
for (int i = min_i; i < max_i; i++) {
173172
int index = master_grid.getIndex(i, j);
174173
// setting the gradient cost
175-
unsigned char cost = (LETHAL_OBSTACLE - gradient_index*GRADIENT_FACTOR)%255;
174+
unsigned char cost = (LETHAL_OBSTACLE - gradient_index * GRADIENT_FACTOR) % 255;
176175
if (gradient_index <= GRADIENT_SIZE) {
177176
gradient_index++;
178177
} else {

0 commit comments

Comments
 (0)