diff --git a/src/boards/Parafoil/Configs/SensorsConfig.h b/src/boards/Parafoil/Configs/SensorsConfig.h index 8a191f1a66627dadd539c2e46b9361b0e3954909..6806eda589bae85e5ae4d8c0d54a3b0d1cdee63e 100644 --- a/src/boards/Parafoil/Configs/SensorsConfig.h +++ b/src/boards/Parafoil/Configs/SensorsConfig.h @@ -75,7 +75,7 @@ constexpr Boardcore::LPS22DF::ODR LPS22DF_ODR = Boardcore::LPS22DF::ODR_100; constexpr uint32_t LPS22DF_PERIOD = 20; // [ms] 50Hz // UBXGPS -constexpr uint8_t UBXGPS_SAMPLE_RATE = 5; +constexpr uint8_t UBXGPS_SAMPLE_RATE = 10; constexpr uint32_t UBXGPS_PERIOD = 1000 / UBXGPS_SAMPLE_RATE; // [ms] // ADS diff --git a/src/boards/Parafoil/Configs/WingConfig.h b/src/boards/Parafoil/Configs/WingConfig.h index 3aba0fcf013ef402870d0d11d892312c53d8ecb5..cc0c7fe16aa63d88c99fc854b25e4ced1ac17f74 100644 --- a/src/boards/Parafoil/Configs/WingConfig.h +++ b/src/boards/Parafoil/Configs/WingConfig.h @@ -43,13 +43,8 @@ constexpr int SELECTED_ALGORITHM = 2; constexpr int SELECTED_ALGORITHM = 0; #endif -#if defined(JESOLO) -constexpr float DEFAULT_TARGET_LAT = 45.565835; -constexpr float DEFAULT_TARGET_LON = 12.577307; -#else // Milan -constexpr float DEFAULT_TARGET_LAT = 45.565835; -constexpr float DEFAULT_TARGET_LON = 12.577307; -#endif +constexpr float DEFAULT_TARGET_LAT = 45.5013853; +constexpr float DEFAULT_TARGET_LON = 9.1544219; constexpr int WING_STRAIGHT_FLIGHT_TIMEOUT = 15 * 1000; // [ms] diff --git a/src/boards/Parafoil/Sensors/Sensors.cpp b/src/boards/Parafoil/Sensors/Sensors.cpp index f3114239918ec8309c15442d1ccb72442f09bbee..9084ff87dd3410dcbf87904661e1ce8829cbe55b 100644 --- a/src/boards/Parafoil/Sensors/Sensors.cpp +++ b/src/boards/Parafoil/Sensors/Sensors.cpp @@ -132,7 +132,6 @@ bool Sensors::start() lis3mdlInit(); h3lisInit(); lps22Init(); - // lps22DevInit(); ubxGpsInit(); ads131Init(); internalADCInit(); @@ -338,36 +337,6 @@ void Sensors::lps22Init() sensorsInit[sensorsCounter++] = lps22Status; } -void Sensors::lps22DevInit() -{ - ModuleManager& modules = ModuleManager::getInstance(); - miosix::GpioPin cs(GPIOG_BASE, 7); - cs.mode(miosix::Mode::OUTPUT); - cs.high(); - // Get the correct SPI configuration - SPIBusConfig config = LPS22DF::getDefaultSPIConfig(); - config.clockDivider = SPI::ClockDivider::DIV_16; - - // Configure the device - LPS22DF::Config sensorConfig; - sensorConfig.avg = LPS22DF_AVG; - sensorConfig.odr = LPS22DF_ODR; - - // Create sensor instance with configured parameters - lps22dfDev = - new LPS22DF(modules.get<Buses>()->spi1, cs, config, sensorConfig); - - // Emplace the sensor inside the map - SensorInfo info("LPS22DFDev", LPS22DF_PERIOD, - bind(&Sensors::lps22DevCallback, this)); - sensorMap.emplace(make_pair(lps22dfDev, info)); - - // used for the sensor state - // auto lps22DevStatus = - // ([&]() -> SensorInfo { return manager->getSensorInfo(lps22dfDev); }); - // sensorsInit[sensorsCounter++] = lps22DevStatus; -} - void Sensors::ubxGpsInit() { ModuleManager& modules = ModuleManager::getInstance(); @@ -500,15 +469,7 @@ void Sensors::h3lisCallback() void Sensors::lps22Callback() { - LPS22DF1_Data lastSample = - static_cast<LPS22DF1_Data>(lps22df->getLastSample()); - Logger::getInstance().log(lastSample); -} - -void Sensors::lps22DevCallback() -{ - LPS22DF2_Data lastSample = - static_cast<LPS22DF2_Data>(lps22dfDev->getLastSample()); + LPS22DFData lastSample = lps22df->getLastSample(); Logger::getInstance().log(lastSample); } diff --git a/src/boards/Parafoil/Sensors/Sensors.h b/src/boards/Parafoil/Sensors/Sensors.h index 7813c4472e4a3a9dfb8c4e81a672b53a9d71083e..26316ac973458ef1051b40976efd14c54b3fbc10 100644 --- a/src/boards/Parafoil/Sensors/Sensors.h +++ b/src/boards/Parafoil/Sensors/Sensors.h @@ -29,7 +29,6 @@ #include <sensors/H3LIS331DL/H3LIS331DL.h> #include <sensors/LIS3MDL/LIS3MDL.h> #include <sensors/LPS22DF/LPS22DF.h> -#include <sensors/SensorData.h> #include <sensors/SensorManager.h> #include <sensors/UBXGPS/UBXGPSSpi.h> #include <sensors/analog/BatteryVoltageSensor.h> @@ -37,8 +36,6 @@ #include <utils/ModuleManager/ModuleManager.hpp> -#include "SensorsData.h" - namespace Parafoil { @@ -105,9 +102,6 @@ private: void lps22Init(); void lps22Callback(); - void lps22DevInit(); - void lps22DevCallback(); - void ubxGpsInit(); void ubxGpsCallback(); @@ -124,7 +118,6 @@ private: Boardcore::LIS3MDL* lis3mdl = nullptr; Boardcore::H3LIS331DL* h3lis331dl = nullptr; Boardcore::LPS22DF* lps22df = nullptr; - Boardcore::LPS22DF* lps22dfDev = nullptr; Boardcore::UBXGPSSpi* ubxGps = nullptr; Boardcore::ADS131M08* ads131 = nullptr; Boardcore::InternalADC* internalADC = nullptr; @@ -136,7 +129,6 @@ private: // Mutexes for sampling miosix::FastMutex lis3mdlMutex; miosix::FastMutex lps22Mutex; - miosix::FastMutex lps22DevMutex; miosix::FastMutex h3lisMutex; miosix::FastMutex bmx160Mutex; miosix::FastMutex bmx160WithCorrectionMutex; diff --git a/src/boards/Parafoil/Sensors/SensorsData.h b/src/boards/Parafoil/Sensors/SensorsData.h deleted file mode 100644 index d9ea92d2562891a95cba3d5638c65e6da47f9865..0000000000000000000000000000000000000000 --- a/src/boards/Parafoil/Sensors/SensorsData.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* Copyright (c) 2023 Skyward Experimental Rocketry - * Author: Matteo Pignataro, Federico Mandelli - * - * 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 <sensors/LPS22DF/LPS22DFData.h> -namespace Parafoil -{ -struct LPS22DF1_Data : Boardcore::LPS22DFData -{ - explicit LPS22DF1_Data(const Boardcore::LPS22DFData& data) - : Boardcore::LPS22DFData(data) - { - } - - LPS22DF1_Data() {} - - static std::string header() - { - return "pressureTimestamp,pressure,temperatureTimestamp,temperature\n "; - } - - void print(std::ostream& os) const - { - os << pressureTimestamp << "," << pressure << "," - << temperatureTimestamp << "," << temperature << "\n"; - } -}; - -struct LPS22DF2_Data : Boardcore::LPS22DFData -{ - explicit LPS22DF2_Data(const Boardcore::LPS22DFData& data) - : Boardcore::LPS22DFData(data) - { - } - - LPS22DF2_Data() {} - - static std::string header() - { - return "pressureTimestamp,pressure,temperatureTimestamp,temperature\n "; - } - - void print(std::ostream& os) const - { - os << pressureTimestamp << "," << pressure << "," - << temperatureTimestamp << "," << temperature << "\n"; - } -}; -} // namespace Parafoil