feat: read tape_plateau_min_fraction

This commit is contained in:
2026-10-30 09:43:47 +07:00
parent 1a76e7798f
commit d51f83804d
4 changed files with 44 additions and 4 deletions

View File

@@ -508,6 +508,27 @@ TEST(TrolleyDetectionAction, RefusesAnUnknownProfile)
EXPECT_FALSE(h->start(makeAction("DetectTrolley", "khong_co_profile_nay"), robot::Time(10.0)));
}
TEST(TrolleyDetectionAction, LoadsPlateauFromYamlAndRejectsInvalidValue)
{
Rig rig;
ASSERT_TRUE(rig.loaded);
ActionHandler* handler = rig.registry.find("DetectTrolley");
ASSERT_NE(handler, nullptr);
EXPECT_TRUE(handler->start(makeAction("DetectTrolley", "tci_trolley_plateau"), robot::Time(10.0)));
const std::string key = "actions_trolley/detect_trolley/profiles/tci_trolley_plateau/"
"tape_plateau_min_fraction";
double value = 0.0;
ASSERT_TRUE(rig.nh.getParam(key, value));
EXPECT_DOUBLE_EQ(value, 0.65);
rig.nh.setParam(key, 1.0);
ActionRegistry invalid;
invalid.setContext(rig.ctx);
EXPECT_FALSE(invalid.loadFromConfig(rig.nh, kNamespace));
EXPECT_EQ(invalid.find("DetectTrolley"), nullptr);
rig.nh.setParam(key, 0.65);
}
TEST(TrolleyDetectionAction, RefusesToLoadWithoutASensorStore)
{
robot::NodeHandle nh;