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_DAL/AP_DAL_Beacon.h
Views: 1798
#pragma once12#include <AP_Beacon/AP_Beacon.h>34#if AP_BEACON_ENABLED56#include <AP_Logger/LogStructure.h>78class AP_DAL_Beacon {9public:1011// Beacon-like methods:12uint8_t count() const {13return _RBCH.count;14}1516bool get_origin(Location &loc) const {17loc.zero();18loc.lat = _RBCH.origin_lat;19loc.lng = _RBCH.origin_lng;20loc.alt = _RBCH.origin_alt;21return _RBCH.get_origin_returncode;22}2324// return beacon enabled25bool enabled(void) const {26return _RBCH.enabled;27}2829// return beacon health30bool beacon_healthy(uint8_t i) const {31return _RBCI[i].healthy;32}3334// return last update time from beacon in milliseconds35uint32_t beacon_last_update_ms(uint8_t i) const {36return _RBCI[i].last_update_ms;37}3839// return distance to beacon in meters40float beacon_distance(uint8_t i) const {41return _RBCI[i].distance;42}4344// return NED position of beacon in meters relative to the beacon systems origin45const Vector3f &beacon_position(uint8_t i) const {46return _RBCI[i].position;47}4849// return vehicle position in NED from position estimate system's origin in meters50bool get_vehicle_position_ned(Vector3f& pos, float& accuracy_estimate) const {51pos = _RBCH.vehicle_position_ned;52accuracy_estimate = _RBCH.accuracy_estimate;53return _RBCH.get_vehicle_position_ned_returncode;54}5556// AP_DAL methods:57AP_DAL_Beacon();5859AP_DAL_Beacon *beacon() {60return this;61}6263void start_frame();6465void handle_message(const log_RBCH &msg) {66_RBCH = msg;67}68void handle_message(const log_RBCI &msg) {69_RBCI[msg.instance] = msg;70}7172private:7374struct log_RBCH _RBCH;75struct log_RBCI _RBCI[AP_BEACON_MAX_BEACONS];76};7778#endif // AP_BEACON_ENABLED798081