- broke nearly everthing
- create Sensor Manager
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file sensors.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-02
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SENSORS_H
|
||||
#define SENSORS_H
|
||||
|
||||
#include <SPI.h>
|
||||
#include <iostream>
|
||||
//Sensors
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
#include <QMC5883LCompass.h>
|
||||
// Gyroskop
|
||||
|
||||
#include "component.h"
|
||||
#include "sensorData.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
class Sensors : public Component {
|
||||
public:
|
||||
enum CalcAzimuthState {
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
Good,
|
||||
Super
|
||||
};
|
||||
|
||||
Sensors();
|
||||
|
||||
void run() override;
|
||||
void runAsChild() override;
|
||||
|
||||
void enableGnss(SPIClass* spiPort, uint8_t csPin);
|
||||
void enableGnss();
|
||||
void enableCompass();
|
||||
void enableGyroskop();
|
||||
|
||||
/**
|
||||
* @brief Set the output status for PVTdata.
|
||||
*
|
||||
* If this is true, a lot of information from the gnss module will be printed in
|
||||
* the interval of navigation frequency.
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
static void setOutputStatusPrintPVTdata(bool status);
|
||||
|
||||
private:
|
||||
void initGnss();
|
||||
|
||||
QMC5883LCompass* compass = nullptr;
|
||||
SFE_UBLOX_GNSS* gnss = nullptr;
|
||||
|
||||
CalcAzimuthState calcAzimuthState = CalcAzimuthState::Invalid;
|
||||
|
||||
int16_t realAzimuth = INT16_MAX;
|
||||
|
||||
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
||||
static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
||||
|
||||
static UBX_NAV_PVT_data_t* ubxDataStatic;
|
||||
|
||||
static uint32_t ubxUpdateTimeStatic;
|
||||
|
||||
static bool outputStatusPrintPVTdata;
|
||||
static bool newData;
|
||||
};
|
||||
|
||||
#endif // SENSORS_H
|
||||
Reference in New Issue
Block a user