- added calc azimuth to autopilot menu
- getters in navigation for calc azimuth - wrapper for manualControl for automatic orintaion change
This commit is contained in:
@@ -8,4 +8,5 @@ Besser zügig:
|
||||
Speedometer buffer ergibt kaum Sinn
|
||||
Abweichung max 25 cm bevor zu ungenau damit nie mehr als 50 cm gesamt.
|
||||
Doxygen Kommentare aktualisieren
|
||||
Motortreiber vielleicht bei wenigster Leistung ohne Kurve
|
||||
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT
|
||||
#ifndef VERSION
|
||||
#define VERSION "0.8.20"
|
||||
#define VERSION "0.8.21"
|
||||
#endif
|
||||
#ifndef BUILD_TIMESTAMP
|
||||
#define BUILD_TIMESTAMP "2023-08-08 14:33:17.266785"
|
||||
#define BUILD_TIMESTAMP "2023-08-08 22:55:37.389313"
|
||||
#endif
|
||||
|
||||
@@ -194,6 +194,8 @@ class Navigation {
|
||||
*/
|
||||
int16_t getAzimuth() const { return this->realAzimuth; }
|
||||
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; }
|
||||
void setMinAccuracy(Point::Accuracy accuracy) { this->minAccuracy = accuracy; }
|
||||
|
||||
@@ -166,10 +166,41 @@ void MenuAutopilot::printPage() const {
|
||||
lineTwo = "accuracy is low";
|
||||
break;
|
||||
|
||||
default:
|
||||
this->printDefault();
|
||||
return;
|
||||
}
|
||||
case 11:
|
||||
lineOne = "CalcAzi: ";
|
||||
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);
|
||||
}
|
||||
@@ -219,7 +250,7 @@ void MenuAutopilot::update() {
|
||||
}
|
||||
|
||||
void MenuAutopilot::init() {
|
||||
this->setCountPages(11);
|
||||
this->setCountPages(12);
|
||||
this->driveManager->changeModus(Modi::Autopilot);
|
||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
||||
this->routeInfo = this->autopilot->getRouteInfo();
|
||||
|
||||
@@ -12,13 +12,31 @@
|
||||
#include "driveModi/Modi/Autopilot/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)
|
||||
: ManualControl(moveControl, input) {
|
||||
this->setInputMode(ManualControl::InputMode::Digital);
|
||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||
this->directionChangeSignal = new DirectionChangeSignal(navigation);
|
||||
this->navigation = navigation;
|
||||
this->init();
|
||||
}
|
||||
|
||||
Autopilot::~Autopilot() {
|
||||
delete this->directionChangeSignal;
|
||||
// this->navigation->getNTRIPClient()->setActivated(false);
|
||||
}
|
||||
|
||||
@@ -121,8 +139,8 @@ void Autopilot::rotate() {
|
||||
if (this->courseCorrection.correction > 0)
|
||||
this->moveControl->setRotationSpeed(-this->rotationSpeed);
|
||||
else
|
||||
|
||||
this->moveControl->setRotationSpeed(this->rotationSpeed);
|
||||
this->moveControl->setRotationSpeed(this->rotationSpeed);
|
||||
this->navigation->drivingDirectionChange();
|
||||
}
|
||||
|
||||
void Autopilot::checkButtonInput() {
|
||||
|
||||
@@ -17,6 +17,16 @@
|
||||
#include "moveControl.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
|
||||
*
|
||||
@@ -120,6 +130,7 @@ class Autopilot : public ManualControl {
|
||||
State state = State::None;
|
||||
State lastState = State::None;
|
||||
Navigation::Status lastOrderStatus;
|
||||
DirectionChangeSignal* directionChangeSignal;
|
||||
|
||||
bool updateDisplay = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user