added increase and decrease to navigation

This commit is contained in:
2023-05-24 14:47:59 +02:00
parent 52590e9e2f
commit 49e0c2d1ef
3 changed files with 13 additions and 16 deletions
+2 -1
View File
@@ -130,8 +130,9 @@ bool Navigation::getCourseCorrection(CourseCorrection& correction) {
return false; return false;
// Check if I need a new Point // Check if I need a new Point
if (distance < MIN_DISTANCE_TO_REACH_POINT && this->preventNextPoint == false) { if (distance < this->minDistanceToReachPoint && this->preventNextPoint == false) {
if (!this->nextPoint()) { if (!this->nextPoint()) {
std::cout << "Navigation::getCourseCorrection finished" << std::endl;
this->navigationFinished = true; this->navigationFinished = true;
this->navigationStarted = false; this->navigationStarted = false;
return false; // End of navigation return false; // End of navigation
+5
View File
@@ -111,6 +111,9 @@ class Navigation {
bool startNavigation(); bool startNavigation();
void freezeTargetPoint(bool val = true) { this->preventNextPoint = val; }; void freezeTargetPoint(bool val = true) { this->preventNextPoint = val; };
double increaseMinDistanceToReachPoint() { return this->minDistanceToReachPoint += 0.1; }
double decreaseMinDistanceToReachPoint() { return this->minDistanceToReachPoint -= 0.1; }
/** /**
* @brief Get the Course Correction object * @brief Get the Course Correction object
* *
@@ -234,6 +237,8 @@ class Navigation {
uint32_t lastMillis = 0; uint32_t lastMillis = 0;
uint32_t ubxUpdateTime = 0; uint32_t ubxUpdateTime = 0;
double minDistanceToReachPoint = 0.5;
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct); static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct); static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
@@ -86,21 +86,13 @@ void MenuAutopilot::printPage() const {
lineTwo.concat(correction.correction); lineTwo.concat(correction.correction);
break; break;
case 2: { case 2:
uint16_t currentPoint = this->autopilot->getRouteInfo().currentPoint;
uint16_t totalPoints = this->autopilot->getRouteInfo().totalPoints;
if (currentPoint > totalPoints) {
lineOne = "Target reached";
lineTwo = "";
} else {
lineOne = "Target waypoint"; lineOne = "Target waypoint";
lineTwo = ""; lineTwo = "";
lineTwo.concat(currentPoint); lineTwo.concat(this->autopilot->getRouteInfo().currentPoint);
lineTwo.concat(" from "); lineTwo.concat(" from ");
lineTwo.concat(totalPoints); lineTwo.concat(this->autopilot->getRouteInfo().totalPoints);
}
break; break;
}
case 3: { case 3: {
NTRIPClientStates status = this->driveManager->getNavigation()->getNTRIPClient()->getClientState(); NTRIPClientStates status = this->driveManager->getNavigation()->getNTRIPClient()->getClientState();
@@ -142,7 +134,6 @@ void MenuAutopilot::printPage() const {
case 6: case 6:
lineOne = "Restart the"; lineOne = "Restart the";
lineTwo = "Autopilot"; lineTwo = "Autopilot";
this->autopilot->restart();
break; break;
case 7: case 7: