Skip to content

Commit

Permalink
Merge pull request #38 from naturerobots/fix/test_robustness
Browse files Browse the repository at this point in the history
Fix/test robustness
  • Loading branch information
mklpiening authored Oct 16, 2024
2 parents 2226654 + 5f06f7b commit 4a8e343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions mbf_abstract_nav/test/abstract_planner_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,15 @@ TEST_F(AbstractPlannerExecutionFixture, cancel)

// the cancel case. we simulate that we cancel the execution
// setup the expectation
std::condition_variable cv;
// makePlan may or may not be called
ON_CALL(*mock_planner_ptr_, makePlan(_, _, _, _, _, _)).WillByDefault(Wait(&cv));
ON_CALL(*mock_planner_ptr_, makePlan(_, _, _, _, _, _)).WillByDefault(Return(11));
EXPECT_CALL(*mock_planner_ptr_, cancel()).Times(1).WillOnce(Return(true));

// now call the method
ASSERT_TRUE(planner_execution_ptr_->start(pose_, pose_, 0));
ASSERT_TRUE(planner_execution_ptr_->cancel());

// wake up run-thread
cv.notify_all();

// check result
planner_execution_ptr_->waitForStateUpdate(std::chrono::seconds(1));
ASSERT_EQ(planner_execution_ptr_->waitForStateUpdate(std::chrono::seconds(1)), std::cv_status::no_timeout);
ASSERT_EQ(planner_execution_ptr_->getState(), AbstractPlannerExecution::CANCELED);
}

Expand Down
6 changes: 3 additions & 3 deletions mbf_simple_nav/test/simple_nav_integration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct SimpleNavIntegrationTest : public Test

exe_path_goal_.controller = "test_controller";
exe_path_goal_.angle_tolerance = 0.1;
exe_path_goal_.dist_tolerance = 0.01;
exe_path_goal_.dist_tolerance = 0.05;
exe_path_goal_.tolerance_from_action = true;
exe_path_goal_.path.header.frame_id = "odom";
exe_path_goal_.path.poses.push_back(get_path_goal_.start_pose);
Expand Down Expand Up @@ -275,6 +275,6 @@ TEST_F(SimpleNavIntegrationTest, moveBaseActionReachesTheGoal)
tf2::TimePointZero);
const auto & robot_position = trf_odom_baseLink.transform.translation;
const auto & goal_position = move_base_goal.target_pose.pose.position;
EXPECT_NEAR(robot_position.x, goal_position.x, 0.03);
EXPECT_NEAR(robot_position.y, goal_position.y, 0.03);
EXPECT_NEAR(robot_position.x, goal_position.x, 0.05);
EXPECT_NEAR(robot_position.y, goal_position.y, 0.05);
}

0 comments on commit 4a8e343

Please sign in to comment.