Skip to content

Commit

Permalink
nav2_smac_planner: add corner case to unit tests
Browse files Browse the repository at this point in the history
Add a plan where the start and goal are placed on the same cell.

Signed-off-by: Dylan De Coeyer <[email protected]>
  • Loading branch information
DylanDeCoeyer-Quimesis committed Dec 16, 2024
1 parent 76eda26 commit 81ee425
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nav2_smac_planner/test/test_smac_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ TEST(SmacTest, test_smac_2d) {
} catch (...) {
}

// corner case where the start and goal are on the same cell
goal.pose.position.x = 0.01;
goal.pose.position.y = 0.01;

nav_msgs::msg::Path plan = planner_2d->createPlan(start, goal, dummy_cancel_checker);
EXPECT_EQ(plan.poses.size(), 1); // single point path

planner_2d->deactivate();
planner_2d->cleanup();

Expand Down
7 changes: 7 additions & 0 deletions nav2_smac_planner/test/test_smac_hybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ TEST(SmacTest, test_smac_se2)
} catch (...) {
}

// corner case where the start and goal are on the same cell
goal.pose.position.x = 0.01;
goal.pose.position.y = 0.01;

nav_msgs::msg::Path plan = planner->createPlan(start, goal, dummy_cancel_checker);
EXPECT_EQ(plan.poses.size(), 1); // single point path

planner->deactivate();
planner->cleanup();

Expand Down
7 changes: 7 additions & 0 deletions nav2_smac_planner/test/test_smac_lattice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ TEST(SmacTest, test_smac_lattice)
} catch (...) {
}

// corner case where the start and goal are on the same cell
goal.pose.position.x = 0.01;
goal.pose.position.y = 0.01;

nav_msgs::msg::Path plan = planner->createPlan(start, goal, dummy_cancel_checker);
EXPECT_EQ(plan.poses.size(), 1); // single point path

planner->deactivate();
planner->cleanup();

Expand Down

0 comments on commit 81ee425

Please sign in to comment.