driveManager gets now the object
This commit is contained in:
@@ -210,15 +210,15 @@ void MenuAutopilot::runCommand() const {
|
|||||||
case 6:
|
case 6:
|
||||||
if (this->targetFreezed) {
|
if (this->targetFreezed) {
|
||||||
this->targetFreezed = false;
|
this->targetFreezed = false;
|
||||||
this->driveManager->getNavigation()->freezeTargetPoint(false);
|
this->autopilot->getNavigation()->freezeTargetPoint(false);
|
||||||
} else {
|
} else {
|
||||||
this->targetFreezed = true;
|
this->targetFreezed = true;
|
||||||
this->driveManager->getNavigation()->freezeTargetPoint();
|
this->autopilot->getNavigation()->freezeTargetPoint();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
this->minDistance = this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
this->minDistance = this->autopilot->getNavigation()->increaseMinDistanceToReachPoint();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -229,7 +229,7 @@ void MenuAutopilot::runCommand() const {
|
|||||||
void MenuAutopilot::runCommandNo() const {
|
void MenuAutopilot::runCommandNo() const {
|
||||||
switch (this->getCurrentPage()) {
|
switch (this->getCurrentPage()) {
|
||||||
case 7:
|
case 7:
|
||||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
this->minDistance = this->autopilot->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -247,9 +247,11 @@ void MenuAutopilot::update() {
|
|||||||
|
|
||||||
void MenuAutopilot::init() {
|
void MenuAutopilot::init() {
|
||||||
this->setCountPages(8);
|
this->setCountPages(8);
|
||||||
this->driveManager->changeModus(Modi::Autopilot);
|
this->autopilot = new Autopilot();
|
||||||
this->autopilot = (Autopilot*) this->driveManager->getDriveModiPtr();
|
this->driveManager->changeModus(this->autopilot);
|
||||||
this->routeInfo = this->autopilot->getRouteInfo();
|
this->routeInfo = this->autopilot->getRouteInfo();
|
||||||
this->driveManager->getNavigation()->increaseMinDistanceToReachPoint();
|
|
||||||
this->minDistance = this->driveManager->getNavigation()->decreaseMinDistanceToReachPoint();
|
//dirty hack to get the val, can be better!!! TODO
|
||||||
|
this->autopilot->getNavigation()->increaseMinDistanceToReachPoint();
|
||||||
|
this->minDistance = this->autopilot->getNavigation()->decreaseMinDistanceToReachPoint();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define MENU_AUTOPILOT_DRIVE_H
|
#define MENU_AUTOPILOT_DRIVE_H
|
||||||
|
|
||||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||||
|
#include "driveModi/Modi/Autopilot/autopilot.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A class to print informations about the Autopilot
|
* @brief A class to print informations about the Autopilot
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ void MenuCalibrateCompass::printPage() const {
|
|||||||
|
|
||||||
void MenuCalibrateCompass::init() {
|
void MenuCalibrateCompass::init() {
|
||||||
this->firstPrint = false;
|
this->firstPrint = false;
|
||||||
this->driveManager->changeModus(Modi::CalibrateCompass);
|
this->caliCompassMode = new CalibrateCompassM();
|
||||||
this->caliCompassMode = (CalibrateCompassM*) this->driveManager->getDriveModiPtr();
|
this->driveManager->changeModus(this->caliCompassMode);
|
||||||
this->caliCompass = new CalibrateCompass(this->caliCompassMode->getSensorData()->getRealCompass());
|
this->caliCompass = new CalibrateCompass(this->caliCompassMode->getSensorData()->getRealCompass());
|
||||||
this->setCountPages(11);
|
this->setCountPages(11);
|
||||||
this->updateDelay = 500;
|
this->updateDelay = 500;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void MenuCaptureRoute::printPage() const {
|
|||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
lineOne = "Current minimal";
|
lineOne = "Current minimal";
|
||||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||||
lineTwo = "accuracy is high";
|
lineTwo = "accuracy is high";
|
||||||
else
|
else
|
||||||
lineTwo = "accuracy is low";
|
lineTwo = "accuracy is low";
|
||||||
@@ -118,10 +118,10 @@ void MenuCaptureRoute::runCommand() const {
|
|||||||
switch (this->getCurrentPage())
|
switch (this->getCurrentPage())
|
||||||
{
|
{
|
||||||
case 7:
|
case 7:
|
||||||
if (this->driveManager->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
if (this->captureRoute->getNavigation()->getMinAccuracy() >= Point::Accuracy::twoDigOfCM)
|
||||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::none);
|
||||||
else
|
else
|
||||||
this->driveManager->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
this->captureRoute->getNavigation()->setMinAccuracy(Point::Accuracy::twoDigOfCM);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -132,7 +132,7 @@ void MenuCaptureRoute::runCommand() const {
|
|||||||
void MenuCaptureRoute::init() {
|
void MenuCaptureRoute::init() {
|
||||||
this->setCountPages(8);
|
this->setCountPages(8);
|
||||||
this->updateDelay = 500;
|
this->updateDelay = 500;
|
||||||
this->driveManager->changeModus(Modi::CaptureRoute);
|
this->captureRoute = new CaptureRoute();
|
||||||
this->captureRoute = (CaptureRoute*) this->driveManager->getDriveModiPtr();
|
this->driveManager->changeModus(this->captureRoute);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#define MENU_MANUAL_DRIVE_H
|
#define MENU_MANUAL_DRIVE_H
|
||||||
|
|
||||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||||
|
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A class to print informations about the Autopilot
|
* @brief A class to print informations about the Autopilot
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ void MenuManualControl::printPage() const {
|
|||||||
|
|
||||||
void MenuManualControl::init() {
|
void MenuManualControl::init() {
|
||||||
this->firstPrint = false;
|
this->firstPrint = false;
|
||||||
this->driveManager->changeModus(Modi::ManualControl);
|
this->manualControl = new ManualControl();
|
||||||
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
this->driveManager->changeModus(this->manualControl);
|
||||||
this->setCountPages(4);
|
this->setCountPages(4);
|
||||||
this->updateDelay = 500;
|
this->updateDelay = 500;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#define MENU_MANUAL_DRIVE_H
|
#define MENU_MANUAL_DRIVE_H
|
||||||
|
|
||||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||||
#include "calibrateCompass.h"
|
#include "driveModi/Modi/ManualControl/manualControl.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A class to print informations about the class ManualControl
|
* @brief A class to print informations about the class ManualControl
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ void MenuTestMode::no() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::init() {
|
void MenuTestMode::init() {
|
||||||
this->driveManager->changeModus(Modi::TestMode);
|
this->testMode = new TestMode();
|
||||||
this->testMode = (TestMode*) this->driveManager->getDriveModiPtr();
|
this->driveManager->changeModus(this->testMode);
|
||||||
|
|
||||||
testMode->setMaxSpeed(1);
|
testMode->setMaxSpeed(1);
|
||||||
testMode->setMaxRotation(8);
|
testMode->setMaxRotation(8);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ MenuDriveMode::MenuDriveMode(DriveManager* driveManager) {
|
|||||||
void MenuDriveMode::left() {
|
void MenuDriveMode::left() {
|
||||||
this->firstPrint = true;
|
this->firstPrint = true;
|
||||||
this->configureOnLeave();
|
this->configureOnLeave();
|
||||||
this->driveManager->changeModus(Modi::Off);
|
this->driveManager->changeModus();
|
||||||
if (parentMenu) {
|
if (parentMenu) {
|
||||||
this->parentMenu->printMenu();
|
this->parentMenu->printMenu();
|
||||||
this->leaved = true;
|
this->leaved = true;
|
||||||
|
|||||||
@@ -26,12 +26,11 @@ void DirectionChangeSignal::action() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Autopilot::Autopilot(DriveModiParams params, Navigation* navigation)
|
Autopilot::Autopilot() {
|
||||||
: ManualControl(params) {
|
|
||||||
this->setInputMode(ManualControl::InputMode::Digital);
|
this->setInputMode(ManualControl::InputMode::Digital);
|
||||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||||
this->navigation = navigation;
|
this->navigation = new Navigation(this->sensorData);
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Autopilot : public ManualControl {
|
|||||||
* @param moveControl for ManualControl
|
* @param moveControl for ManualControl
|
||||||
* @param navigation for route instructions
|
* @param navigation for route instructions
|
||||||
*/
|
*/
|
||||||
Autopilot(DriveModiParams params, Navigation* navigation);
|
Autopilot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the Autopilot object
|
* @brief Destroy the Autopilot object
|
||||||
@@ -78,6 +78,7 @@ class Autopilot : public ManualControl {
|
|||||||
* @return State
|
* @return State
|
||||||
*/
|
*/
|
||||||
State getState() const { return this->state; }
|
State getState() const { return this->state; }
|
||||||
|
Navigation* getNavigation() const { return this->navigation; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tells if there are new informations to display
|
* @brief Tells if there are new informations to display
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "calibrateCompassM.h"
|
#include "calibrateCompassM.h"
|
||||||
|
|
||||||
CalibrateCompassM::CalibrateCompassM(DriveModiParams params) : ManualControl(params) {}
|
|
||||||
|
|
||||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||||
if (caliCompass) {
|
if (caliCompass) {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
class CalibrateCompassM : public ManualControl {
|
class CalibrateCompassM : public ManualControl {
|
||||||
public:
|
public:
|
||||||
CalibrateCompassM(DriveModiParams params);
|
|
||||||
|
|
||||||
void setCalibrateCompass(CalibrateCompass* caliCompass = nullptr);
|
void setCalibrateCompass(CalibrateCompass* caliCompass = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -11,9 +11,8 @@
|
|||||||
|
|
||||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||||
|
|
||||||
CaptureRoute::CaptureRoute(DriveModiParams params, Navigation* navigation)
|
CaptureRoute::CaptureRoute() {
|
||||||
: ManualControl(params) {
|
this->navigation = new Navigation(this->sensorData);
|
||||||
this->navigation = navigation;
|
|
||||||
this->navigation->getRoute()->clear();
|
this->navigation->getRoute()->clear();
|
||||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||||
this->routeInfo = navigation->getRouteInfo();
|
this->routeInfo = navigation->getRouteInfo();
|
||||||
|
|||||||
@@ -27,13 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
class CaptureRoute : public ManualControl {
|
class CaptureRoute : public ManualControl {
|
||||||
public:
|
public:
|
||||||
/**
|
CaptureRoute();
|
||||||
* @brief Construct a new Capture Route object
|
|
||||||
*
|
|
||||||
* @param moveControl for ManualControl
|
|
||||||
* @param navigation to add Points
|
|
||||||
*/
|
|
||||||
CaptureRoute(DriveModiParams params, Navigation* navigation);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the Capture Route object
|
* @brief Destroy the Capture Route object
|
||||||
@@ -56,6 +50,7 @@ class CaptureRoute : public ManualControl {
|
|||||||
*/
|
*/
|
||||||
RouteInfo getRouteInfo() const { return this->routeInfo; }
|
RouteInfo getRouteInfo() const { return this->routeInfo; }
|
||||||
Navigation::Status getLastStatus() const { return this->status; }
|
Navigation::Status getLastStatus() const { return this->status; }
|
||||||
|
Navigation* getNavigation() const { return this->navigation; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the distance to the last saved oint
|
* @brief Get the distance to the last saved oint
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ class ManualControl : public DriveModi {
|
|||||||
Digital
|
Digital
|
||||||
};
|
};
|
||||||
|
|
||||||
ManualControl(DriveModiParams params) : DriveModi(params){};
|
|
||||||
|
|
||||||
void switchInputMode();
|
void switchInputMode();
|
||||||
void setInputMode(InputMode mode) { this->inputMode = mode; }
|
void setInputMode(InputMode mode) { this->inputMode = mode; }
|
||||||
InputMode getInputMode() const { return this->inputMode; }
|
InputMode getInputMode() const { return this->inputMode; }
|
||||||
|
|||||||
@@ -10,15 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "testMode.h"
|
#include "testMode.h"
|
||||||
|
|
||||||
TestMode::TestMode(DriveModiParams params, Navigation* navigation)
|
|
||||||
: DriveModi(params) {
|
|
||||||
this->navigation = navigation;
|
|
||||||
}
|
|
||||||
|
|
||||||
TestMode::~TestMode() {
|
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestMode::run() {
|
void TestMode::run() {
|
||||||
if (this->maneuver == Maneuver::Turn) {
|
if (this->maneuver == Maneuver::Turn) {
|
||||||
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
||||||
|
|||||||
@@ -38,15 +38,6 @@ class TestMode : public DriveModi {
|
|||||||
Drive
|
Drive
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Construct a new Test Mode object
|
|
||||||
*
|
|
||||||
* @param moveControl
|
|
||||||
* @param navigation
|
|
||||||
*/
|
|
||||||
TestMode(DriveModiParams params, Navigation* navigation);
|
|
||||||
~TestMode();
|
|
||||||
|
|
||||||
bool drive(int16_t cm = 0, int16_t degree = 0);
|
bool drive(int16_t cm = 0, int16_t degree = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,59 +25,21 @@ DriveManager::DriveManager(DriveModiParams params){
|
|||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
DriveManager::~DriveManager() {
|
void DriveManager::changeModus(DriveModi* modus) {
|
||||||
delete this->navigation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DriveManager::changeModus(Modi modus) {
|
|
||||||
this->currentModus = modus;
|
|
||||||
|
|
||||||
if (this->currentModusPtr) {
|
if (this->currentModusPtr) {
|
||||||
this->removeChildComponent(this->currentModusPtr);
|
this->removeChildComponent(this->currentModusPtr);
|
||||||
delete this->currentModusPtr;
|
delete this->currentModusPtr;
|
||||||
|
this->currentModusPtr = nullptr;
|
||||||
}
|
}
|
||||||
//Reset Route to first point
|
|
||||||
this->navigation->startNavigation();
|
|
||||||
|
|
||||||
switch (modus) {
|
this->currentModusPtr = modus;
|
||||||
case Modi::Off:
|
|
||||||
this->currentModusPtr = nullptr;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Modi::ManualControl: {
|
|
||||||
this->currentModusPtr = new ManualControl(this->driveModiParams);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
this->currentModusPtr = nullptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->currentModusPtr)
|
if (this->currentModusPtr)
|
||||||
|
this->currentModusPtr->activate(this->driveModiParams);
|
||||||
this->addChildComponent(this->currentModusPtr);
|
this->addChildComponent(this->currentModusPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriveManager::init() {
|
void DriveManager::init() {
|
||||||
this->navigation = new Navigation(this->driveModiParams.sensorData);
|
|
||||||
|
|
||||||
this->addChildComponent(this->driveModiParams.moveControl);
|
this->addChildComponent(this->driveModiParams.moveControl);
|
||||||
this->addChildComponent(this->navigation);
|
|
||||||
this->activateOnlyChilds();
|
this->activateOnlyChilds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,38 +12,14 @@
|
|||||||
#ifndef DRIVE_MANAGER_H
|
#ifndef DRIVE_MANAGER_H
|
||||||
#define DRIVE_MANAGER_H
|
#define DRIVE_MANAGER_H
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include <SPI.h>
|
|
||||||
|
|
||||||
#include "moveControl.h"
|
#include "moveControl.h"
|
||||||
#include "driveModi/driveModi.h"
|
#include "driveModi/driveModi.h"
|
||||||
#include "navigation.h"
|
#include "navigation.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "networkConfig.h"
|
|
||||||
#include "debugTimes.h"
|
|
||||||
#include "controlPadInput.h"
|
#include "controlPadInput.h"
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
#include "sensorData.h"
|
#include "sensorData.h"
|
||||||
|
|
||||||
// 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"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief An enum to choose the DriveMode
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
enum class Modi {
|
|
||||||
Off,
|
|
||||||
ManualControl,
|
|
||||||
CalibrateCompass,
|
|
||||||
CaptureRoute,
|
|
||||||
Autopilot,
|
|
||||||
TestMode
|
|
||||||
};
|
|
||||||
|
|
||||||
class DriveManager : public Component {
|
class DriveManager : public Component {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -70,14 +46,7 @@ class DriveManager : public Component {
|
|||||||
*
|
*
|
||||||
* @param modus
|
* @param modus
|
||||||
*/
|
*/
|
||||||
void changeModus(Modi modus);
|
void changeModus(DriveModi* modus = nullptr);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the Navigation object
|
|
||||||
*
|
|
||||||
* @return Navigation*
|
|
||||||
*/
|
|
||||||
Navigation* getNavigation() const {return this->navigation;}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the DriveModi Ptr object
|
* @brief Get the DriveModi Ptr object
|
||||||
@@ -91,20 +60,14 @@ class DriveManager : public Component {
|
|||||||
*/
|
*/
|
||||||
DriveModi* getDriveModiPtr() const { return this->currentModusPtr; }
|
DriveModi* getDriveModiPtr() const { return this->currentModusPtr; }
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the DriveModi enum
|
bool isActive() const { return this->currentModusPtr; }
|
||||||
*
|
|
||||||
* @return Modi
|
|
||||||
*/
|
|
||||||
Modi getDriveModi() const { return this->currentModus; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override {};
|
void run() override {};
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
Modi currentModus = Modi::Off;
|
|
||||||
DriveModi *currentModusPtr = nullptr;
|
DriveModi *currentModusPtr = nullptr;
|
||||||
Navigation* navigation;
|
|
||||||
DriveModiParams driveModiParams;
|
DriveModiParams driveModiParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+16
-12
@@ -1,17 +1,7 @@
|
|||||||
#include "driveModi.h"
|
#include "driveModi.h"
|
||||||
|
|
||||||
DriveModi::DriveModi(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData) {
|
DriveModi::DriveModi() {
|
||||||
this->moveControl = moveControl;
|
this->loopDelay = 0;
|
||||||
this->input = input;
|
|
||||||
this->sensorData = sensorData;
|
|
||||||
this->init();
|
|
||||||
}
|
|
||||||
|
|
||||||
DriveModi::DriveModi(DriveModiParams params){
|
|
||||||
this->moveControl = params.moveControl;
|
|
||||||
this->input = params.input;
|
|
||||||
this->sensorData = params.sensorData;
|
|
||||||
this->init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DriveModi::~DriveModi() {
|
DriveModi::~DriveModi() {
|
||||||
@@ -20,6 +10,20 @@ DriveModi::~DriveModi() {
|
|||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DriveModi::activate(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData) {
|
||||||
|
this->moveControl = moveControl;
|
||||||
|
this->input = input;
|
||||||
|
this->sensorData = sensorData;
|
||||||
|
this->init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DriveModi::activate(DriveModiParams params){
|
||||||
|
this->moveControl = params.moveControl;
|
||||||
|
this->input = params.input;
|
||||||
|
this->sensorData = params.sensorData;
|
||||||
|
this->init();
|
||||||
|
}
|
||||||
|
|
||||||
void DriveModi::init() {
|
void DriveModi::init() {
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||||
this->loopDelay = 40;
|
this->loopDelay = 40;
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ struct DriveModiParams {
|
|||||||
*/
|
*/
|
||||||
class DriveModi : public Component {
|
class DriveModi : public Component {
|
||||||
public:
|
public:
|
||||||
DriveModi(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData);
|
DriveModi();
|
||||||
DriveModi(DriveModiParams);
|
|
||||||
virtual ~DriveModi();
|
virtual ~DriveModi();
|
||||||
|
|
||||||
const SensorData* getSensorData() const { return this->sensorData; }
|
const SensorData* getSensorData() const { return this->sensorData; }
|
||||||
|
|
||||||
|
void activate(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData);
|
||||||
|
void activate(DriveModiParams params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the max speed
|
* @brief Set the max speed
|
||||||
*
|
*
|
||||||
|
|||||||
+2
-1
@@ -224,7 +224,8 @@ void makeMenu() {
|
|||||||
MenuCalibrateCompass* comp_m = new MenuCalibrateCompass(driveManager);
|
MenuCalibrateCompass* comp_m = new MenuCalibrateCompass(driveManager);
|
||||||
MenuGPS* gps_m = new MenuGPS(sensorData);
|
MenuGPS* gps_m = new MenuGPS(sensorData);
|
||||||
MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery);
|
MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery);
|
||||||
MenuRoute* rout_m = new MenuRoute(driveManager->getNavigation()->getRoute());
|
//TODO: Wie bekommt jeder die dumme Route?
|
||||||
|
MenuRoute* rout_m = new MenuRoute(new Route());
|
||||||
|
|
||||||
auto_m->setUpdateDelay(1000);
|
auto_m->setUpdateDelay(1000);
|
||||||
gps_m->setUpdateDelay(1000);
|
gps_m->setUpdateDelay(1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user