Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_Airspeed/AP_Airspeed_DroneCAN.h
Views: 1798
#pragma once12#include "AP_Airspeed_config.h"34#if AP_AIRSPEED_DRONECAN_ENABLED56#include "AP_Airspeed_Backend.h"78#include <AP_DroneCAN/AP_DroneCAN.h>910class AP_Airspeed_DroneCAN : public AP_Airspeed_Backend {11public:1213using AP_Airspeed_Backend::AP_Airspeed_Backend;1415bool init(void) override;1617// return the current differential_pressure in Pascal18bool get_differential_pressure(float &pressure) override;1920// temperature not available via analog backend21bool get_temperature(float &temperature) override;2223#if AP_AIRSPEED_HYGROMETER_ENABLE24// get hygrometer data25bool get_hygrometer(uint32_t &last_sample_ms, float &temperature, float &humidity) override;26#endif2728static bool subscribe_msgs(AP_DroneCAN* ap_dronecan);2930static AP_Airspeed_Backend* probe(AP_Airspeed &_frontend, uint8_t _instance, uint32_t previous_devid);3132private:3334static void handle_airspeed(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_air_data_RawAirData &msg);35static void handle_hygrometer(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const dronecan_sensors_hygrometer_Hygrometer &msg);3637static AP_Airspeed_DroneCAN* get_dronecan_backend(AP_DroneCAN* ap_dronecan, uint8_t node_id);3839float _pressure; // Pascal40float _temperature; // Celcius41uint32_t _last_sample_time_ms;4243// hygrometer data44struct {45float temperature;46float humidity;47uint32_t last_sample_ms;48} _hygrometer;4950HAL_Semaphore _sem_airspeed;5152// Module Detection Registry53static struct DetectedModules {54AP_DroneCAN* ap_dronecan;55uint8_t node_id;56AP_Airspeed_DroneCAN *driver;57} _detected_modules[AIRSPEED_MAX_SENSORS];5859static HAL_Semaphore _sem_registry;60bool _have_temperature;61};626364#endif // AP_AIRSPEED_DRONECAN_ENABLED656667