feat(move_base2): wait for a ready global costmap and replay maps in host order
- Replay static maps in arrival order instead of topic order, so a direction grid can no longer be replayed before its static map (F3). - PlannerRunner checks every enabled global layer under the same lock as the snapshot; while not current it keeps the goal, reports waiting_for_costmap, logs the stale layers (throttled) and does not spend planner_patience or watchdog budget. After costmap_ready_timeout [s] (default 10, 0 = legacy behaviour) the attempt fails as before. - Test fixture destroys the server before its fake ports; the control thread could call a destroyed port (race existed before this change).
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <robot/node_handle.h>
|
||||
@@ -55,6 +56,35 @@ TEST(MoveBase2Config, DefaultsAreValid)
|
||||
EXPECT_TRUE(config.validate(error)) << error;
|
||||
}
|
||||
|
||||
TEST(MoveBase2Config, CostmapReadyTimeoutValidation)
|
||||
{
|
||||
MoveBase2Config config = minimalValid();
|
||||
std::string error;
|
||||
EXPECT_DOUBLE_EQ(config.costmap_ready_timeout, 10.0);
|
||||
EXPECT_DOUBLE_EQ(config.toControlLoopConfig().costmap_ready_timeout, 10.0);
|
||||
EXPECT_NE(config.describe().find("costmap_ready_timeout"), std::string::npos);
|
||||
config.costmap_ready_timeout = 0.0;
|
||||
EXPECT_TRUE(config.validate(error));
|
||||
for (double invalid : {-1.0, std::numeric_limits<double>::infinity(),
|
||||
std::numeric_limits<double>::quiet_NaN()})
|
||||
{
|
||||
config.costmap_ready_timeout = invalid;
|
||||
EXPECT_FALSE(config.validate(error));
|
||||
EXPECT_NE(error.find("costmap_ready_timeout"), std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MoveBase2Config, ReadsCostmapReadyTimeout)
|
||||
{
|
||||
robot::NodeHandle root;
|
||||
robot::NodeHandle nh(root, "costmap_ready_timeout_test");
|
||||
nh.setParam("costmap_ready_timeout", 3.5);
|
||||
MoveBase2Config config;
|
||||
config.fromNodeHandle(nh);
|
||||
EXPECT_DOUBLE_EQ(config.costmap_ready_timeout, 3.5);
|
||||
EXPECT_DOUBLE_EQ(config.toControlLoopConfig().costmap_ready_timeout, 3.5);
|
||||
}
|
||||
|
||||
TEST(MoveBase2Config, CancelSettleKeysFallBackToDefaultsWhenAbsent)
|
||||
{
|
||||
// Cây config cũ (trước 2026-09-11) không có ba khoá này: phải giữ default BẬT (2 s, 0.02) chứ
|
||||
|
||||
Reference in New Issue
Block a user