compilation works again
This commit is contained in:
@@ -21,7 +21,7 @@ void CalcAzimuth::drivingDirectionChange(Point point) {
|
||||
if (point.isInit() && point.isValid()) {
|
||||
this->directionChangeMode = true;
|
||||
this->lastChangePoint = point;
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ void CalcAzimuth::updateCurrentPosition(Point point) {
|
||||
this->positionChanged = true;
|
||||
}
|
||||
|
||||
void CalcAzimuth::CalcAzimuth::run() {
|
||||
void CalcAzimuth::run() {
|
||||
if (!this->positionChanged)
|
||||
return
|
||||
return;
|
||||
|
||||
this->positionChanged = false;
|
||||
this->updateAzimuth();
|
||||
@@ -42,47 +42,47 @@ void CalcAzimuth::updateAzimuth() {
|
||||
if (!this->directionChangeMode
|
||||
|| this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
||||
{
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
this->calcAzimuth = 999;
|
||||
return;
|
||||
}
|
||||
|
||||
this->calcAzimuth = this->lastChangePoint.courseTo(this->currentPosition);
|
||||
|
||||
// Map point accuracy to CalcAzimuthState
|
||||
// Map point accuracy to State
|
||||
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Good;
|
||||
this->state = State::Good;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Ok;
|
||||
this->state = State::Ok;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
||||
{
|
||||
this->state = CalcAzimuthState::Bad;
|
||||
this->state = State::Bad;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->state = CalcAzimuthState::Invalid;
|
||||
this->state = State::Invalid;
|
||||
}
|
||||
|
||||
// Upgrade quality if the range grows up
|
||||
if (this->lastChangePoint.distanceTo(this->currentPosition) > 2.0) {
|
||||
switch (this->state) {
|
||||
case CalcAzimuthState::Bad :
|
||||
this->state = CalcAzimuthState::Ok;
|
||||
case State::Bad :
|
||||
this->state = State::Ok;
|
||||
break;
|
||||
|
||||
case CalcAzimuthState::Ok :
|
||||
this->state = CalcAzimuthState::Good;
|
||||
case State::Ok :
|
||||
this->state = State::Good;
|
||||
break;
|
||||
|
||||
case CalcAzimuthState::Good :
|
||||
this->state = CalcAzimuthState::Super;
|
||||
case State::Good :
|
||||
this->state = State::Super;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class CalcAzimuth : public Component {
|
||||
public:
|
||||
enum CalcAzimuthState {
|
||||
enum State {
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
@@ -32,13 +32,13 @@ class CalcAzimuth : public Component {
|
||||
void disableCalcAzimuth() { this->directionChangeMode = false; }
|
||||
|
||||
int16_t getAzimuth() const { return this->calcAzimuth; }
|
||||
CalcAzimuthState getState() const { return this->state; }
|
||||
State getState() const { return this->state; }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void updateAzimuth();
|
||||
|
||||
CalcAzimuthState state = CalcAzimuthState::Invalid;
|
||||
State state = State::Invalid;
|
||||
Point lastChangePoint;
|
||||
Point currentPosition;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class ControlPad : public Component {
|
||||
|
||||
void setMenuControl(MenuControl* menuControl) { this->menuControl = menuControl; }
|
||||
|
||||
const ControlPadInput * getControlPadDataPtr() const { return &this->controlInput; }
|
||||
const ControlPadInput* getControlPadDataPtr() const { return &this->controlInput; }
|
||||
|
||||
bool isControlPadConnected() const { return this->connected; }
|
||||
|
||||
|
||||
@@ -11,18 +11,12 @@
|
||||
|
||||
#include "navigation.h"
|
||||
|
||||
bool Navigation::outputStatusPrintPVTdata = false;
|
||||
bool Navigation::newData = false;
|
||||
uint32_t Navigation::ubxUpdateTimeStatic = 0;
|
||||
UBX_NAV_PVT_data_t* Navigation::ubxDataStatic = nullptr;
|
||||
|
||||
Navigation::Navigation(Route* route) {
|
||||
Navigation::Navigation(const SensorData* sensorData, Route* route) {
|
||||
this->sensorData = sensorData;
|
||||
this->init(route);
|
||||
}
|
||||
|
||||
void Navigation::init(Route* route) {
|
||||
|
||||
|
||||
if (route)
|
||||
this->route = route;
|
||||
else
|
||||
@@ -33,23 +27,9 @@ void Navigation::init(Route* route) {
|
||||
|
||||
Navigation::~Navigation() {
|
||||
delete this->route;
|
||||
if (this->ntripClient)
|
||||
delete this->ntripClient;
|
||||
}
|
||||
|
||||
void Navigation::initNtrip(String host, uint16_t port, String mountPoint, String user, String password) {
|
||||
this->ntripClient = new NTRIPClient(this->gps, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str());
|
||||
this->ntripClient->gpsConfiguration();
|
||||
this->ntripClient->loop();
|
||||
this->ntripClient->setActivated(false);
|
||||
this->isNtripInit = true;
|
||||
this->addChildComponent(this->ntripClient);
|
||||
}
|
||||
|
||||
void Navigation::run() {
|
||||
this->updateMagneticDeclination();
|
||||
}
|
||||
|
||||
void Navigation::run() {}
|
||||
|
||||
void Navigation::newRoute() {
|
||||
if (this->route)
|
||||
@@ -119,31 +99,31 @@ Navigation::Status Navigation::addCurrentPosToRoute() {
|
||||
return Status::Unchanged;
|
||||
}
|
||||
|
||||
void Navigation::updateCurrentLocation() {
|
||||
if (Navigation::ubxUpdateTimeStatic == this->ubxUpdateTime)
|
||||
return;
|
||||
// void Navigation::updateCurrentLocation() {
|
||||
// if (Navigation::ubxUpdateTimeStatic == this->ubxUpdateTime)
|
||||
// return;
|
||||
|
||||
this->ubxData = Navigation::ubxDataStatic;
|
||||
this->ubxUpdateTime = Navigation::ubxUpdateTimeStatic;
|
||||
// this->ubxData = Navigation::ubxDataStatic;
|
||||
// this->ubxUpdateTime = Navigation::ubxUpdateTimeStatic;
|
||||
|
||||
Point::Coordinates coords;
|
||||
coords.lat = this->ubxData->lat / 10000000.0;
|
||||
coords.lon = this->ubxData->lon / 10000000.0;
|
||||
// Point::Coordinates coords;
|
||||
// coords.lat = this->ubxData->lat / 10000000.0;
|
||||
// coords.lon = this->ubxData->lon / 10000000.0;
|
||||
|
||||
this->currentPosition = Point(coords, this->ubxData->hAcc);
|
||||
}
|
||||
// this->currentPosition = Point(coords, this->ubxData->hAcc);
|
||||
// }
|
||||
|
||||
int16_t Navigation::calculateCourseCorrection(Point& point) {
|
||||
int16_t targetCourse = point.courseTo(this->targetPoint);
|
||||
int16_t correctionCourse;
|
||||
|
||||
if (this->calcAzimuthState == CalcAzimuthState::Good
|
||||
|| this->calcAzimuthState == CalcAzimuthState::Super)
|
||||
if (this->sensorData->getCalcAzimuthState() == CalcAzimuth::State::Good
|
||||
|| this->sensorData->getCalcAzimuthState() == CalcAzimuth::State::Super)
|
||||
{
|
||||
correctionCourse = targetCourse - this->calcAzimuth;
|
||||
correctionCourse = targetCourse - this->sensorData->getCalcAzimuth();
|
||||
this->lastUsedCalcAzimuth = true;
|
||||
} else {
|
||||
correctionCourse = targetCourse - this->realAzimuth;
|
||||
correctionCourse = targetCourse - this->sensorData->getRealAzimuth();
|
||||
this->lastUsedCalcAzimuth = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "route.h"
|
||||
#include "NTRIPClient.h"
|
||||
|
||||
#include "sensorData.h"
|
||||
#include "component.h"
|
||||
|
||||
/**
|
||||
@@ -54,7 +53,7 @@ class Navigation : public Component {
|
||||
*
|
||||
* @param route with which to navigate
|
||||
*/
|
||||
Navigation(Route* route = nullptr);
|
||||
Navigation(const SensorData* sensorData, Route* route = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Destroy the Navigation object
|
||||
@@ -62,17 +61,6 @@ class Navigation : public Component {
|
||||
*/
|
||||
~Navigation();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param host
|
||||
* @param port
|
||||
* @param mountPoint
|
||||
* @param user
|
||||
* @param password
|
||||
*/
|
||||
void initNtrip(String host, uint16_t port, String mountPoint, String user, String password);
|
||||
|
||||
/**
|
||||
* @brief creates a new empty route
|
||||
*
|
||||
@@ -118,22 +106,6 @@ class Navigation : public Component {
|
||||
* @return false no point added to route
|
||||
*/
|
||||
Status addCurrentPosToRoute();
|
||||
|
||||
/**
|
||||
* @brief Get the Ubx Data object
|
||||
*
|
||||
* This struct includes the most Data from the GNSS-Module.
|
||||
*
|
||||
* @return UBX_NAV_PVT_data_t*
|
||||
*/
|
||||
UBX_NAV_PVT_data_t* getUbxData() { return this->ubxData; }
|
||||
|
||||
/**
|
||||
* @brief Returns the NTRIPClient object
|
||||
*
|
||||
* @return NTRIPClient*
|
||||
*/
|
||||
NTRIPClient* getNTRIPClient() { return this->ntripClient; }
|
||||
|
||||
/**
|
||||
* @brief Get the Route Info object
|
||||
@@ -163,12 +135,9 @@ class Navigation : public Component {
|
||||
static constexpr uint8_t loopDelay = 20;
|
||||
static constexpr uint8_t maxDisBetweenPoints = 10;
|
||||
static constexpr float minDisBetweenPoints = 0.3;
|
||||
|
||||
|
||||
UBX_NAV_PVT_data_t* ubxData = nullptr;
|
||||
Route* route = nullptr;
|
||||
NTRIPClient* ntripClient = nullptr;
|
||||
|
||||
const SensorData* sensorData;
|
||||
Route* route = nullptr;
|
||||
|
||||
Point lastPointRouteInsert;
|
||||
Point lastPointCalcCorrection;
|
||||
@@ -177,7 +146,6 @@ class Navigation : public Component {
|
||||
Point currentPosition;
|
||||
Point::Accuracy minAccuracy = Point::Accuracy::twoDigOfCM;
|
||||
|
||||
|
||||
bool navigationStarted = false;
|
||||
bool navigationFinished = false;
|
||||
bool isNtripInit = false;
|
||||
@@ -185,13 +153,7 @@ class Navigation : public Component {
|
||||
bool directionChangeMode = false;
|
||||
bool lastUsedCalcAzimuth = false;
|
||||
|
||||
char* host;
|
||||
char* mountPoint;
|
||||
char* user;
|
||||
char* password;
|
||||
|
||||
uint8_t timeToWait = 200;
|
||||
uint16_t port;
|
||||
uint32_t lastMillis = 0;
|
||||
uint32_t ubxUpdateTime = 0;
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "point.h"
|
||||
|
||||
Point::Point(double lat, double lon, uint32_t horizontalAccuracy, uint32_t creationTime) {
|
||||
this->coordinates.lat = lat;
|
||||
this->coordinates.lon = lon;
|
||||
|
||||
@@ -9,13 +9,32 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sensors.h"
|
||||
#include "sensorData.h"
|
||||
|
||||
Sensors::Sensors() {
|
||||
this->sensorData = new SensorData(this);
|
||||
bool SensorData::outputStatusPrintPVTdata = false;
|
||||
bool SensorData::newData = false;
|
||||
uint32_t SensorData::ubxUpdateTimeStatic = 0;
|
||||
UBX_NAV_PVT_data_t* SensorData::ubxDataStatic = nullptr;
|
||||
|
||||
SensorData::SensorData() {
|
||||
this->loopDelay = 50;
|
||||
}
|
||||
|
||||
void Sensors::enableGnss(SPIClass* spiPort, uint8_t csPin) {
|
||||
SensorData::~SensorData() {
|
||||
if (this->ntripClient)
|
||||
delete this->ntripClient;
|
||||
}
|
||||
|
||||
void SensorData::enableNtrip(String host, uint16_t port, String mountPoint, String user, String password) {
|
||||
this->ntripClient = new NTRIPClient(this->gnss, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str());
|
||||
this->ntripClient->gpsConfiguration();
|
||||
this->ntripClient->loop();
|
||||
this->ntripClient->setActivated(false);
|
||||
this->isNtripInit = true;
|
||||
this->addChildComponent(this->ntripClient);
|
||||
}
|
||||
|
||||
void SensorData::enableGnss(SPIClass* spiPort, uint8_t csPin) {
|
||||
this->gnss = new SFE_UBLOX_GNSS();
|
||||
if (this->gnss->begin(*spiPort, csPin, 4000000) == false) {
|
||||
std::cout << "u-blox GNSS not detected on SPI bus. Please check wiring. Freezing." << std::endl;
|
||||
@@ -24,7 +43,7 @@ void Sensors::enableGnss(SPIClass* spiPort, uint8_t csPin) {
|
||||
this->initGnss();
|
||||
}
|
||||
|
||||
void Sensors::enableGnss() {
|
||||
void SensorData::enableGnss() {
|
||||
this->gnss = new SFE_UBLOX_GNSS();
|
||||
if (this->gnss->begin() == false) {
|
||||
std::cout << "u-blox GNSS not detected at default I2C address. Please check wiring. Freezing." << std::endl;
|
||||
@@ -33,52 +52,35 @@ void Sensors::enableGnss() {
|
||||
this->initGnss();
|
||||
}
|
||||
|
||||
void Sensors::enableCompass() {
|
||||
this->compass = new QMC5883LCompass();
|
||||
void SensorData::enableRealCompass() {
|
||||
this->realCompass = new QMC5883LCompass();
|
||||
// Init Compass
|
||||
Wire.beginTransmission(0x0d);
|
||||
Wire.write(0x0b);
|
||||
Wire.write(0x01);
|
||||
Wire.endTransmission();
|
||||
this->compass->setMode(0x01,0x0C,0x10,0X00);
|
||||
CalibrateCompass caliCompass(this->compass);
|
||||
this->realCompass->setMode(0x01,0x0C,0x10,0X00);
|
||||
CalibrateCompass caliCompass(this->realCompass);
|
||||
caliCompass.loadData();
|
||||
caliCompass.useData();
|
||||
}
|
||||
|
||||
void Sensors::setOutputStatusPrintPVTdata(bool status) {
|
||||
Sensors::outputStatusPrintPVTdata = status;
|
||||
void SensorData::enableCalcCompass() {
|
||||
|
||||
}
|
||||
|
||||
void Sensors::run() {
|
||||
this->compass->read();
|
||||
this->realAzimuth = this->compass->getAzimuth();
|
||||
void SensorData::enableGyroskop() {
|
||||
|
||||
}
|
||||
|
||||
void Sensors::runAsChild() {
|
||||
this->gnss->checkUblox();
|
||||
this->gnss->checkCallbacks();
|
||||
|
||||
if (Sensors::newData)
|
||||
Sensors::newData = false;
|
||||
CalcAzimuth::State SensorData::getCalcAzimuthState() const {
|
||||
if (this->calcCompass)
|
||||
return this->calcCompass->getState();
|
||||
return CalcAzimuth::State::Invalid;
|
||||
}
|
||||
|
||||
void Sensors::initGnss() {
|
||||
uint8_t versionHigh = this->gnss->getProtocolVersionHigh();
|
||||
uint8_t versionLow = this->gnss->getProtocolVersionLow();
|
||||
std::cout << "u-blox protocol version: " << unsigned(versionHigh) << "." << unsigned(versionLow) << std::endl;
|
||||
|
||||
this->gnss->setSPIOutput(COM_TYPE_UBX);
|
||||
this->gnss->enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_SPI, 10);
|
||||
this->gnss->setUSBOutput(COM_TYPE_UBX | COM_TYPE_NMEA);
|
||||
this->gnss->setAutoPVTcallbackPtr(&(Sensors::savePVTdata));
|
||||
// Sensors::setOutputStatusPrintPVTdata(true);
|
||||
this->gnss->setNavigationFrequency(1);
|
||||
this->gnss->setAutoPVT(true);
|
||||
}
|
||||
|
||||
void Sensors::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
if (!Sensors::outputStatusPrintPVTdata)
|
||||
void SensorData::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
if (!SensorData::outputStatusPrintPVTdata)
|
||||
return;
|
||||
|
||||
double latitude = (double) ubxDataStruct->lat / 10000000.0;
|
||||
@@ -124,10 +126,41 @@ void Sensors::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
<< " Horizontal Accuracy Estimate: " << hAcc << " mm" << std::endl;
|
||||
}
|
||||
|
||||
void Sensors::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
Sensors::printPVTdata(ubxDataStruct);
|
||||
void SensorData::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||
SensorData::printPVTdata(ubxDataStruct);
|
||||
|
||||
Sensors::newData = true;
|
||||
Sensors::ubxDataStatic = ubxDataStruct;
|
||||
Sensors::ubxUpdateTimeStatic = millis();
|
||||
SensorData::newData = true;
|
||||
SensorData::ubxDataStatic = ubxDataStruct;
|
||||
SensorData::ubxUpdateTimeStatic = millis();
|
||||
}
|
||||
|
||||
void SensorData::setOutputStatusPrintPVTdata(bool status) {
|
||||
SensorData::outputStatusPrintPVTdata = status;
|
||||
}
|
||||
|
||||
void SensorData::run() {
|
||||
this->realCompass->read();
|
||||
this->realAzimuth = this->realCompass->getAzimuth();
|
||||
}
|
||||
|
||||
void SensorData::runAsChild() {
|
||||
this->gnss->checkUblox();
|
||||
this->gnss->checkCallbacks();
|
||||
|
||||
if (SensorData::newData)
|
||||
SensorData::newData = false;
|
||||
}
|
||||
|
||||
void SensorData::initGnss() {
|
||||
uint8_t versionHigh = this->gnss->getProtocolVersionHigh();
|
||||
uint8_t versionLow = this->gnss->getProtocolVersionLow();
|
||||
std::cout << "u-blox protocol version: " << unsigned(versionHigh) << "." << unsigned(versionLow) << std::endl;
|
||||
|
||||
this->gnss->setSPIOutput(COM_TYPE_UBX);
|
||||
this->gnss->enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_SPI, 10);
|
||||
this->gnss->setUSBOutput(COM_TYPE_UBX | COM_TYPE_NMEA);
|
||||
this->gnss->setAutoPVTcallbackPtr(&(SensorData::savePVTdata));
|
||||
// SensorData::setOutputStatusPrintPVTdata(true);
|
||||
this->gnss->setNavigationFrequency(1);
|
||||
this->gnss->setAutoPVT(true);
|
||||
}
|
||||
+75
-13
@@ -12,29 +12,91 @@
|
||||
#ifndef SENSOR_DATA_H
|
||||
#define SENSOR_DATA_H
|
||||
|
||||
#include "sensors.h"
|
||||
#include <SPI.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "component.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
#include <QMC5883LCompass.h>
|
||||
// Gyroskop
|
||||
#include "calcAzimuth.h"
|
||||
#include "ntripClient.h"
|
||||
|
||||
class SensorData {
|
||||
#include "point.h"
|
||||
class Sensors;
|
||||
|
||||
class SensorData : public Component {
|
||||
public:
|
||||
SensorData(Sensors *senors);
|
||||
SensorData();
|
||||
~SensorData();
|
||||
|
||||
int16_t getRealAzimuth() const { return 0; }
|
||||
int16_t getCalcAzimuth() const { return 0; }
|
||||
CalcAzimuth::CalcAzimuthState getCalcAzimuthState() const { return CalcAzimuth::CalcAzimuthState::Invalid; }
|
||||
const UBX_NAV_PVT_data_t* const getGnssData() const;
|
||||
const void* const getGyroData() const;
|
||||
void enableNtrip(String host, uint16_t port, String mountPoint, String user, String password);
|
||||
void enableGnss(SPIClass* spiPort, uint8_t csPin);
|
||||
void enableGnss();
|
||||
void enableRealCompass();
|
||||
void enableCalcCompass();
|
||||
void enableGyroskop();
|
||||
|
||||
// Interface Const kram
|
||||
int16_t getRealAzimuth() const { return this->realAzimuth; }
|
||||
int16_t getCalcAzimuth() const { return this->calcAzimuth; }
|
||||
CalcAzimuth::State getCalcAzimuthState() const;
|
||||
|
||||
Point getCurrentPos() const { return this->currentPosition; }
|
||||
const UBX_NAV_PVT_data_t* getGnssData() const { return this->gnssData; };
|
||||
const void* const getGyroData() const;
|
||||
|
||||
CalcAzimuth* getCalcCompass() const { return this->calcCompass; }
|
||||
QMC5883LCompass* getRealCompass() const { return this->realCompass; }
|
||||
NTRIPClient* getNtripClient() const { return this->ntripClient; }
|
||||
|
||||
// static
|
||||
/**
|
||||
* @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:
|
||||
Sensors* sensors;
|
||||
void run() override;
|
||||
void runAsChild() override;
|
||||
void initGnss();
|
||||
|
||||
QMC5883LCompass* realCompass = nullptr;
|
||||
CalcAzimuth* calcCompass = nullptr;
|
||||
SFE_UBLOX_GNSS* gnss = nullptr;
|
||||
NTRIPClient* ntripClient = nullptr;
|
||||
|
||||
UBX_NAV_PVT_data_t* gnssData;
|
||||
Point currentPosition;
|
||||
|
||||
char* host;
|
||||
char* mountPoint;
|
||||
char* user;
|
||||
char* password;
|
||||
|
||||
bool isNtripInit = false;
|
||||
|
||||
uint16_t port;
|
||||
int16_t realAzimuth = INT16_MAX;
|
||||
int16_t calcAzimuth = INT16_MAX;
|
||||
|
||||
// static
|
||||
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;
|
||||
};
|
||||
|
||||
SensorData::SensorData(Sensors* senors) {
|
||||
this->sensors = sensors;
|
||||
}
|
||||
|
||||
#endif //SENSOR_DATA_H
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* @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:
|
||||
Sensors();
|
||||
|
||||
void enableGnss(SPIClass* spiPort, uint8_t csPin);
|
||||
void enableGnss();
|
||||
void enableCompass();
|
||||
void enableGyroskop();
|
||||
|
||||
const SensorData const getSensorData() const { return this->sensorData; }
|
||||
|
||||
/**
|
||||
* @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 run() override;
|
||||
void runAsChild() override;
|
||||
void initGnss();
|
||||
|
||||
QMC5883LCompass* compass = nullptr;
|
||||
SFE_UBLOX_GNSS* gnss = nullptr;
|
||||
SensorData* sensorData;
|
||||
|
||||
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