Merge branch 'main' into projektarbeit
This commit is contained in:
@@ -11,14 +11,14 @@
|
||||
|
||||
#include "menuGPS.h"
|
||||
|
||||
MenuGPS::MenuGPS(DriveManager* driveManager) :
|
||||
MenuGPS::MenuGPS(SensorData* sensorData) :
|
||||
MenuInformationSites(10) {
|
||||
this->navigation = driveManager->getNavigation();
|
||||
this->ntripClient = this->navigation->getNTRIPClient();
|
||||
this->sensorData = sensorData;
|
||||
// this->ntripClient = this->navigation->getNTRIPClient();
|
||||
}
|
||||
|
||||
void MenuGPS::printPage() const {
|
||||
UBX_NAV_PVT_data_t* gpsData = this->navigation->getUbxData();
|
||||
const UBX_NAV_PVT_data_t* gpsData = this->sensorData->getGnssData();
|
||||
uint8_t fixType = 0;
|
||||
if (gpsData)
|
||||
fixType = gpsData->fixType;
|
||||
@@ -66,15 +66,15 @@ void MenuGPS::printPage() const {
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
NTRIPClientStates status = this->ntripClient->getClientState();
|
||||
lineOne = "NTRIP Client is";
|
||||
// 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";
|
||||
// if (status == NTRIPClientStates::pushData)
|
||||
// lineTwo = "enabled";
|
||||
// else if (status == NTRIPClientStates::notAvailable)
|
||||
// lineTwo = "not available";
|
||||
// else
|
||||
// lineTwo = "disabled";
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -134,7 +134,7 @@ void MenuGPS::printPage() const {
|
||||
case 8:
|
||||
lineOne = "Azimuth: ";
|
||||
lineTwo = "";
|
||||
lineTwo.concat(this->navigation->getAzimuth());
|
||||
lineTwo.concat(this->sensorData->getRealAzimuth());
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -148,12 +148,12 @@ void MenuGPS::printPage() const {
|
||||
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;
|
||||
// // 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||
|
||||
#include "menuInformationSites.h"
|
||||
#include "driveModi/driveManager.h"
|
||||
#include "navigation.h"
|
||||
#include "sensorData.h"
|
||||
#include "ntripClient.h"
|
||||
|
||||
/**
|
||||
@@ -30,14 +29,14 @@ class MenuGPS : public MenuInformationSites {
|
||||
*
|
||||
* @param gps
|
||||
*/
|
||||
MenuGPS(DriveManager* driveManager);
|
||||
MenuGPS(SensorData* sensorData);
|
||||
|
||||
private:
|
||||
void printPage() const override;
|
||||
void runCommand() const override;
|
||||
|
||||
NTRIPClient* ntripClient;
|
||||
Navigation* navigation;
|
||||
// NTRIPClient* ntripClient;
|
||||
SensorData* sensorData;
|
||||
};
|
||||
|
||||
#endif // MENU_GPS_H
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
*/
|
||||
#include "menuCalibrateCompass.h"
|
||||
|
||||
MenuCalibrateCompass::MenuCalibrateCompass(DriveManager* driveManager) : MenuDriveMode(driveManager) {
|
||||
this->caliCompass = new CalibrateCompass(this->driveManager->getNavigation()->getCompass());
|
||||
}
|
||||
MenuCalibrateCompass::MenuCalibrateCompass(DriveManager* driveManager) : MenuDriveMode(driveManager) {}
|
||||
|
||||
MenuCalibrateCompass::~MenuCalibrateCompass() {
|
||||
delete this->caliCompass;
|
||||
this->manualControl->setCalibrateCompass();
|
||||
this->caliCompassMode->setCalibrateCompass();
|
||||
}
|
||||
|
||||
void MenuCalibrateCompass::printPage() const {
|
||||
@@ -31,7 +29,7 @@ void MenuCalibrateCompass::printPage() const {
|
||||
|
||||
case 1:
|
||||
lineOne = "Azimuth:";
|
||||
lineTwo.concat(this->driveManager->getNavigation()->getAzimuth());
|
||||
lineTwo.concat(this->caliCompassMode->getSensorData()->getRealAzimuth());
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -112,8 +110,9 @@ void MenuCalibrateCompass::printPage() const {
|
||||
|
||||
void MenuCalibrateCompass::init() {
|
||||
this->firstPrint = false;
|
||||
this->driveManager->changeModus(Modi::ManualControl);
|
||||
this->manualControl = (ManualControl*) this->driveManager->getDriveModiPtr();
|
||||
this->driveManager->changeModus(Modi::CalibrateCompass);
|
||||
this->caliCompassMode = (CalibrateCompassM*) this->driveManager->getDriveModiPtr();
|
||||
this->caliCompass = new CalibrateCompass(this->caliCompassMode->getSensorData()->getRealCompass());
|
||||
this->setCountPages(11);
|
||||
this->updateDelay = 500;
|
||||
}
|
||||
@@ -123,12 +122,12 @@ void MenuCalibrateCompass::runCommand() const {
|
||||
case 2:
|
||||
switch (this->caliCompass->getState()) {
|
||||
case CalibrateCompass::State::Ready :
|
||||
this->manualControl->setCalibrateCompass(this->caliCompass);
|
||||
this->caliCompassMode->setCalibrateCompass(this->caliCompass);
|
||||
this->caliCompass->start();
|
||||
break;
|
||||
|
||||
case CalibrateCompass::State::Finished:
|
||||
this->manualControl->setCalibrateCompass();
|
||||
this->caliCompassMode->setCalibrateCompass();
|
||||
this->caliCompass->useData();
|
||||
break;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define MENU_CALIBRATE_COMPASS_H
|
||||
|
||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||
#include "driveModi/Modi/CalibrateCompass/calibrateCompassM.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,7 @@ class MenuCalibrateCompass : public MenuDriveMode {
|
||||
void runCommand() const override;
|
||||
|
||||
private:
|
||||
ManualControl* manualControl;
|
||||
CalibrateCompassM* caliCompassMode;
|
||||
CalibrateCompass* caliCompass;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @file calibrateCompassM.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-03
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#include "calibrateCompassM.h"
|
||||
|
||||
CalibrateCompassM::CalibrateCompassM(DriveModiParams params) : ManualControl(params) {}
|
||||
|
||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||
if (caliCompass) {
|
||||
this->caliCompass = caliCompass;
|
||||
this->addChildComponent(this->caliCompass);
|
||||
} else if (this->caliCompass) {
|
||||
this->removeChildComponent(this->caliCompass);
|
||||
this->caliCompass = caliCompass;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @file calibrateCompassM.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2023-09-03
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CALIBRATE_COMPASS_M_H
|
||||
#define CALIBRATE_COMPASS_M_H
|
||||
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
#include "driveModi/Modi/ManualControl/manualControl.h"
|
||||
|
||||
class CalibrateCompassM : public ManualControl {
|
||||
public:
|
||||
CalibrateCompassM(DriveModiParams params);
|
||||
|
||||
void setCalibrateCompass(CalibrateCompass* caliCompass = nullptr);
|
||||
|
||||
private:
|
||||
CalibrateCompass* caliCompass = nullptr;
|
||||
};
|
||||
|
||||
#endif //CALIBRATE_COMPASS_M_H
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* @file consolControl.cpp
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2022-02-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include "consolControl.h"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* @file consolControl.h
|
||||
* @author Alexander Klein (alex@kleiax.de)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2022-02-15
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CONSOL_CONTROL_H
|
||||
#define CONSOL_CONTROL_H
|
||||
|
||||
#include "driveModi/driveModi.h"
|
||||
class ConsolControl : DriveModi{
|
||||
|
||||
};
|
||||
|
||||
#endif // CONSOL_CONTROL_H
|
||||
@@ -10,15 +10,6 @@
|
||||
*/
|
||||
#include "manualControl.h"
|
||||
|
||||
ManualControl::ManualControl(MoveControl* moveControl, const ControlPadInput *input)
|
||||
: DriveModi(moveControl) {
|
||||
this->input = input;
|
||||
}
|
||||
|
||||
ManualControl::~ManualControl() {
|
||||
|
||||
}
|
||||
|
||||
void ManualControl::run() {
|
||||
switch (this->inputMode) {
|
||||
case InputMode::Analog :
|
||||
@@ -34,16 +25,6 @@ void ManualControl::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void ManualControl::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||
if (caliCompass) {
|
||||
this->caliCompass = caliCompass;
|
||||
this->addChildComponent(this->caliCompass);
|
||||
} else if (this->caliCompass) {
|
||||
this->removeChildComponent(this->caliCompass);
|
||||
this->caliCompass = caliCompass;
|
||||
}
|
||||
}
|
||||
|
||||
void ManualControl::switchInputMode() {
|
||||
this->inputMode = (this->inputMode == InputMode::Analog) ? InputMode::Digital : InputMode::Analog;
|
||||
}
|
||||
@@ -51,7 +32,7 @@ void ManualControl::switchInputMode() {
|
||||
void ManualControl::analogControl() {
|
||||
// Have to be int16_t to avoid overflow (int8_t = 255 - 127 = -128)
|
||||
int16_t x = this->input->x - 127;
|
||||
int16_t y = this->input->y - 127;
|
||||
int16_t y = this-> input->y - 127;
|
||||
|
||||
// static int counter = 0;
|
||||
// if (counter % 60 == 0) {
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
#ifndef MANUAL_CONTROL_H
|
||||
#define MANUAL_CONTROL_H
|
||||
|
||||
#include "moveControl.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
#include "controlPadInput.h"
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
class DirectionChangeWrapper {
|
||||
public:
|
||||
@@ -36,10 +33,7 @@ class ManualControl : public DriveModi {
|
||||
Digital
|
||||
};
|
||||
|
||||
ManualControl(MoveControl *moveControl, const ControlPadInput *input);
|
||||
~ManualControl();
|
||||
|
||||
void setCalibrateCompass(CalibrateCompass* caliCompass = nullptr);
|
||||
ManualControl(DriveModiParams params) : DriveModi(params){};
|
||||
|
||||
void switchInputMode();
|
||||
void setInputMode(InputMode mode) { this->inputMode = mode; }
|
||||
@@ -51,14 +45,12 @@ class ManualControl : public DriveModi {
|
||||
|
||||
protected:
|
||||
void run() override;
|
||||
const ControlPadInput* input;
|
||||
|
||||
private:
|
||||
void analogControl();
|
||||
void digitalControl();
|
||||
|
||||
bool lastLoopTurned = false;
|
||||
CalibrateCompass* caliCompass = nullptr;
|
||||
DirectionChangeWrapper* directionChangeWrapper = nullptr;
|
||||
InputMode inputMode = InputMode::Analog;
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
*/
|
||||
#include "testMode.h"
|
||||
|
||||
TestMode::TestMode(MoveControl *moveControl, Navigation* navigation)
|
||||
: DriveModi(moveControl) {
|
||||
TestMode::TestMode(DriveModiParams params, Navigation* navigation)
|
||||
: DriveModi(params) {
|
||||
this->navigation = navigation;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ TestMode::~TestMode() {
|
||||
|
||||
void TestMode::run() {
|
||||
if (this->maneuver == Maneuver::Turn) {
|
||||
uint16_t delta = abs(this->azimuth - this->navigation->getAzimuth());
|
||||
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
||||
if (delta > this->degree)
|
||||
this->abort = true;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ bool TestMode::drive(int16_t cm, int16_t degree) {
|
||||
else if (degree > 0)
|
||||
this->moveControl->setRotationSpeed(this->maxRotationSpeed);
|
||||
|
||||
this->azimuth = this->navigation->getAzimuth();
|
||||
this->azimuth = this->getSensorData()->getRealAzimuth();
|
||||
this->degree = degree;
|
||||
|
||||
this->maneuverTime = 5 * 1000;
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestMode : public DriveModi {
|
||||
* @param moveControl
|
||||
* @param navigation
|
||||
*/
|
||||
TestMode(MoveControl *moveControl, Navigation* navigation);
|
||||
TestMode(DriveModiParams params, Navigation* navigation);
|
||||
~TestMode();
|
||||
|
||||
bool drive(int16_t cm = 0, int16_t degree = 0);
|
||||
|
||||
@@ -11,33 +11,22 @@
|
||||
|
||||
#include "driveModi/driveManager.h"
|
||||
|
||||
Modi& operator++(Modi& m, int) {
|
||||
return m = (m == Modi::TestMode) ? Modi::Off : static_cast<Modi>(static_cast<int>(m)+1);
|
||||
DriveManager::DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input) {
|
||||
this->driveModiParams.input = input;
|
||||
this->driveModiParams.moveControl = moveControl;
|
||||
this->driveModiParams.sensorData = sensorData;
|
||||
|
||||
this->init();
|
||||
}
|
||||
|
||||
DriveManager::DriveManager(MoveControl *moveControl, SPIClass *spiPort, const ControlPadInput *input, bool wifi) {
|
||||
this->moveControl = moveControl;
|
||||
this->input = input;
|
||||
|
||||
this->spiPort = spiPort;
|
||||
this->navigation = new Navigation(spiPort, PinNumbers::gnssSpiCs);
|
||||
if (wifi)
|
||||
this->navigation->initNtrip(NTRIP_HOST, NTRIP_PORT, NTRIP_MOUNT_POINT, NTRIP_USER, NTRIP_PASSWORD);
|
||||
DriveManager::DriveManager(DriveModiParams params){
|
||||
this->driveModiParams = params;
|
||||
|
||||
this->addChildComponent(this->moveControl);
|
||||
this->addChildComponent(this->navigation);
|
||||
this->activateOnlyChilds();
|
||||
this->init();
|
||||
}
|
||||
|
||||
DriveManager::~DriveManager() {
|
||||
delete this->navigation;
|
||||
delete this->spiPort;
|
||||
}
|
||||
|
||||
void DriveManager::run() {}
|
||||
|
||||
void DriveManager::nextModus() {
|
||||
changeModus(this->currentModus++);
|
||||
}
|
||||
|
||||
void DriveManager::changeModus(Modi modus) {
|
||||
@@ -56,26 +45,22 @@ void DriveManager::changeModus(Modi modus) {
|
||||
break;
|
||||
|
||||
case Modi::ManualControl: {
|
||||
this->currentModusPtr = new ManualControl(this->moveControl, this->input);
|
||||
this->currentModusPtr = new ManualControl(this->driveModiParams);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::CaptureRoute: {
|
||||
this->currentModusPtr = new CaptureRoute(this->moveControl, this->input, this->navigation);
|
||||
this->currentModusPtr = new CaptureRoute(this->driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::Autopilot: {
|
||||
this->currentModusPtr = new Autopilot(this->moveControl, this->input, this->navigation);
|
||||
this->currentModusPtr = new Autopilot(this->driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case Modi::ConsolControl:
|
||||
this->currentModusPtr = nullptr;
|
||||
break;
|
||||
|
||||
case Modi::TestMode: {
|
||||
this->currentModusPtr = new TestMode(this->moveControl, this->navigation);
|
||||
this->currentModusPtr = new TestMode(driveModiParams, this->navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -88,3 +73,11 @@ void DriveManager::changeModus(Modi modus) {
|
||||
this->addChildComponent(this->currentModusPtr);
|
||||
}
|
||||
|
||||
void DriveManager::init() {
|
||||
this->navigation = new Navigation(this->driveModiParams.sensorData);
|
||||
|
||||
this->addChildComponent(this->driveModiParams.moveControl);
|
||||
this->addChildComponent(this->navigation);
|
||||
this->activateOnlyChilds();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
#include "debugTimes.h"
|
||||
#include "controlPadInput.h"
|
||||
#include "component.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/ConsolControl/consolControl.h"
|
||||
#include "driveModi/Modi/TestMode/testMode.h"
|
||||
|
||||
/**
|
||||
@@ -38,9 +38,9 @@
|
||||
enum class Modi {
|
||||
Off,
|
||||
ManualControl,
|
||||
CalibrateCompass,
|
||||
CaptureRoute,
|
||||
Autopilot,
|
||||
ConsolControl,
|
||||
TestMode
|
||||
};
|
||||
|
||||
@@ -53,7 +53,8 @@ class DriveManager : public Component {
|
||||
*
|
||||
* @param moveControl
|
||||
*/
|
||||
DriveManager(MoveControl *moveControl, SPIClass *spiPort, const ControlPadInput *input, bool wifi = false);
|
||||
DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input);
|
||||
DriveManager(DriveModiParams params);
|
||||
|
||||
/**
|
||||
* @brief Destroy the Drive Manager object
|
||||
@@ -61,14 +62,6 @@ class DriveManager : public Component {
|
||||
*/
|
||||
~DriveManager();
|
||||
|
||||
/**
|
||||
* @brief Increment the DriveModi enum
|
||||
* Than calls changeModus
|
||||
*
|
||||
* @see Modi
|
||||
*/
|
||||
void nextModus();
|
||||
|
||||
/**
|
||||
* @brief Change the DriveModi to a specific value
|
||||
*
|
||||
@@ -106,14 +99,13 @@ class DriveManager : public Component {
|
||||
Modi getDriveModi() const { return this->currentModus; }
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void run() override {};
|
||||
void init();
|
||||
|
||||
Modi currentModus = Modi::Off;
|
||||
MoveControl *moveControl;
|
||||
const ControlPadInput* input;
|
||||
DriveModi *currentModusPtr = nullptr;
|
||||
Navigation* navigation;
|
||||
SPIClass* spiPort;
|
||||
DriveModiParams driveModiParams;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
#include "driveModi.h"
|
||||
|
||||
DriveModi::DriveModi(MoveControl* moveControl) {
|
||||
DriveModi::DriveModi(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData) {
|
||||
this->moveControl = moveControl;
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
this->loopDelay = 40;
|
||||
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() {
|
||||
@@ -11,3 +19,8 @@ DriveModi::~DriveModi() {
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
}
|
||||
|
||||
void DriveModi::init() {
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
this->loopDelay = 40;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,14 @@
|
||||
|
||||
#include "component.h"
|
||||
#include "moveControl.h"
|
||||
#include "controlPadInput.h"
|
||||
#include "sensorData.h"
|
||||
|
||||
struct DriveModiParams {
|
||||
MoveControl* moveControl;
|
||||
const ControlPadInput* input;
|
||||
const SensorData* sensorData;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Baseclass to build DriveModi
|
||||
@@ -23,9 +31,12 @@
|
||||
*/
|
||||
class DriveModi : public Component {
|
||||
public:
|
||||
DriveModi(MoveControl* moveControl);
|
||||
DriveModi(MoveControl* moveControl, ControlPadInput* input, SensorData* sensorData);
|
||||
DriveModi(DriveModiParams);
|
||||
virtual ~DriveModi();
|
||||
|
||||
const SensorData* getSensorData() const { return this->sensorData; }
|
||||
|
||||
/**
|
||||
* @brief Set the max speed
|
||||
*
|
||||
@@ -48,8 +59,12 @@ class DriveModi : public Component {
|
||||
|
||||
protected:
|
||||
MoveControl *moveControl;
|
||||
const ControlPadInput* input;
|
||||
const SensorData* sensorData;
|
||||
double maxForwardSpeed = 1;
|
||||
double maxRotationSpeed = 7;
|
||||
|
||||
|
||||
private:
|
||||
void init();
|
||||
};
|
||||
#endif // DRIVEMODI_H
|
||||
|
||||
+8
-2
@@ -31,6 +31,7 @@
|
||||
#include "network.h"
|
||||
#include "debugMqtt.h"
|
||||
#include "battery.h"
|
||||
#include "sensorData.h"
|
||||
#include "debugTimes.h"
|
||||
#include "controlPad.h"
|
||||
|
||||
@@ -55,6 +56,7 @@ OutputBuf* outputBuf;
|
||||
DebugMqtt* debugMqtt = nullptr;
|
||||
Battery* mainBattery;
|
||||
SPIClass* spiPort;
|
||||
SensorData* sensorData;
|
||||
ControlPad* controlPad;
|
||||
|
||||
bool wifiIsActive;
|
||||
@@ -115,7 +117,10 @@ void setup() {
|
||||
std::cout << "Build timestamp: " << BUILD_TIMESTAMP << std::endl;
|
||||
std::cout << "All actions from the main program run on Core -> " << xPortGetCoreID() << std::endl;
|
||||
|
||||
driveManager = new DriveManager(&moveController, spiPort, controlPad->getControlPadDataPtr(), wifiIsActive);
|
||||
sensorData = new SensorData();
|
||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||
sensorData->enableRealCompass();
|
||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||
|
||||
outputBuf->activateMqtt(true);
|
||||
|
||||
@@ -142,6 +147,7 @@ void loop() {
|
||||
#endif //MQTT
|
||||
wifiTime.stopConsol("WiFi-Time", 10);
|
||||
}
|
||||
sensorData->loop();
|
||||
driveManager->loop();
|
||||
controlPad->loop();
|
||||
main_m->update();
|
||||
@@ -216,7 +222,7 @@ void makeMenu() {
|
||||
MenuAutopilot* auto_m = new MenuAutopilot(driveManager);
|
||||
MenuTestMode* testM_m = new MenuTestMode(driveManager);
|
||||
MenuCalibrateCompass* comp_m = new MenuCalibrateCompass(driveManager);
|
||||
MenuGPS* gps_m = new MenuGPS(driveManager);
|
||||
MenuGPS* gps_m = new MenuGPS(sensorData);
|
||||
MenuSysteminformation* sys_m = new MenuSysteminformation(mainBattery);
|
||||
MenuRoute* rout_m = new MenuRoute(driveManager->getNavigation()->getRoute());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user