Skip to content
Snippets Groups Projects
Select Git revision
  • sbs-args-rework
  • twelve-param-correction
  • nas-pitot-correction
  • main default protected
  • nd015x-dma
  • logger-documentation
  • arp
  • arp-gyro
  • async-fsm
  • chipselect-mux
  • nas-catch-dev
  • parafoil-mavlink-upd
  • mockup-main-software
  • quadspi-flash
  • quadspi-flash2
  • sx1278-resilience
  • units-impl
  • nokia-tm-dev
  • spi
  • cc3135
  • ARP-pre-2.7
  • PYXIS_ROCCARASO
  • PYXIS_EUROC
  • lynx-euroc
  • hermes-v1.0
  • hermes-flight-1
26 results

ReferenceValues.h

Blame
  • ReferenceValues.h 3.28 KiB
    /* Copyright (c) 2018-2021 Skyward Experimental Rocketry
     * Authors: Luca Mozzarelli, Luca Conterio, Alberto Nidasio
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    
    #pragma once
    
    #include <utils/Constants.h>
    
    #include <Eigen/Eigen>
    #include <ostream>
    
    namespace Boardcore
    {
    
    /**
     * @brief Reference values for the Apogee Detection Algorithm.
     */
    struct ReferenceValues
    {
        // Launch site parameters
        float refAltitude;
        float refPressure;
        float refTemperature;
        float refLatitude;
        float refLongitude;
    
        // Pressure and temperature at mean sea level for altitude calculation
        float mslPressure    = Constants::MSL_PRESSURE;
        float mslTemperature = Constants::MSL_TEMPERATURE;
    
        ReferenceValues() {};
    
        ReferenceValues(float altitude, float pressure, float temperature,
                        float refLatitude    = Constants::B21_LATITUDE,
                        float refLongitude   = Constants::B21_LONGITUDE,
                        float mslPressure    = Constants::MSL_PRESSURE,
                        float mslTemperature = Constants::MSL_TEMPERATURE)
            : refAltitude(altitude), refPressure(pressure),
              refTemperature(temperature), refLatitude(refLatitude),
              refLongitude(refLongitude), mslPressure(mslPressure),
              mslTemperature(mslTemperature)
        {
        }
    
        static std::string header()
        {
            return "refAltitude,refPressure,refTemperature,refLatitude,"
                   "refLongitude,"
                   "mslPressure,mslTemperature\n";
        }
    
        void print(std::ostream& os) const
        {
            os << refAltitude << "," << refPressure << "," << refTemperature << ","
               << refLatitude << "," << refLongitude << "," << mslPressure << ","
               << mslTemperature << "\n";
        }
    
        bool operator==(const ReferenceValues& other) const
        {
            return refAltitude == other.refAltitude &&
                   refPressure == other.refPressure &&
                   refTemperature == other.refTemperature &&
                   refLatitude == other.refLatitude &&
                   refLongitude == other.refLongitude &&
                   mslPressure == other.mslPressure &&
                   mslTemperature == other.mslTemperature;
        }
    
        bool operator!=(const ReferenceValues& other) const
        {
            return !(*this == other);
        }
    };
    
    }  // namespace Boardcore