FeasibilityChecker: Fixed bug and added unit test for it

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2023-02-16 11:28:41 +01:00
committed by Roman Bapst
parent 2e50277695
commit 7ef2bff0a2
3 changed files with 29 additions and 11 deletions
@@ -411,6 +411,23 @@ TEST_F(FeasibilityCheckerTest, fixed_wing_landing)
mission_item.nav_cmd = NAV_CMD_DO_LAND_START;
checker.processNextItem(mission_item, 2, 3);
ASSERT_EQ(checker.someCheckFailed(), true);
checker.reset();
param_t param = param_handle(px4::params::MIS_TKO_LAND_REQ);
// not takeoff land requiremntes, check should pass
int param_val = 0;
param_set(param, &param_val);
checker.paramsChanged();
checker.publishHomePosition(0, 0, 100);
checker.publishVehicleType(vehicle_status_s::VEHICLE_TYPE_FIXED_WING);
mission_item.nav_cmd = NAV_CMD_WAYPOINT;
checker.processNextItem(mission_item, 0, 3);
mission_item.nav_cmd = NAV_CMD_DO_LAND_START;
checker.processNextItem(mission_item, 1, 3);
mission_item.nav_cmd = NAV_CMD_LAND;
checker.processNextItem(mission_item, 2, 3);
ASSERT_EQ(checker.someCheckFailed(), false);
}
TEST_F(FeasibilityCheckerTest, check_takeoff_land_requirements)