compilation works again

This commit is contained in:
2023-09-04 13:30:34 +02:00
parent 5f650982a7
commit 6a76470f45
23 changed files with 285 additions and 321 deletions
+17 -37
View File
@@ -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;
}
+4 -42
View File
@@ -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;