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_GPS/AP_GPS_Blended.h
Views: 1798
#pragma once12/*3This program is free software: you can redistribute it and/or modify4it under the terms of the GNU General Public License as published by5the Free Software Foundation, either version 3 of the License, or6(at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program. If not, see <http://www.gnu.org/licenses/>.15*/1617#pragma once1819#include "AP_GPS_config.h"2021#if AP_GPS_BLENDED_ENABLED2223#include "AP_GPS.h"24#include "GPS_Backend.h"2526class AP_GPS_Blended : public AP_GPS_Backend27{28public:2930AP_GPS_Blended(AP_GPS &_gps, AP_GPS::Params &_params, AP_GPS::GPS_State &_state, class AP_GPS::GPS_timing &_timing) :31AP_GPS_Backend(_gps, _params, _state, nullptr),32timing{_timing}33{ }3435// pre-arm check of GPS blending. False if blending is unhealthy,36// True if healthy or blending is not being used37bool is_healthy() const override {38return (_blend_health_counter < 50);39}4041bool read() override { return true; }4243const char *name() const override { return "Blended"; }4445bool get_lag(float &lag_sec) const override;46const Vector3f &get_antenna_offset() const {47return _blended_antenna_offset;48}4950// calculate the blend weight. Returns true if blend could be51// calculated, false if not52bool calc_weights(void);53// calculate the blended state54void calc_state(void);5556void zero_health_counter() {57_blend_health_counter = 0;58}5960private:6162// GPS blending and switching63Vector3f _blended_antenna_offset; // blended antenna offset64float _blended_lag_sec; // blended receiver lag in seconds65float _blend_weights[GPS_MAX_RECEIVERS]; // blend weight for each GPS. The blend weights must sum to 1.0 across all instances.66uint8_t _blend_health_counter; // 0 = perfectly health, 100 = very unhealthy6768AP_GPS::GPS_timing &timing;69bool _calc_weights(void);70};7172#endif // AP_GPS_BLENDED_ENABLED737475