Skip to content

Commit

Permalink
Fixed a silly spelling error
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Duchesne <[email protected]>
  • Loading branch information
josephduchesne committed Dec 10, 2024
1 parent 524ab92 commit d90135e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PathCompleteGoalChecker : public SimpleGoalChecker

protected:
// threshold for path goal
int path_length_tolerence_;
int path_length_tolerance_;

/**
* @brief Callback executed when a paramter change is detected
Expand Down
16 changes: 8 additions & 8 deletions nav2_controller/plugins/path_complete_goal_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace nav2_controller
{

PathCompleteGoalChecker::PathCompleteGoalChecker()
: SimpleGoalChecker(), path_length_tolerence_(1)
: SimpleGoalChecker(), path_length_tolerance_(1)
{
}

Expand All @@ -58,10 +58,10 @@ void PathCompleteGoalChecker::initialize(

nav2_util::declare_parameter_if_not_declared(
node,
plugin_name + ".path_length_tolerence",
rclcpp::ParameterValue(path_length_tolerence_));
plugin_name + ".path_length_tolerance",
rclcpp::ParameterValue(path_length_tolerance_));

node->get_parameter(plugin_name + ".path_length_tolerence", path_length_tolerence_);
node->get_parameter(plugin_name + ".path_length_tolerance", path_length_tolerance_);

// Replace SimpleGoalChecker's callback for dynamic parameters
node->remove_on_set_parameters_callback(dyn_params_handler_.get());
Expand All @@ -78,9 +78,9 @@ bool PathCompleteGoalChecker::isGoalReached(
const geometry_msgs::msg::Pose & query_pose, const geometry_msgs::msg::Pose & goal_pose,
const geometry_msgs::msg::Twist & twist, const nav_msgs::msg::Path & path)
{
// return false if more than path_length_tolerence_ waypoints exist
// return false if more than path_length_tolerance_ waypoints exist
// note: another useful version of this could check path length
if (path.poses.size() > (unsigned int)path_length_tolerence_) {
if (path.poses.size() > (unsigned int)path_length_tolerance_) {
return false;
}
// otherwise defer to SimpleGoalChecker's isGoalReached
Expand All @@ -98,8 +98,8 @@ PathCompleteGoalChecker::dynamicParametersCallback(std::vector<rclcpp::Parameter
const auto & name = parameter.get_name();

if (type == ParameterType::PARAMETER_INTEGER) {
if (name == plugin_name_ + ".path_length_tolerence") {
path_length_tolerence_ = parameter.as_int();
if (name == plugin_name_ + ".path_length_tolerance") {
path_length_tolerance_ = parameter.as_int();
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions nav2_controller/plugins/test/goal_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ TEST(PathCompleteGoalChecker, test_goal_checking)
checkMacro(pcgc, 0, 0, 0, 0, 0, 0, 0, 0, 1, path, true);

// add a second default constructed pose to the path
// this should prevent any completions due to path_length_tolerence=1
// this should prevent any completions due to path_length_tolerance=1
path.poses.emplace_back();

checkMacro(pcgc, 0, 0, 0, 0, 0, 0, 0, 0, 0, path, false);
Expand Down Expand Up @@ -339,7 +339,7 @@ TEST(PathCompleteGoalChecker, get_tol_and_dynamic_params)
auto results = rec_param->set_parameters_atomically(
{rclcpp::Parameter("test3.xy_goal_tolerance", 200.0),
rclcpp::Parameter("test3.yaw_goal_tolerance", 200.0),
rclcpp::Parameter("test3.path_length_tolerence", 3),
rclcpp::Parameter("test3.path_length_tolerance", 3),
rclcpp::Parameter("test3.stateful", true)});

rclcpp::spin_until_future_complete(
Expand All @@ -348,7 +348,7 @@ TEST(PathCompleteGoalChecker, get_tol_and_dynamic_params)

EXPECT_EQ(x->get_parameter("test3.xy_goal_tolerance").as_double(), 200.0);
EXPECT_EQ(x->get_parameter("test3.yaw_goal_tolerance").as_double(), 200.0);
EXPECT_EQ(x->get_parameter("test3.path_length_tolerence").as_int(), 3);
EXPECT_EQ(x->get_parameter("test3.path_length_tolerance").as_int(), 3);
EXPECT_EQ(x->get_parameter("test3.stateful").as_bool(), true);

// Test the dynamic parameters impacted the tolerances
Expand Down

0 comments on commit d90135e

Please sign in to comment.