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_Compass/AP_Compass_DroneCAN.h
Views: 1798
#pragma once12#include "AP_Compass.h"34#if AP_COMPASS_DRONECAN_ENABLED56#include "AP_Compass_Backend.h"78#include <AP_DroneCAN/AP_DroneCAN.h>910class AP_Compass_DroneCAN : public AP_Compass_Backend {11public:12AP_Compass_DroneCAN(AP_DroneCAN* ap_dronecan, uint32_t devid);1314void read(void) override;1516static bool subscribe_msgs(AP_DroneCAN* ap_dronecan);17static AP_Compass_Backend* probe(uint8_t index);18static uint32_t get_detected_devid(uint8_t index) { return _detected_modules[index].devid; }19static void handle_magnetic_field(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_ahrs_MagneticFieldStrength& msg);20static void handle_magnetic_field_2(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const uavcan_equipment_ahrs_MagneticFieldStrength2 &msg);21#if AP_COMPASS_DRONECAN_HIRES_ENABLED22static void handle_magnetic_field_hires(AP_DroneCAN *ap_dronecan, const CanardRxTransfer& transfer, const dronecan_sensors_magnetometer_MagneticFieldStrengthHiRes &msg);23#endif2425private:26bool init();2728// callback for DroneCAN messages29void handle_mag_msg(const Vector3f &mag);3031static AP_Compass_DroneCAN* get_dronecan_backend(AP_DroneCAN* ap_dronecan, uint8_t node_id, uint8_t sensor_id);3233uint8_t _instance;3435uint32_t _devid;3637// Module Detection Registry38static struct DetectedModules {39AP_DroneCAN* ap_dronecan;40uint8_t node_id;41uint8_t sensor_id;42AP_Compass_DroneCAN *driver;43uint32_t devid;44} _detected_modules[COMPASS_MAX_BACKEND];4546static HAL_Semaphore _sem_registry;47};4849#endif // AP_COMPASS_DRONECAN_ENABLED505152