- added calc azimuth to autopilot menu

- getters in navigation for calc azimuth
- wrapper for manualControl for automatic orintaion change
This commit is contained in:
2023-08-08 22:59:28 +02:00
parent 620812b5f8
commit f236d98be2
7 changed files with 73 additions and 10 deletions
+1
View File
@@ -8,4 +8,5 @@ Besser zügig:
Speedometer buffer ergibt kaum Sinn Speedometer buffer ergibt kaum Sinn
Abweichung max 25 cm bevor zu ungenau damit nie mehr als 50 cm gesamt. Abweichung max 25 cm bevor zu ungenau damit nie mehr als 50 cm gesamt.
Doxygen Kommentare aktualisieren Doxygen Kommentare aktualisieren
Motortreiber vielleicht bei wenigster Leistung ohne Kurve
+2 -2
View File
@@ -1,9 +1,9 @@
// AUTO GENERATED FILE, DO NOT EDIT // AUTO GENERATED FILE, DO NOT EDIT
#ifndef VERSION #ifndef VERSION
#define VERSION "0.8.20" #define VERSION "0.8.21"
#endif #endif
#ifndef BUILD_TIMESTAMP #ifndef BUILD_TIMESTAMP
#define BUILD_TIMESTAMP "2023-08-08 14:33:17.266785" #define BUILD_TIMESTAMP "2023-08-08 22:55:37.389313"
#endif #endif
+2
View File
@@ -194,6 +194,8 @@ class Navigation {
*/ */
int16_t getAzimuth() const { return this->realAzimuth; } int16_t getAzimuth() const { return this->realAzimuth; }
QMC5883LCompass* getCompass() const { return this->compass; } QMC5883LCompass* getCompass() const { return this->compass; }
int16_t getCalcAzimuth() const { return this->calcAzimuth; }
CalcAzimuthState getCalcAzimuthState() const { return this->calcAzimuthState; }
Point::Accuracy getMinAccuracy() const { return this->minAccuracy; } Point::Accuracy getMinAccuracy() const { return this->minAccuracy; }
void setMinAccuracy(Point::Accuracy accuracy) { this->minAccuracy = accuracy; } void setMinAccuracy(Point::Accuracy accuracy) { this->minAccuracy = accuracy; }
@@ -166,10 +166,41 @@ void MenuAutopilot::printPage() const {
lineTwo = "accuracy is low"; lineTwo = "accuracy is low";
break; break;
default: case 11:
this->printDefault(); lineOne = "CalcAzi: ";
return; 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;
}
break;
default:
this->printDefault();
return;
}
this->print(lineOne, lineTwo); this->print(lineOne, lineTwo);
} }
@@ -219,7 +250,7 @@ void MenuAutopilot::update() {
} }
void MenuAutopilot::init() { void MenuAutopilot::init() {
this->setCountPages(11); this->setCountPages(12);
this->driveManager->changeModus(Modi::Autopilot); this->driveManager->changeModus(Modi::Autopilot);
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr(); this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
this->routeInfo = this->autopilot->getRouteInfo(); this->routeInfo = this->autopilot->getRouteInfo();
+20 -2
View File
@@ -12,13 +12,31 @@
#include "driveModi/Modi/Autopilot/autopilot.h" #include "driveModi/Modi/Autopilot/autopilot.h"
#include "autopilot.h" #include "autopilot.h"
DirectionChangeSignal::DirectionChangeSignal(Navigation* navigation) {
this->navigation = navigation;
this->action();
}
DirectionChangeSignal::~DirectionChangeSignal() {
navigation->dissableCalcAzimuth();
}
void DirectionChangeSignal::action() {
this->navigation->drivingDirectionChange();
}
Autopilot::Autopilot(MoveControl* moveControl, const ControlPadInput *input, Navigation* navigation) Autopilot::Autopilot(MoveControl* moveControl, const ControlPadInput *input, Navigation* navigation)
: ManualControl(moveControl, input) { : ManualControl(moveControl, input) {
this->setInputMode(ManualControl::InputMode::Digital);
this->setDirectionChangeCallback(this->directionChangeSignal);
this->directionChangeSignal = new DirectionChangeSignal(navigation);
this->navigation = navigation; this->navigation = navigation;
this->init(); this->init();
} }
Autopilot::~Autopilot() { Autopilot::~Autopilot() {
delete this->directionChangeSignal;
// this->navigation->getNTRIPClient()->setActivated(false); // this->navigation->getNTRIPClient()->setActivated(false);
} }
@@ -121,8 +139,8 @@ void Autopilot::rotate() {
if (this->courseCorrection.correction > 0) if (this->courseCorrection.correction > 0)
this->moveControl->setRotationSpeed(-this->rotationSpeed); this->moveControl->setRotationSpeed(-this->rotationSpeed);
else else
this->moveControl->setRotationSpeed(this->rotationSpeed);
this->moveControl->setRotationSpeed(this->rotationSpeed); this->navigation->drivingDirectionChange();
} }
void Autopilot::checkButtonInput() { void Autopilot::checkButtonInput() {
+11
View File
@@ -17,6 +17,16 @@
#include "moveControl.h" #include "moveControl.h"
#include "driveModi/Modi/ManualControl/manualControl.h" #include "driveModi/Modi/ManualControl/manualControl.h"
class DirectionChangeSignal : public DirectionChangeWrapper {
public:
DirectionChangeSignal(Navigation* navigation);
~DirectionChangeSignal();
void action() override;
private:
Navigation* navigation;
};
/** /**
* @brief This class use the navigate class to drive automaticaly * @brief This class use the navigate class to drive automaticaly
* *
@@ -120,6 +130,7 @@ class Autopilot : public ManualControl {
State state = State::None; State state = State::None;
State lastState = State::None; State lastState = State::None;
Navigation::Status lastOrderStatus; Navigation::Status lastOrderStatus;
DirectionChangeSignal* directionChangeSignal;
bool updateDisplay = false; bool updateDisplay = false;
+1 -1
View File
@@ -1 +1 @@
0.8.20 0.8.21