- broke nearly everthing
- create Sensor Manager
This commit is contained in:
@@ -12,15 +12,12 @@
|
||||
#ifndef NAVIGATION_H
|
||||
#define NAVIGATION_H
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
#include <QMC5883LCompass.h>
|
||||
#include <Arduino.h>
|
||||
#include <iostream>
|
||||
#include <SPI.h>
|
||||
|
||||
#include "route.h"
|
||||
#include "NTRIPClient.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
#include "component.h"
|
||||
|
||||
/**
|
||||
@@ -52,15 +49,6 @@ class Navigation : public Component {
|
||||
Complete
|
||||
};
|
||||
|
||||
enum CalcAzimuthState {
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
Good,
|
||||
Super
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief Construct a new Navigation object and using I2C
|
||||
*
|
||||
@@ -68,13 +56,6 @@ class Navigation : public Component {
|
||||
*/
|
||||
Navigation(Route* route = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Construct a new Navigation object and using SPI
|
||||
*
|
||||
* @param route with which to navigate
|
||||
*/
|
||||
Navigation(SPIClass* spiPort, uint8_t csPin, Route* route = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Destroy the Navigation object
|
||||
*
|
||||
@@ -138,9 +119,6 @@ class Navigation : public Component {
|
||||
* @return false no point added to route
|
||||
*/
|
||||
Status addCurrentPosToRoute();
|
||||
|
||||
// TODO: can be deleted?
|
||||
// bool setPointBeforeTurn();
|
||||
|
||||
/**
|
||||
* @brief Get the Ubx Data object
|
||||
@@ -187,22 +165,11 @@ class Navigation : public Component {
|
||||
Point::Accuracy getMinAccuracy() const { return this->minAccuracy; }
|
||||
void setMinAccuracy(Point::Accuracy accuracy) { this->minAccuracy = accuracy; }
|
||||
|
||||
/**
|
||||
* @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);
|
||||
// map input in range from -180 to 180 degree
|
||||
static int16_t fixDegree(int16_t degree);
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void runAsChild() override;
|
||||
void updateCurrentLocation();
|
||||
void updateMagneticDeclination();
|
||||
void init(Route* route);
|
||||
bool nextPoint();
|
||||
@@ -213,11 +180,11 @@ class Navigation : public Component {
|
||||
static constexpr uint8_t maxDisBetweenPoints = 10;
|
||||
static constexpr float minDisBetweenPoints = 0.3;
|
||||
|
||||
SFE_UBLOX_GNSS* gps;
|
||||
|
||||
UBX_NAV_PVT_data_t* ubxData = nullptr;
|
||||
Route* route = nullptr;
|
||||
NTRIPClient* ntripClient = nullptr;
|
||||
QMC5883LCompass* compass;
|
||||
|
||||
|
||||
Point lastPointRouteInsert;
|
||||
Point lastPointCalcCorrection;
|
||||
@@ -225,7 +192,7 @@ class Navigation : public Component {
|
||||
Point targetPoint;
|
||||
Point currentPosition;
|
||||
Point::Accuracy minAccuracy = Point::Accuracy::twoDigOfCM;
|
||||
CalcAzimuthState calcAzimuthState = CalcAzimuthState::Invalid;
|
||||
|
||||
|
||||
bool navigationStarted = false;
|
||||
bool navigationFinished = false;
|
||||
@@ -239,7 +206,6 @@ class Navigation : public Component {
|
||||
char* user;
|
||||
char* password;
|
||||
|
||||
int16_t realAzimuth = INT16_MAX;
|
||||
int16_t calcAzimuth = INT16_MAX;
|
||||
|
||||
uint8_t timeToWait = 200;
|
||||
@@ -248,16 +214,6 @@ class Navigation : public Component {
|
||||
uint32_t ubxUpdateTime = 0;
|
||||
|
||||
double minDistanceToReachPoint = 0.5;
|
||||
|
||||
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 // NAVIGATION_H
|
||||
|
||||
Reference in New Issue
Block a user