Skip to content

Commit

Permalink
missionFeasibilityChecker: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradRudin committed Mar 6, 2024
1 parent 1ed1ffd commit 4636069
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ class TestFeasibilityChecker : public FeasibilityChecker
orb_publish(ORB_ID(home_position), home_pub, &home);
}

void publishInvalidHome()
{
home_position_s home = {};
home.alt = 0.f;
home.valid_alt = false;
home.lat = 0.;
home.lon = 0.;
home.valid_hpos = false;
orb_advert_t home_pub = orb_advertise(ORB_ID(home_position), &home);
orb_publish(ORB_ID(home_position), home_pub, &home);
}

void publishCurrentPosition(double lat, double lon)
{
vehicle_global_position_s gpos = {};
Expand Down Expand Up @@ -122,6 +134,7 @@ TEST_F(FeasibilityCheckerTest, mission_item_validity)
ASSERT_EQ(ret, false);

checker.reset();
checker.publishInvalidHome();
mission_item.nav_cmd = NAV_CMD_TAKEOFF;
mission_item.altitude_is_relative = true;
ret = checker.processNextItem(mission_item, 0, 5);
Expand Down Expand Up @@ -190,6 +203,7 @@ TEST_F(FeasibilityCheckerTest, check_below_home)

// this is done to invalidate the home position
checker.reset();
checker.publishInvalidHome();
checker.publishLanded(true);
checker.processNextItem(mission_item, 0, 1);

Expand Down

0 comments on commit 4636069

Please sign in to comment.