bauen klappt wieder, navigation ist kaputt, todo: und fixme: beachten!
This commit is contained in:
@@ -39,7 +39,8 @@ Navigation::~Navigation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Navigation::loop() {
|
void Navigation::loop() {
|
||||||
this->gps->checkUbloxI2C();
|
//FIXME: Hier sollte funktion zum aktualisieren des GPS Moduls stehen
|
||||||
|
//this->gps->checkUbloxI2C();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Navigation::newRoute() {
|
void Navigation::newRoute() {
|
||||||
@@ -76,7 +77,9 @@ CourseCorrection Navigation::getCourseCorrection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double currentCourse = this->gps->course.deg();
|
//FIXME: next line
|
||||||
|
double currentCourse = 0;
|
||||||
|
//double currentCourse = this->gps->course.deg();
|
||||||
int16_t correction = currentCourse - targetCourse;
|
int16_t correction = currentCourse - targetCourse;
|
||||||
if (correction > 180)
|
if (correction > 180)
|
||||||
correction -= 360;
|
correction -= 360;
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ class Navigation {
|
|||||||
/**
|
/**
|
||||||
* @brief Returns the GPS object
|
* @brief Returns the GPS object
|
||||||
*
|
*
|
||||||
* @return TinyGPSPlus*
|
* @return SFE_UBLOX_GNSS*
|
||||||
*/
|
*/
|
||||||
TinyGPSPlus* getGPS() { return this->gps; }
|
SFE_UBLOX_GNSS* getGPS() { return this->gps; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the Route Info object
|
* @brief Get the Route Info object
|
||||||
|
|||||||
@@ -8,3 +8,33 @@
|
|||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "navigationUtils.h"
|
||||||
|
|
||||||
|
double NavigationUtils::getCurrentCourse(Point p1) {
|
||||||
|
//TODO: write it!!!
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavigationUtils::setLastPoint(Point p1) {
|
||||||
|
this->lastPoint = p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double NavigationUtils::courseTo(Point p1, Point p2) {
|
||||||
|
//TODO: write it!!!
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double NavigationUtils::courseTo(double lat1, double lon1, double lat2, double lon2) {
|
||||||
|
return NavigationUtils::courseTo(Point(lat1, lon1), Point(lat2, lon2));
|
||||||
|
}
|
||||||
|
|
||||||
|
double NavigationUtils::distanceBetween(Point p1, Point p2) {
|
||||||
|
//TODO: write it!!!
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
double NavigationUtils::distanceBetween(double lat1, double lon1, double lat2, double lon2) {
|
||||||
|
return NavigationUtils::distanceBetween(Point(lat1, lon1), Point(lat2, lon2));
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
class NavigationUtils {
|
class NavigationUtils {
|
||||||
public:
|
public:
|
||||||
void getCurrentCourse(Point p1);
|
double getCurrentCourse(Point p1);
|
||||||
void setLastPoint(Point p1);
|
void setLastPoint(Point p1);
|
||||||
|
|
||||||
static double courseTo(Point p1, Point p2);
|
static double courseTo(Point p1, Point p2);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "menuGPS.h"
|
#include "menuGPS.h"
|
||||||
|
|
||||||
MenuGPS::MenuGPS(TinyGPSPlus* gps) {
|
MenuGPS::MenuGPS(SFE_UBLOX_GNSS* gps) {
|
||||||
this->gps = gps;
|
this->gps = gps;
|
||||||
this->last_millis = millis();
|
this->last_millis = millis();
|
||||||
}
|
}
|
||||||
@@ -62,67 +62,68 @@ void MenuGPS::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuGPS::printPage(uint8_t page) const {
|
void MenuGPS::printPage(uint8_t page) const {
|
||||||
switch (this->currentPage) {
|
//FIXME: new gpslib
|
||||||
case 0:
|
// switch (this->currentPage) {
|
||||||
if (this->lcd) {
|
// case 0:
|
||||||
lcd->clear();
|
// if (this->lcd) {
|
||||||
lcd->setCursor(0, 0);
|
// lcd->clear();
|
||||||
if (gps->satellites.isValid() && gps->satellites.value() > 2) {
|
// lcd->setCursor(0, 0);
|
||||||
lcd->printf("Sats: %3.d", gps->satellites.value());
|
// if (gps->satellites.isValid() && gps->satellites.value() > 2) {
|
||||||
lcd->setCursor(0, 1);
|
// lcd->printf("Sats: %3.d", gps->satellites.value());
|
||||||
lcd->printf("HDOP: %f", gps->hdop.hdop());
|
// lcd->setCursor(0, 1);
|
||||||
} else {
|
// lcd->printf("HDOP: %f", gps->hdop.hdop());
|
||||||
lcd->printf("Data isn't valid");
|
// } else {
|
||||||
lcd->setCursor(0, 1);
|
// lcd->printf("Data isn't valid");
|
||||||
lcd->printf("or no GPS signal");
|
// lcd->setCursor(0, 1);
|
||||||
}
|
// lcd->printf("or no GPS signal");
|
||||||
}
|
// }
|
||||||
if (gps->satellites.isValid() && gps->satellites.value() > 2)
|
// }
|
||||||
std::cout << "Sats: " << gps->satellites.value()
|
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
|
||||||
<< "HDOP: " << gps->hdop.hdop() << std::endl;
|
// std::cout << "Sats: " << gps->satellites.value()
|
||||||
else
|
// << "HDOP: " << gps->hdop.hdop() << std::endl;
|
||||||
std::cout << "Data isn't valid or no GPS signal" << std::endl;
|
// else
|
||||||
break;
|
// std::cout << "Data isn't valid or no GPS signal" << std::endl;
|
||||||
|
// break;
|
||||||
|
|
||||||
case 1:
|
// case 1:
|
||||||
if (this->lcd) {
|
// if (this->lcd) {
|
||||||
lcd->clear();
|
// lcd->clear();
|
||||||
lcd->setCursor(0, 0);
|
// lcd->setCursor(0, 0);
|
||||||
if (gps->location.isValid() && gps->satellites.value() > 2) {
|
// if (gps->location.isValid() && gps->satellites.value() > 2) {
|
||||||
lcd->printf("Lat: %9.6f", gps->location.lat());
|
// lcd->printf("Lat: %9.6f", gps->location.lat());
|
||||||
lcd->setCursor(0, 1);
|
// lcd->setCursor(0, 1);
|
||||||
lcd->printf("Lng: %9.6f", gps->location.lng());
|
// lcd->printf("Lng: %9.6f", gps->location.lng());
|
||||||
} else {
|
// } else {
|
||||||
lcd->printf("Data isn't valid");
|
// lcd->printf("Data isn't valid");
|
||||||
lcd->setCursor(0, 1);
|
// lcd->setCursor(0, 1);
|
||||||
lcd->printf("or NO GPS signal");
|
// lcd->printf("or NO GPS signal");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (gps->satellites.isValid() && gps->satellites.value() > 2)
|
// if (gps->satellites.isValid() && gps->satellites.value() > 2)
|
||||||
std::cout << "Lat: " << gps->location.lat()
|
// std::cout << "Lat: " << gps->location.lat()
|
||||||
<< "Lng: " << gps->location.lng() << std::endl;
|
// << "Lng: " << gps->location.lng() << std::endl;
|
||||||
else
|
// else
|
||||||
std::cout << "Data isn't valid or NO GPS signal" << std::endl;
|
// std::cout << "Data isn't valid or NO GPS signal" << std::endl;
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
case 2:
|
// case 2:
|
||||||
if (this->lcd) {
|
// if (this->lcd) {
|
||||||
lcd->clear();
|
// lcd->clear();
|
||||||
lcd->setCursor(0, 0);
|
// lcd->setCursor(0, 0);
|
||||||
lcd->printf("Chars processed");
|
// lcd->printf("Chars processed");
|
||||||
lcd->setCursor(0, 1);
|
// lcd->setCursor(0, 1);
|
||||||
lcd->printf("-> %u", gps->charsProcessed());
|
// lcd->printf("-> %u", gps->charsProcessed());
|
||||||
}
|
// }
|
||||||
std::cout << "Chars processed: " << gps->charsProcessed() << std::endl;
|
// std::cout << "Chars processed: " << gps->charsProcessed() << std::endl;
|
||||||
break;
|
// break;
|
||||||
|
|
||||||
default:
|
// default:
|
||||||
if (this->lcd) {
|
// if (this->lcd) {
|
||||||
lcd->clear();
|
// lcd->clear();
|
||||||
lcd->setCursor(0, 0);
|
// lcd->setCursor(0, 0);
|
||||||
lcd->printf("Page: %u", page);
|
// lcd->printf("Page: %u", page);
|
||||||
}
|
// }
|
||||||
std::cout << "Page: " << (int) page << std::endl;
|
// std::cout << "Page: " << (int) page << std::endl;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef MENU_GPS_H
|
#ifndef MENU_GPS_H
|
||||||
#define MENU_GPS_H
|
#define MENU_GPS_H
|
||||||
|
|
||||||
#include <TinyGPS++.h>
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||||
|
|
||||||
#include "menuControl.h"
|
#include "menuControl.h"
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class MenuGPS : public MenuControl {
|
|||||||
*
|
*
|
||||||
* @param gps
|
* @param gps
|
||||||
*/
|
*/
|
||||||
MenuGPS(TinyGPSPlus* gps);
|
MenuGPS(SFE_UBLOX_GNSS* gps);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,7 +79,7 @@ class MenuGPS : public MenuControl {
|
|||||||
uint8_t currentPage = 0;
|
uint8_t currentPage = 0;
|
||||||
void printPage(const uint8_t page) const;
|
void printPage(const uint8_t page) const;
|
||||||
|
|
||||||
TinyGPSPlus* gps;
|
SFE_UBLOX_GNSS* gps;
|
||||||
|
|
||||||
const uint16_t delay = 5000;
|
const uint16_t delay = 5000;
|
||||||
uint32_t last_millis = 0;
|
uint32_t last_millis = 0;
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ Modi& operator++(Modi& m, int) {
|
|||||||
|
|
||||||
DriveManager::DriveManager(MoveControl *moveControl) {
|
DriveManager::DriveManager(MoveControl *moveControl) {
|
||||||
this->moveControl = moveControl;
|
this->moveControl = moveControl;
|
||||||
// TODO: Delete magic numbers
|
this->navigation = new Navigation();
|
||||||
this->navigation = new Navigation(17, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DriveManager::~DriveManager() {
|
DriveManager::~DriveManager() {
|
||||||
|
|||||||
Reference in New Issue
Block a user