delete everthing for bachelore
This commit is contained in:
@@ -1,254 +0,0 @@
|
||||
/**
|
||||
* @file menuAutopilot.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains an implementation of the class MenuAutopilot
|
||||
* @version 0.1
|
||||
* @date 2022-02-03
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "menuAutopilot.h"
|
||||
|
||||
void MenuAutopilot::printPage() const {
|
||||
CourseCorrection correction = this->autopilot->getCourseCorrection();
|
||||
UBX_NAV_PVT_data_t* gpsData = this->driveManager->getNavigation()->getUbxData();
|
||||
bool navigationStarted = this->autopilot->getState() >= Autopilot::State::NavigationStarted;
|
||||
|
||||
String distanceString = "";
|
||||
if (navigationStarted) {
|
||||
uint16_t distance = 0;
|
||||
if (correction.distance < 1) {
|
||||
distance = (uint16_t) (correction.distance * 100);
|
||||
distanceString.concat(distance);
|
||||
distanceString.concat("cm");
|
||||
} else if (correction.distance < 1000) {
|
||||
distance = (uint16_t) correction.distance;
|
||||
distanceString.concat(distance);
|
||||
distanceString.concat("m");
|
||||
} else {
|
||||
distance = (uint16_t) (correction.distance / 1000);
|
||||
distanceString.concat(distance);
|
||||
distanceString.concat("km");
|
||||
}
|
||||
}
|
||||
|
||||
String lineOne = "No information";
|
||||
String lineTwo = "available";
|
||||
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0: {
|
||||
lineOne = "Status: ";
|
||||
lineTwo = "";
|
||||
switch (this->autopilot->getState()) {
|
||||
case Autopilot::State::InsufficientAccuracy :
|
||||
lineTwo = "Err: LowAccuracy";
|
||||
break;
|
||||
|
||||
case Autopilot::State::NoRoute :
|
||||
lineTwo = "Err: No route";
|
||||
break;
|
||||
|
||||
case Autopilot::State::NavigationStarted :
|
||||
lineTwo = "Nav started";
|
||||
break;
|
||||
|
||||
case Autopilot::State::GetToStartPoint :
|
||||
lineTwo = "Drive to start";
|
||||
break;
|
||||
|
||||
case Autopilot::State::SelfDrivingAvailable :
|
||||
lineTwo = "Autopilot ready";
|
||||
break;
|
||||
|
||||
case Autopilot::State::SelfDriving :
|
||||
lineTwo = "Autopilot active";
|
||||
break;
|
||||
|
||||
case Autopilot::State::SelfDrivingRotate :
|
||||
lineTwo = "Rotating";
|
||||
break;
|
||||
|
||||
case Autopilot::State::TargetReached :
|
||||
lineTwo = "Target reached";
|
||||
break;
|
||||
|
||||
default:
|
||||
lineTwo = "UNKOWN - ";
|
||||
lineTwo.concat(static_cast<int>(this->autopilot->getState()));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (!navigationStarted) {
|
||||
lineOne = "Navigation is";
|
||||
lineTwo = "not started";
|
||||
break;
|
||||
}
|
||||
lineOne = "Distance: ";
|
||||
lineOne.concat(distanceString);
|
||||
lineTwo = "Turn: ";
|
||||
lineTwo.concat(correction.correction);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
lineOne = "Target waypoint";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(this->autopilot->getRouteInfo().currentPoint);
|
||||
lineTwo.concat(" from ");
|
||||
lineTwo.concat(this->autopilot->getRouteInfo().totalPoints);
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
NTRIPClientStates status = this->driveManager->getNavigation()->getNTRIPClient()->getClientState();
|
||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||
lineOne = "GNSS: ";
|
||||
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
if (carrSoln == 0)
|
||||
lineOne.concat("None");
|
||||
else if (carrSoln == 1)
|
||||
lineOne.concat("Floating");
|
||||
else if (carrSoln == 2)
|
||||
lineOne.concat("Fixed");
|
||||
else
|
||||
lineOne.concat("UNKNOWN");
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lineOne.concat("No WiFi");
|
||||
else
|
||||
lineOne.concat("Offline");
|
||||
|
||||
lineTwo = "hAcc: ";
|
||||
if (gpsData->fixType)
|
||||
lineTwo.concat(gpsData->hAcc);
|
||||
else
|
||||
lineTwo.concat("0");
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
if (this->driveManager->getNavigation()->getCalcAzimuthState() == Navigation::CalcAzimuthState::Good
|
||||
||this->driveManager->getNavigation()->getCalcAzimuthState() == Navigation::CalcAzimuthState::Super)
|
||||
{
|
||||
lineOne = "Calc Azi: ";
|
||||
lineTwo = "State: ";
|
||||
lineOne.concat(this->driveManager->getNavigation()->getCalcAzimuth());
|
||||
switch (this->driveManager->getNavigation()->getCalcAzimuthState()) {
|
||||
case Navigation::CalcAzimuthState::Bad :
|
||||
lineTwo.concat("Bad");
|
||||
break;
|
||||
|
||||
case Navigation::CalcAzimuthState::Good :
|
||||
lineTwo.concat("Good");
|
||||
break;
|
||||
|
||||
case Navigation::CalcAzimuthState::Invalid :
|
||||
lineTwo.concat("Invalid");
|
||||
break;
|
||||
|
||||
case Navigation::CalcAzimuthState::Ok :
|
||||
lineTwo.concat("Ok");
|
||||
break;
|
||||
|
||||
case Navigation::CalcAzimuthState::Super :
|
||||
lineTwo.concat("Super");
|
||||
break;
|
||||
|
||||
default:
|
||||
lineTwo.concat("Unkown");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
lineOne = "Real Azi: ";
|
||||
lineTwo = "";
|
||||
lineOne.concat(this->driveManager->getNavigation()->getAzimuth());
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
lineOne = "Loop mode is";
|
||||
if (this->autopilot->getLoopMode())
|
||||
lineTwo = "enabled";
|
||||
else
|
||||
lineTwo = "disabled";
|
||||
break;
|
||||
|
||||
case 6:
|
||||
lineOne = "Freeze target is";
|
||||
if (this->targetFreezed)
|
||||
lineTwo = "activated";
|
||||
else
|
||||
lineTwo = "deactivated";
|
||||
break;
|
||||
|
||||
case 7:
|
||||
lineOne = "MinDisToPoint:";
|
||||
lineTwo = "<- ";
|
||||
lineTwo.concat(this->minDistance);
|
||||
lineTwo.concat(" ->");
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this->print(lineOne, lineTwo);
|
||||
}
|
||||
|
||||
void MenuAutopilot::runCommand() const {
|
||||
switch (this->getCurrentPage()) {
|
||||
case 5:
|
||||
this->autopilot->switchLoopMode();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (this->targetFreezed) {
|
||||
this->targetFreezed = false;
|
||||
this->driveManager->getNavigation()->freezeTargetPoint(false);
|
||||
} else {
|
||||
this->targetFreezed = true;
|
||||
this->driveManager->getNavigation()->freezeTargetPoint();
|
||||
}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuAutopilot::runCommandNo() const {
|
||||
switch (this->getCurrentPage()) {
|
||||
case 7:
|
||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuAutopilot::update() {
|
||||
if (!this->autopilot->shouldUpdate())
|
||||
return;
|
||||
|
||||
this->routeInfo = this->autopilot->getRouteInfo();
|
||||
this->printMenu();
|
||||
}
|
||||
|
||||
void MenuAutopilot::init() {
|
||||
this->setCountPages(8);
|
||||
this->driveManager->changeModus(Modi::Autopilot);
|
||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
||||
this->routeInfo = this->autopilot->getRouteInfo();
|
||||
this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* @file menuAutopilot.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains a class to print informations about the Autopilot
|
||||
* @version 0.1
|
||||
* @date 2022-02-03
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MENU_AUTOPILOT_DRIVE_H
|
||||
#define MENU_AUTOPILOT_DRIVE_H
|
||||
|
||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||
|
||||
/**
|
||||
* @brief A class to print informations about the Autopilot
|
||||
*
|
||||
*/
|
||||
class MenuAutopilot : public MenuDriveMode {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Autopilot object
|
||||
*
|
||||
* @param driveManager for MenuDriveMode
|
||||
*/
|
||||
MenuAutopilot(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
|
||||
|
||||
/**
|
||||
* @brief Prints the Information to display and console
|
||||
*
|
||||
* The informations are only printed to the display if it
|
||||
* set.
|
||||
*
|
||||
* Changes the DriveModi to Autopilot if it is the first time called
|
||||
* and save the Autopilot object.
|
||||
*/
|
||||
void printPage() const override;
|
||||
|
||||
|
||||
/**
|
||||
* @brief can be called to update shown data
|
||||
*/
|
||||
void update() override;
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
void runCommand() const override;
|
||||
void runCommandNo() const override;
|
||||
|
||||
bool mutable targetFreezed = false;
|
||||
double mutable minDistance;
|
||||
|
||||
Autopilot* autopilot;
|
||||
RouteInfo routeInfo;
|
||||
};
|
||||
|
||||
#endif // MENU_AUTOPILOT_DRIVE_H
|
||||
@@ -1,138 +0,0 @@
|
||||
/**
|
||||
* @file menuCaptureRoute.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains an implementation of the class MenuCaptureRoute
|
||||
* @version 0.1
|
||||
* @date 2022-01-31
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#include "menuCaptureRoute.h"
|
||||
|
||||
void MenuCaptureRoute::printPage() const {
|
||||
RouteInfo routeInfo = this->captureRoute->getRouteInfo();
|
||||
UBX_NAV_PVT_data_t* gpsData = this->driveManager->getNavigation()->getUbxData();
|
||||
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
switch (this->getCurrentPage()) {
|
||||
case 0:
|
||||
lineOne = "Capture Route";
|
||||
lineTwo = "You can drive";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
lineOne = "Saved waypoints";
|
||||
lineTwo.concat(routeInfo.totalPoints);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
lineOne = "Last status:";
|
||||
switch (this->captureRoute->getLastStatus()) {
|
||||
case Navigation::Status::InsufficientAccuracy:
|
||||
lineTwo = "Poor Accuracy";
|
||||
break;
|
||||
|
||||
case Navigation::Status::Updated:
|
||||
lineTwo = "Point added";
|
||||
break;
|
||||
|
||||
case Navigation::Status::Unchanged:
|
||||
lineTwo = "Point too close";
|
||||
break;
|
||||
|
||||
default:
|
||||
lineTwo = "---";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
lineOne = "Distance to last";
|
||||
lineTwo = "point: ";
|
||||
lineTwo.concat(this->captureRoute->getDistanceToLastPoint());
|
||||
break;
|
||||
|
||||
case 4: {
|
||||
NTRIPClientStates status = this->driveManager->getNavigation()->getNTRIPClient()->getClientState();
|
||||
lineOne = "NTRIP Client is";
|
||||
|
||||
if (status == NTRIPClientStates::pushData)
|
||||
lineTwo = "enabled";
|
||||
else if (status == NTRIPClientStates::notAvailable)
|
||||
lineTwo = "not available";
|
||||
else
|
||||
lineTwo = "disabled";
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: {
|
||||
lineOne = "Carrier Solution";
|
||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||
if (carrSoln == 0)
|
||||
lineTwo = "None";
|
||||
else if (carrSoln == 1)
|
||||
lineTwo = "Floating";
|
||||
else if (carrSoln == 2)
|
||||
lineTwo = "Fixed";
|
||||
else
|
||||
lineTwo = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
lineOne = "hAccuracy: ";
|
||||
lineTwo = "Azimuth: ";
|
||||
lineTwo.concat(this->driveManager->getNavigation()->getAzimuth());
|
||||
if (gpsData->fixType)
|
||||
lineOne.concat(gpsData->hAcc);
|
||||
else
|
||||
lineOne.concat("0");
|
||||
break;
|
||||
|
||||
case 7:
|
||||
lineOne = "Current minimal";
|
||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||
lineTwo = "accuracy is high";
|
||||
else
|
||||
lineTwo = "accuracy is low";
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this->print(lineOne, lineTwo);
|
||||
}
|
||||
|
||||
void MenuCaptureRoute::update() {
|
||||
if (!this->captureRoute->shouldUpdate())
|
||||
return;
|
||||
this->printMenu();
|
||||
}
|
||||
|
||||
void MenuCaptureRoute::runCommand() const {
|
||||
switch (this->getCurrentPage())
|
||||
{
|
||||
case 7:
|
||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
||||
else
|
||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuCaptureRoute::init() {
|
||||
this->setCountPages(8);
|
||||
this->updateDelay = 500;
|
||||
this->driveManager->changeModus(Modi::CaptureRoute);
|
||||
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* @file menuCaptureRoute.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief Contains a class to print informations about CaptureRoute
|
||||
* @version 0.1
|
||||
* @date 2022-01-31
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#ifndef MENU_CAPTURE_ROUTE_H
|
||||
#define MENU_MANUAL_DRIVE_H
|
||||
|
||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||
|
||||
/**
|
||||
* @brief A class to print informations about the Autopilot
|
||||
*
|
||||
*/
|
||||
class MenuCaptureRoute : public MenuDriveMode {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Menu Capture Route object
|
||||
*
|
||||
* @param driveManager
|
||||
*/
|
||||
MenuCaptureRoute(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
|
||||
|
||||
/**
|
||||
* @brief Prints the Information to display and console
|
||||
*
|
||||
* The informations are only printed to the display if it
|
||||
* set.
|
||||
*
|
||||
* Changes the DriveModi to CaptureRoute if it is the first time called
|
||||
* and save the CaptureRoute object.
|
||||
*/
|
||||
void printPage() const override;
|
||||
|
||||
/**
|
||||
* @brief can be called to update shown data
|
||||
*/
|
||||
void update() override;
|
||||
|
||||
void runCommand() const override;
|
||||
|
||||
private:
|
||||
void init() override;
|
||||
|
||||
CaptureRoute* captureRoute;
|
||||
};
|
||||
|
||||
#endif // MENU_MANUAL_DRIVE_H
|
||||
Reference in New Issue
Block a user