Set rate when subscribing to velocity, specify units

This commit is contained in:
Julian Kent 2020-07-10 12:57:31 +02:00 committed by Julian Kent
parent e6c5771c59
commit ff4be5d815
2 changed files with 6 additions and 4 deletions

View File

@ -246,14 +246,16 @@ void AutopilotTester::offboard_goto(const Offboard::PositionNedYaw &target, floa
std::cout << "Target position reached" << std::endl;
}
void AutopilotTester::check_mission_item_speed_above(int item_index, float min_speed)
void AutopilotTester::check_mission_item_speed_above(int item_index, float min_speed_m_s)
{
_telemetry->subscribe_velocity_ned([item_index, min_speed, this](Telemetry::VelocityNed velocity) {
_telemetry->set_rate_velocity_ned(10);
_telemetry->subscribe_velocity_ned([item_index, min_speed_m_s, this](Telemetry::VelocityNed velocity) {
float horizontal = std::hypot(velocity.north_m_s, velocity.east_m_s);
auto progress = _mission->mission_progress();
if (progress.current == item_index) {
CHECK(horizontal > min_speed);
CHECK(horizontal > min_speed_m_s);
}
});
}

View File

@ -80,7 +80,7 @@ public:
std::chrono::seconds timeout_duration = std::chrono::seconds(60));
void offboard_land();
void request_ground_truth();
void check_mission_item_speed_above(int item_index, float min_speed);
void check_mission_item_speed_above(int item_index, float min_speed_m_s);
void check_tracks_mission(float corridor_radius_m = 1.0f);