2#include <eventpp/callbacklist.h>
8#include "DroneError.hpp"
9#include "imu/ThreadedMPU9250.hpp"
10#include "logging/Logger.hpp"
11#include "observer/PioneerObserver.hpp"
12#include "pmu/NonBlockingPMU.hpp"
13#include "pmu/TcpPmu.hpp"
14#include "sensors/FactoryPressureSensor.hpp"
15#include "sensors/PressureSensor.hpp"
16#include "thrust_allocation/ControlForce.hpp"
17#include "thrust_allocation/PioneerAllocator.hpp"
18#include "tilt/ITiltControl.hpp"
20namespace blunux::drone {
30class Drone :
public logging::Logger<Drone> {
32 explicit Drone(std::array<std::shared_ptr<imu::IImu>, 2> imu,
33 std::shared_ptr<pmu::IPMU> pmu,
34 std::shared_ptr<tilt::ITiltControl> tilt_controller);
146 void add_pressure_callback(std::function<
void(
const Pressure&)> cb);
147 void add_temperature_callback(std::function<
void(
const Temperature&)> cb);
148 void add_error_callback(std::function<
void(
const DroneError&)> cb);
150 std::shared_ptr<tilt::ITiltControl> tilt() {
151 return std::dynamic_pointer_cast<tilt::ITiltControl>(tilt_controller);
154 std::shared_ptr<observer::ICompassCalibration> compass_calibration() {
155 return observer->compass_calibration();
158 std::shared_ptr<pmu::IPMUCallbacks> pmu_callbacks() {
159 return std::dynamic_pointer_cast<pmu::IPMUCallbacks>(pmu);
162 std::shared_ptr<observer::IObserverState> observer_state() {
163 return std::dynamic_pointer_cast<observer::IObserverState>(observer);
173 if (optional_pressure_sensor.has_value()) {
174 optional_pressure_sensor.value()->set_fluid_density(density);
184 return optional_pressure_sensor.has_value()
185 ? optional_pressure_sensor.value()->get_fluid_density()
194 return optional_pressure_sensor.has_value()
195 ? optional_pressure_sensor.value()->get_sensor_type()
196 : blueye::protocol::PRESSURE_SENSOR_TYPE_UNSPECIFIED;
199 void clear_callbacks();
202 const std::array<std::shared_ptr<imu::IImu>, 2> imu;
204 const std::shared_ptr<pmu::IPMU> pmu;
206 std::shared_ptr<observer::PioneerObserver> observer;
209 std::optional<std::unique_ptr<sensors::PressureSensor>>
210 optional_pressure_sensor =
211 sensors::FactoryPressureSensor::create_sensor();
214 std::optional<blunux::sensors::Pressure> pressure;
215 std::optional<blunux::sensors::Temperature> temperature;
219 std::shared_ptr<tilt::ITiltControl> tilt_controller;
221 eventpp::CallbackList<void(
const Pressure&)> callbacks_pressure;
222 eventpp::CallbackList<void(
const Temperature&)> callbacks_temperature;
223 eventpp::CallbackList<void(
const DroneError&)> callbacks_error;
Class representing a drone.
Definition Drone.hpp:30
float get_depth(bool wait_for_data=true) const
Get the depth.
imu::ImuData get_imu_raw(unsigned int n) const
Get the raw IMU data of IMU.
std::string get_blunux_version() const
Get the Blunux version.
imu::ImuData get_imu() const
Get the calibrated IMU data.
void set_fluid_density(double density)
Set the fluid density to change between saltwater and freshwater for the depth output.
Definition Drone.hpp:172
void set_indicator(blunux::pmu::IndicatorsSetpoint indicators)
Enable/diable the indicators on the light board.
double get_fluid_density() const
Get the fluid density.
Definition Drone.hpp:183
float get_light() const
Get the current light intensity.
sensors::DepthSelfTestResult depth_self_test() const
Get the depth self test result.
imu::ImuSelfTest imu_self_test(unsigned int n) const
Get the IMU self test result.
float get_water_temperature(bool wait_for_data=true) const
Get the water temperature.
void set_light(float intensity)
Sets intensity of the drone lights.
blueye::protocol::PressureSensorType get_depth_sensor_type() const
Get the depth sensor type.
Definition Drone.hpp:193
std::string get_model_name() const
Get the model name.
pmu::IndicatorsSetpoint get_indicator() const
Get the indicator status.
std::optional< std::string > get_battery_type(bool wait_for_data=true) const
Get the battery type.
std::optional< float > get_battery_percentage(bool wait_for_data=true) const
Get the battery percentage.
blueye::protocol::Model get_model() const
Get the drone Model.
Structure representing IMU data.
Definition ImuData.hpp:13
Structure representing IMU self-test results.
Definition ImuSelfTest.hpp:18
Structure representing setpoint values for indicators.
Definition IndicatorsSetpoint.hpp:13