mavsdk_tests: report speed factor every second

This helps in debugging slow CI.
This commit is contained in:
Julian Oes
2021-03-17 09:38:37 +01:00
committed by Daniel Agar
parent e05a4badf8
commit 1e88939605
5 changed files with 93 additions and 8 deletions

View File

@@ -44,13 +44,16 @@
#include <mavsdk/plugins/telemetry/telemetry.h>
#include <mavsdk/plugins/param/param.h>
#include "catch2/catch.hpp"
#include <atomic>
#include <chrono>
#include <ctime>
#include <iostream>
#include <memory>
#include <optional>
#include <thread>
extern std::string connection_url;
extern std::optional<float> speed_factor;
using namespace mavsdk;
using namespace mavsdk::geometry;
@@ -81,6 +84,9 @@ public:
Gps
};
AutopilotTester();
~AutopilotTester();
void connect(const std::string uri);
void wait_until_ready();
void wait_until_ready_local_position_only();
@@ -131,6 +137,8 @@ private:
void wait_for_landed_state(Telemetry::LandedState landed_state, std::chrono::seconds timeout);
void wait_for_mission_finished(std::chrono::seconds timeout);
void report_speed_factor();
template<typename Rep, typename Period>
bool poll_condition_with_timeout(
std::function<bool()> fun, std::chrono::duration<Rep, Period> duration)
@@ -216,4 +224,7 @@ private:
std::unique_ptr<mavsdk::Telemetry> _telemetry{};
Telemetry::GroundTruth _home{NAN, NAN, NAN};
std::atomic<bool> _should_exit {false};
std::thread _real_time_report_thread {};
};