diff --git a/lib/Sensors/sensorData.cpp b/lib/Sensors/sensorData.cpp index 5ca4809..adde8ca 100644 --- a/lib/Sensors/sensorData.cpp +++ b/lib/Sensors/sensorData.cpp @@ -20,20 +20,6 @@ SensorData::SensorData() { this->loopDelay = 50; } -SensorData::~SensorData() { - if (this->ntripClient) - delete this->ntripClient; -} - -void SensorData::enableNtrip(String host, uint16_t port, String mountPoint, String user, String password) { - this->ntripClient = new NTRIPClient(this->gnss, host.c_str(), port, mountPoint.c_str(), user.c_str(), password.c_str()); - this->ntripClient->gpsConfiguration(); - this->ntripClient->loop(); - this->ntripClient->setActivated(false); - this->isNtripInit = true; - this->addChildComponent(this->ntripClient); -} - void SensorData::enableGnss(SPIClass* spiPort, uint8_t csPin) { this->gnss = new SFE_UBLOX_GNSS(); if (this->gnss->begin(*spiPort, csPin, 4000000) == false) { diff --git a/lib/Sensors/sensorData.h b/lib/Sensors/sensorData.h index fb4abe1..52bac26 100644 --- a/lib/Sensors/sensorData.h +++ b/lib/Sensors/sensorData.h @@ -22,7 +22,6 @@ #include // Gyroskop #include "calcAzimuth.h" -#include "ntripClient.h" #include "point.h" class Sensors; @@ -30,9 +29,7 @@ class Sensors; class SensorData : public Component { public: SensorData(); - ~SensorData(); - void enableNtrip(String host, uint16_t port, String mountPoint, String user, String password); void enableGnss(SPIClass* spiPort, uint8_t csPin); void enableGnss(); void enableRealCompass(); @@ -50,7 +47,6 @@ class SensorData : public Component { CalcAzimuth* getCalcCompass() const { return this->calcCompass; } QMC5883LCompass* getRealCompass() const { return this->realCompass; } - NTRIPClient* getNtripClient() const { return this->ntripClient; } // static /** @@ -71,19 +67,10 @@ class SensorData : public Component { QMC5883LCompass* realCompass = nullptr; CalcAzimuth* calcCompass = nullptr; SFE_UBLOX_GNSS* gnss = nullptr; - NTRIPClient* ntripClient = nullptr; UBX_NAV_PVT_data_t* gnssData; Point currentPosition; - char* host; - char* mountPoint; - char* user; - char* password; - - bool isNtripInit = false; - - uint16_t port; int16_t realAzimuth = INT16_MAX; int16_t calcAzimuth = INT16_MAX; diff --git a/src/SpecialMenus/GPS/menuGPS.cpp b/src/SpecialMenus/GPS/menuGPS.cpp index 878fd13..f255155 100644 --- a/src/SpecialMenus/GPS/menuGPS.cpp +++ b/src/SpecialMenus/GPS/menuGPS.cpp @@ -14,7 +14,6 @@ MenuGPS::MenuGPS(SensorData* sensorData) : MenuInformationSites(10) { this->sensorData = sensorData; - // this->ntripClient = this->navigation->getNTRIPClient(); } void MenuGPS::printPage() const { @@ -65,20 +64,7 @@ void MenuGPS::printPage() const { break; - case 3: { - // NTRIPClientStates status = this->ntripClient->getClientState(); - // lineOne = "NTRIP Client is"; - - // if (status == NTRIPClientStates::pushData) - // lineTwo = "enabled"; - // else if (status == NTRIPClientStates::notAvailable) - // lineTwo = "not available"; - // else - // lineTwo = "disabled"; - } - break; - - case 4: + case 3: lineOne = "Fix type:"; if (fixType == 0) lineTwo = "None"; @@ -96,7 +82,7 @@ void MenuGPS::printPage() const { lineTwo = "UNKNOWN"; break; - case 5: { + case 4: { lineOne = "Carrier Solution"; uint8_t carrSoln = gpsData->flags.bits.carrSoln; if (carrSoln == 0) @@ -110,7 +96,7 @@ void MenuGPS::printPage() const { } break; - case 6: + case 5: lineOne = "Hrizntl Accuracy"; if (fixType) { lineTwo = ""; @@ -119,7 +105,7 @@ void MenuGPS::printPage() const { lineTwo = "0"; break; - case 7: + case 6: lineOne = "magDec: "; lineTwo = "magAcc: "; if (fixType) { @@ -131,7 +117,7 @@ void MenuGPS::printPage() const { } break; - case 8: + case 7: lineOne = "Azimuth: "; lineTwo = ""; lineTwo.concat(this->sensorData->getRealAzimuth()); @@ -144,16 +130,3 @@ void MenuGPS::printPage() const { this->print(lineOne, lineTwo); } - -void MenuGPS::runCommand() const { - switch (this->getCurrentPage()) { - case 3: { - // // std::cout << "MenuGPS::runCommand " << this->ntripClient->getClientState() << std::endl; - // if (this->ntripClient->getClientState() == NTRIPClientStates::pushData) - // this->ntripClient->setActivated(false); - // else if (this->ntripClient->getClientState() != NTRIPClientStates::notAvailable) - // this->ntripClient->setActivated(true); - } - break; - } -} diff --git a/src/SpecialMenus/GPS/menuGPS.h b/src/SpecialMenus/GPS/menuGPS.h index e88f6fe..902c673 100644 --- a/src/SpecialMenus/GPS/menuGPS.h +++ b/src/SpecialMenus/GPS/menuGPS.h @@ -16,7 +16,6 @@ #include "menuInformationSites.h" #include "sensorData.h" -#include "ntripClient.h" /** * @brief A class to print informations about the GPS object @@ -33,9 +32,7 @@ class MenuGPS : public MenuInformationSites { private: void printPage() const override; - void runCommand() const override; - // NTRIPClient* ntripClient; SensorData* sensorData; }; diff --git a/src/SpecialMenus/Route/menuRoute.cpp b/src/SpecialMenus/Route/menuRoute.cpp deleted file mode 100644 index 772c23a..0000000 --- a/src/SpecialMenus/Route/menuRoute.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/** - * @file menuRoute.cpp - * @author Alexander Klein (alex@kleiax.de) - * @brief Contains the implementation of the classes MenuActionRoute, MenuRoute and MenuRouteWrapper. - * @version 0.1 - * @date 2022-12-28 - * - * @copyright Copyright (c) 2022 - * - */ - -#include "menuRoute.h" - -MenuActionRoute::MenuActionRoute(MenuRoute* menuRoute, DataFunction dataFunction) { - this->menuRoute = menuRoute; - this->dataFunction = dataFunction; -} - -void MenuActionRoute::action() { - (this->menuRoute->*this->dataFunction)(0); -} - -MenuRoute::MenuRoute(Route* route) { - this->route = route; -} - -MenuRoute::~MenuRoute() { - if (isInit) - delete this->mainMenu; -} - -void MenuRoute::printMenu() { - if (!this->isInit) { - this->isInit = true; - this->init(); - } - - this->mainMenu->printMenu(); -} - - -void MenuRoute::down() { - if (blockInput) return; - this->mainMenu->down(); -} - -void MenuRoute::up() { - if (blockInput) return; - this->mainMenu->up(); -} - -void MenuRoute::right() { - if (blockInput) return; - this->mainMenu->right(); -} - -void MenuRoute::left() { - if (blockInput) return; - if (this->mainMenu->isInSubmenu()) - this->mainMenu->left(); - else - this->parentMenu->printMenu(); -} - -void MenuRoute::yes() { - if (blockInput) return; - this->mainMenu->yes(); -} - -void MenuRoute::no() { - if (blockInput) return; - if (this->mainMenu->isInSubmenu()) - this->mainMenu->no(); - else - this->left(); -} - - -void MenuRoute::init() { - // auto dummy = []() { - // std::cout << "Dummy in Action" <mainMenu = new Menu; - MenuRoutePoints* pointsMenu = new MenuRoutePoints(this->route); - - this->mainMenu->setLcd(this->lcd); - pointsMenu->setLcd(this->lcd); - - MenuIntInput* importWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::importRoute)); - MenuIntInput* exportWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::exportRoute)); - MenuIntInput* deleteWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::deleteRoute)); - MenuActionRoute* clearWrapper = new MenuActionRoute(this, &MenuRoute::clearRoute); - - importWrapper->setLcd(this->lcd); - importWrapper->setMinMax(0, 100); - importWrapper->setPrintParentMenu(false); - importWrapper->setEntry(0, "Import Route"); - - exportWrapper->setLcd(this->lcd); - exportWrapper->setMinMax(0, 100); - exportWrapper->setPrintParentMenu(false); - exportWrapper->setEntry(0, "Export Route"); - - deleteWrapper->setLcd(this->lcd); - deleteWrapper->setMinMax(0, 100); - deleteWrapper->setPrintParentMenu(false); - deleteWrapper->setEntry(0, "Delete Route"); - - this->mainMenu->addEntry(new MenuAction("Points", pointsMenu)); - this->mainMenu->addEntry(new MenuAction("Clear", clearWrapper)); - this->mainMenu->addEntry(new MenuAction("Import", importWrapper)); - this->mainMenu->addEntry(new MenuAction("Export", exportWrapper)); - this->mainMenu->addEntry(new MenuAction("Delete", deleteWrapper)); -} - -void MenuRoute::importRoute(uint8_t routeNumber) { - this->blockInput = true; - - String lineOne = ""; - String lineTwo = ""; - - if (WiFi.status() != WL_CONNECTED) { - lineOne = "Not connected to"; - lineTwo = "the WiFi."; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) { - lineOne = "Not enough mem"; - lineTwo = "for Json obj"; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - WiFiClient client; - HTTPClient http; - DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE); - - String host = "http://rover.kleiax.de/api/"; - host.concat(routeNumber); - http.begin(client, host); - int httpResponseCode = http.GET(); - - lineOne = "Import complete"; - lineTwo = "Code: "; - - if (httpResponseCode == 202) - deserializeJson(doc, http.getStream()); - else - lineOne = "HTTP Error"; - - lineTwo.concat(httpResponseCode); - this->print(lineOne, lineTwo); - - if (httpResponseCode <= 0) { - this->blockInput = false; - return; - } - - uint16_t totalPoints = doc["amountPoints"]; - - this->route->clear(); - for (uint16_t i = 0; i < totalPoints; i++) { - Point::Coordinates coords; - coords.lat = doc["points"][i][0].as(); - coords.lon = doc["points"][i][1].as(); - this->route->addPointToRoute(Point(coords, true)); - } - - this->blockInput = false; - http.end(); -} - -void MenuRoute::exportRoute(uint8_t routeNumber) { - this->blockInput = true; - uint16_t totalPoints = this->route->getRouteInfo().totalPoints; - - String lineOne = ""; - String lineTwo = ""; - - if (WiFi.status() != WL_CONNECTED) { - lineOne = "Not connected to"; - lineTwo = "the WiFi."; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) { - lineOne = "Not enough mem"; - lineTwo = "for Json obj"; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE); - doc["number"] = routeNumber; - doc["amountPoints"] = totalPoints; - - Point::Coordinates coords = this->route->startRoute().getCoordinates(); - doc["points"][0][0] = coords.lat; - doc["points"][0][1] = coords.lon; - for (uint16_t i = 1; i < totalPoints; i++) { - coords = this->route->getNextPoint().getCoordinates(); - doc["points"][i][0] = coords.lat; - doc["points"][i][1] = coords.lon; - } - String jsonData; - serializeJson(doc, jsonData); - - WiFiClient client; - HTTPClient http; - - http.begin(client, "http://rover.kleiax.de/api/"); - http.addHeader("Content-Type", "application/json"); - int httpResponseCode = http.POST(jsonData); - - if (httpResponseCode == 201) - lineOne = "Export complete"; - else - lineOne = "HTTP Error"; - lineTwo = "Code: "; - lineTwo.concat(httpResponseCode); - this->print(lineOne, lineTwo); - this->blockInput = false; - - http.end(); -} - -void MenuRoute::deleteRoute(uint8_t routeNumber) { - this->blockInput = true; - - String lineOne = ""; - String lineTwo = ""; - - if (WiFi.status() != WL_CONNECTED) { - lineOne = "Not connected to"; - lineTwo = "the WiFi."; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) { - lineOne = "Not enough mem"; - lineTwo = "for Json obj"; - this->print(lineOne, lineTwo); - this->blockInput = false; - return; - } - - WiFiClient client; - HTTPClient http; - DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE); - - String host = "http://rover.kleiax.de/api/"; - host.concat(routeNumber); - http.begin(client, host); - int httpResponseCode = http.sendRequest("DELETE"); - - lineOne = "Delete complete"; - lineTwo = "Code: "; - - if (httpResponseCode == 202) - deserializeJson(doc, http.getStream()); - else - lineOne = "HTTP Error"; - - lineTwo.concat(httpResponseCode); - this->print(lineOne, lineTwo); - - this->blockInput = false; - http.end(); -} - -void MenuRoute::clearRoute(uint8_t none) { - this->route->clear(); - this->print("Currente route", "deleted..."); -} - -MenuRouteWrapper::MenuRouteWrapper(MenuRoute* menuRoute, DataFunction dataFunction) { - this->menuRoute = menuRoute; - this->dataFunction = dataFunction; -} - -void MenuRouteWrapper::action(int16_t* values, uint8_t length) { - if (length < 1) { - std::cout << "Error in MenuRouteWrapper::action" << std::endl; - return; - } - - if (values[0] < 0) - values[0] = 0; - - if (values[0] > UINT8_MAX) - values[0] = UINT8_MAX; - - (this->menuRoute->*this->dataFunction)(values[0]); -} - - diff --git a/src/SpecialMenus/Route/menuRoute.h b/src/SpecialMenus/Route/menuRoute.h deleted file mode 100644 index b8cdae8..0000000 --- a/src/SpecialMenus/Route/menuRoute.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - * @file menuRoute.h - * @author Alexander Klein (alex@kleiax.de) - * @brief Contains a classes to handles routes with the user input. - * @version 0.1 - * @date 2022-12-28 - * - * @copyright Copyright (c) 2022 - * - */ - -#ifndef MENU_ROUTE_H -#define MENU_ROUTE_H - -#include -#include -#include -#include - -#include "route.h" -#include "menu.h" -#include "menuControl.h" -#include "menuIntInput.h" -#include "menuRoutePoints.h" - -#define JSON_DOCUMENT_SIZE_ROUTE 4096 - -class MenuRoute; -typedef void (MenuRoute::*DataFunction)(uint8_t); - -/** - * @brief MenuActionWrapper to call DataFunctions - * - * This class should be used to call importRoute, - * exportRoute and clearRoute over the Menu. - */ -class MenuActionRoute : public MenuActionWrapper { - public: - /** - * @brief Construct a new Menu Action Route object - * - * @param menuRoute - * @param dataFunction like exportRoute - */ - MenuActionRoute(MenuRoute* menuRoute, DataFunction dataFunction); - - /** - * @brief Runs the given DataFunction - */ - void action() override; - - private: - MenuRoute* menuRoute; - DataFunction dataFunction; -}; - -/** - * @brief Handles routes - * - * With this menu the user can import, export and delete routes. - */ -class MenuRoute : public MenuControl { - public: - /** - * @brief Construct a new Menu Route object - * - * @param route - */ - MenuRoute(Route* route); - ~MenuRoute(); - - /** - * @brief Prints the last informations - * - * On first call this function calls the init function. - * On every call this functions call the printMenu function from - * the mainMenu of this class. - */ - void printMenu() override; - - /** - * @name User Inputs - * @brief Inputs given by the parentMenu - */ - ///@{ - void down() override; - void up() override; - void right() override; - void left() override; - void yes() override; - void no() override; - ///@} - - /** - * @brief Import a Route. - * - * The functions tries to pull the given route id from the RoverApi. - * - * @param routeNumber id - */ - void importRoute(uint8_t routeNumber); - - /** - * @brief Export a Route. - * - * The functions tries to push the current route to the RoverApi. - * - * @param routeNumber id - */ - void exportRoute(uint8_t routeNumber); - - void deleteRoute(uint8_t routeNumber); - - /** - * @brief Delete the current Route. - * - * @param none this param is not be used. - */ - void clearRoute(uint8_t none); - - private: - void init(); - - Route* route; - Menu* mainMenu; - - bool isInit = false; - bool blockInput = false; -}; - -/** - * @brief MenuRouteWrapper to call DataFunctions with numeric user input - * - */ -class MenuRouteWrapper : public MenuIntInputWrapper { - public: - /** - * @brief Construct a new Menu Route Wrapper object. - * - * @param menuRoute - * @param dataFunction - */ - MenuRouteWrapper(MenuRoute* menuRoute, DataFunction dataFunction); - - /** - * @brief Calls the given DataFunction. - * - * @param values The value to be given to the DataFunction. - * @param length Number of values, should be 1. - */ - void action(int16_t* values, uint8_t length) override; - - private: - MenuRoute* menuRoute; - DataFunction dataFunction = nullptr; -}; - -#endif // MENU_ROUTE_H diff --git a/src/SpecialMenus/Route/menuRoutePoints.cpp b/src/SpecialMenus/Route/menuRoutePoints.cpp deleted file mode 100644 index 3fd14f4..0000000 --- a/src/SpecialMenus/Route/menuRoutePoints.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file menuRoutePoints.cpp - * @author Alexander Klein (alex@kleiax.de) - * @brief Contains the implementation of the class MenuRoutePoints. - * @version 0.1 - * @date 2022-12-28 - * - * @copyright Copyright (c) 2022 - * - */ - -#include "menuRoutePoints.h" - -MenuRoutePoints::MenuRoutePoints(Route *route) : MenuInformationSites() { - this->route = route; -} - -void MenuRoutePoints::init() { - uint16_t amountPoints = this->route->getRouteInfo().totalPoints; - if (amountPoints > UINT8_MAX) - this->error = true; - else - this->setCountPages(amountPoints); -} - -void MenuRoutePoints::printPage() const { - uint8_t currentPage = this->getCurrentPage(); - if (this->lastPageNumber == currentPage) - return; - - String lineOne = "N "; - String lineTwo = "E "; - - if (this->error) { - lineOne = "Error: To much"; - lineTwo = "points are given"; - this->print(lineOne, lineTwo); - return; - } - - RouteInfo info = this->route->getRouteInfo(); - if (info.totalPoints == 0) { - lineOne = "No Points are"; - lineTwo = "available"; - this->print(lineOne, lineTwo); - return; - } - - Point p; - if (currentPage == 0) - p = this->route->startRoute(); - else if (this->lastPageNumber - 1 == currentPage) - p = this->route->getPreviousPoint(); - else if (this->lastPageNumber + 1 == currentPage) - p = this->route->getNextPoint(); - else if (currentPage == this->getCountPages() - 1) - p = this->route->endRoute(); - else - std::cout << "Error in: MenuRoutePoints::printPage()" << std::endl; - - char buf[20]; - char* string; - - info = this->route->getRouteInfo(); - string = dtostrf(p.getLatitude(), 9, 7, buf); - lineOne.concat(string); - lineOne.concat(" "); - lineOne.concat(info.currentPoint); - // lineOne.concat(currentPage); - string = dtostrf(p.getLongitude(), 9, 7, buf); - lineTwo.concat(string); - lineTwo.concat(" "); - lineTwo.concat(info.totalPoints); - // std::cout << "MenuRoutePoints::printPage currentPage: " << (int) currentPage << std::endl; - this->print(lineOne, lineTwo); -} diff --git a/src/SpecialMenus/Route/menuRoutePoints.h b/src/SpecialMenus/Route/menuRoutePoints.h deleted file mode 100644 index 58b60c7..0000000 --- a/src/SpecialMenus/Route/menuRoutePoints.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file menuRoutePoints.h - * @author Alexander Klein (alex@kleiax.de) - * @brief Contains a class to print the coordinates of a Route. - * @version 0.1 - * @date 2022-12-28 - * - * @copyright Copyright (c) 2022 - * - */ - -#ifndef MENU_ROUTE_POINTS_H -#define MENU_ROUTE_POINTS_H - -#include "navigation.h" -#include "route.h" -#include "menuInformationSites.h" - -/** - * @brief Prints coordinates of Route side by side. - * - */ -class MenuRoutePoints : public MenuInformationSites { - public: - /** - * @brief Construct a new Menu Route Points object - * - * @param route - */ - MenuRoutePoints(Route *route); - - /** - * @brief Configure the base class MenuInformationSites - * - * Set the amount of pages. - */ - void init () override; - - /** - * @brief Prints the the coordinates of the current Point. - */ - void printPage() const override; - - private: - Route* route; - bool error = false; - -}; - -#endif // MENU_ROUTE_POINTS_H diff --git a/src/driveModi/Modi/TestMode/testMode.cpp b/src/driveModi/Modi/TestMode/testMode.cpp index 921e45e..7bd13a0 100644 --- a/src/driveModi/Modi/TestMode/testMode.cpp +++ b/src/driveModi/Modi/TestMode/testMode.cpp @@ -10,10 +10,8 @@ */ #include "testMode.h" -TestMode::TestMode(DriveModiParams params, Navigation* navigation) - : DriveModi(params) { - this->navigation = navigation; -} +TestMode::TestMode(DriveModiParams params) + : DriveModi(params) {} TestMode::~TestMode() { this->moveControl->setDrivingStatus(MoveControl::Status::Stop); diff --git a/src/driveModi/Modi/TestMode/testMode.h b/src/driveModi/Modi/TestMode/testMode.h index abfe21f..844d9d4 100644 --- a/src/driveModi/Modi/TestMode/testMode.h +++ b/src/driveModi/Modi/TestMode/testMode.h @@ -14,7 +14,6 @@ #include #include "moveControl.h" -#include "navigation.h" #include "driveModi/driveModi.h" @@ -41,10 +40,9 @@ class TestMode : public DriveModi { /** * @brief Construct a new Test Mode object * - * @param moveControl - * @param navigation + * @param moveControl */ - TestMode(DriveModiParams params, Navigation* navigation); + TestMode(DriveModiParams params); ~TestMode(); bool drive(int16_t cm = 0, int16_t degree = 0); @@ -106,7 +104,6 @@ class TestMode : public DriveModi { void run() override; bool engineInit(int16_t powerPercentage, int16_t seconds); - Navigation* navigation; Maneuver maneuver = Maneuver::None; int16_t maneuverValueOne = 0; int16_t maneuverValueTwo = 0; diff --git a/src/driveModi/driveManager.cpp b/src/driveModi/driveManager.cpp index 5d7dc0f..bce31f0 100644 --- a/src/driveModi/driveManager.cpp +++ b/src/driveModi/driveManager.cpp @@ -25,10 +25,6 @@ DriveManager::DriveManager(DriveModiParams params){ this->init(); } -DriveManager::~DriveManager() { - delete this->navigation; -} - void DriveManager::changeModus(Modi modus) { this->currentModus = modus; @@ -36,8 +32,6 @@ void DriveManager::changeModus(Modi modus) { this->removeChildComponent(this->currentModusPtr); delete this->currentModusPtr; } - //Reset Route to first point - this->navigation->startNavigation(); switch (modus) { case Modi::Off: @@ -49,18 +43,8 @@ void DriveManager::changeModus(Modi modus) { } break; - case Modi::CaptureRoute: { - this->currentModusPtr = new CaptureRoute(this->driveModiParams, this->navigation); - } - break; - - case Modi::Autopilot: { - this->currentModusPtr = new Autopilot(this->driveModiParams, this->navigation); - } - break; - case Modi::TestMode: { - this->currentModusPtr = new TestMode(driveModiParams, this->navigation); + this->currentModusPtr = new TestMode(driveModiParams); } break; @@ -73,11 +57,8 @@ void DriveManager::changeModus(Modi modus) { this->addChildComponent(this->currentModusPtr); } -void DriveManager::init() { - this->navigation = new Navigation(this->driveModiParams.sensorData); - +void DriveManager::init() { this->addChildComponent(this->driveModiParams.moveControl); - this->addChildComponent(this->navigation); this->activateOnlyChilds(); } diff --git a/src/driveModi/driveManager.h b/src/driveModi/driveManager.h index b0e3215..9a6e2d4 100644 --- a/src/driveModi/driveManager.h +++ b/src/driveModi/driveManager.h @@ -17,7 +17,6 @@ #include "moveControl.h" #include "driveModi/driveModi.h" -#include "navigation.h" #include "config.h" #include "networkConfig.h" #include "debugTimes.h" @@ -27,8 +26,6 @@ // All Drive Modi #include "driveModi/Modi/ManualControl/manualControl.h" -#include "driveModi/Modi/CaptureRoute/captureRoute.h" -#include "driveModi/Modi/Autopilot/autopilot.h" #include "driveModi/Modi/TestMode/testMode.h" /** @@ -46,13 +43,6 @@ enum class Modi { class DriveManager : public Component { public: - /** - * @brief Construct a new Drive Manager object - * - * Creates a Navigation object - * - * @param moveControl - */ DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input); DriveManager(DriveModiParams params); @@ -72,13 +62,6 @@ class DriveManager : public Component { */ void changeModus(Modi modus); - /** - * @brief Get the Navigation object - * - * @return Navigation* - */ - Navigation* getNavigation() const {return this->navigation;} - /** * @brief Get the DriveModi Ptr object * @@ -104,7 +87,6 @@ class DriveManager : public Component { Modi currentModus = Modi::Off; DriveModi *currentModusPtr = nullptr; - Navigation* navigation; DriveModiParams driveModiParams; }; diff --git a/src/main.cpp b/src/main.cpp index 0044b6f..b006764 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,13 +38,10 @@ #include "menu.h" #include "menuAction.h" #include "SpecialMenus/driveModi/ManualDrive/menuManualDrive.h" -#include "SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.h" -#include "SpecialMenus/driveModi/Autopilot/menuAutopilot.h" #include "SpecialMenus/driveModi/TestMode/menuTestMode.h" #include "SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.h" #include "SpecialMenus/Systeminformation/menuSysteminformation.h" #include "SpecialMenus/PID/menuPidSettings.h" -#include "SpecialMenus/Route/menuRoute.h" #include "SpecialMenus/GPS/menuGPS.h" MoveControl moveController; @@ -218,33 +215,25 @@ void makeMenu() { MenuIntInput* pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0))); MenuIntInput* pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1))); MenuManualControl* man_m = new MenuManualControl(driveManager); - MenuCaptureRoute* cap_m = new MenuCaptureRoute(driveManager); - MenuAutopilot* auto_m = new MenuAutopilot(driveManager); MenuTestMode* testM_m = new MenuTestMode(driveManager); MenuCalibrateCompass* comp_m = new MenuCalibrateCompass(driveManager); MenuGPS* gps_m = new MenuGPS(sensorData); MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery); - MenuRoute* rout_m = new MenuRoute(driveManager->getNavigation()->getRoute()); - auto_m->setUpdateDelay(1000); gps_m->setUpdateDelay(1000); sys_m->setUpdateDelay(1500); // Entry for the main menu main_m->addEntry(new MenuAction("Mode", mode_m)); main_m->addEntry(new MenuAction("GPS", gps_m)); - main_m->addEntry(new MenuAction("Route", rout_m)); main_m->addEntry(new MenuAction("PID", pid_m)); main_m->addEntry(new MenuAction("Systeminfo", sys_m)); main_m->addEntry(new MenuAction("Restart", restart)); // Entry for the mode Menu mode_m->addEntry(new MenuAction("Manual Control", man_m)); - mode_m->addEntry(new MenuAction("Capture Route", cap_m)); - mode_m->addEntry(new MenuAction("Autopilot", auto_m)); mode_m->addEntry(new MenuAction("Gauge Compass", comp_m)); mode_m->addEntry(new MenuAction("Test Mode", testM_m)); - mode_m->addEntry(new MenuAction("Consol Control", dummy)); // Entry for the PID Menu pid_m->addEntry(new MenuAction("Left", pidl_m));