#include <fmt/core.h>
#include <spdlog/cfg/env.h>
#include <chrono>
#include <iostream>
#include <thread>
#include "drone/PioneerDrone.hpp"
int main() {
using namespace std::chrono_literals;
using namespace std;
spdlog::cfg::load_env_levels();
this_thread::sleep_for(1s);
spdlog::info("Initialze tilt...");
if (drone.
tilt()->calibrate()) {
spdlog::info("Tilt initialized");
} else {
spdlog::warn("Tilt initialization failed");
}
auto tilt_angle = drone.tilt()->get_angle();
if (tilt_angle.has_value()) {
spdlog::info("Tilt angle: {:.1f}", drone.tilt()->get_angle().value());
} else {
spdlog::warn("Tilt angle cannot be read");
}
drone.tilt()->set_velocity(1);
this_thread::sleep_for(1.5s);
drone.tilt()->set_velocity(-1);
this_thread::sleep_for(3s);
drone.tilt()->set_velocity(1);
this_thread::sleep_for(1.5s);
drone.tilt()->set_velocity(0);
drone.tilt()->set_stabilization(true);
this_thread::sleep_for(30s);
}
Class representing a drone.
Definition PioneerDrone.hpp:31