quite some fixes
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define HOTSPOT
|
#define RHEDE
|
||||||
|
|
||||||
#ifdef HOTSPOT
|
#ifdef HOTSPOT
|
||||||
namespace NetworkConfig {
|
namespace NetworkConfig {
|
||||||
@@ -51,8 +51,9 @@ namespace MqttConfig {
|
|||||||
namespace NtripConfig {
|
namespace NtripConfig {
|
||||||
const char host[] = "rtk2go.com";
|
const char host[] = "rtk2go.com";
|
||||||
const uint16_t port = 2101;
|
const uint16_t port = 2101;
|
||||||
const char mountPoint[] = "GER-Dortmund";
|
// const char mountPoint[] = "GER-Dortmund";
|
||||||
// const char mountPoint[] = "GER-Papenburg";
|
// const char mountPoint[] = "GER-Papenburg";
|
||||||
|
const char mountPoint[] = "Rtkramerntrip";
|
||||||
const char user[] = "alklein1@gmx.de";
|
const char user[] = "alklein1@gmx.de";
|
||||||
const char password[] = "none";
|
const char password[] = "none";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ Network::Network(const char *ssid, const char *passphrase) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Network::Network(const char *ssid, const char *passphrase, NetworkAdresses adresses) {
|
Network::Network(const char *ssid, const char *passphrase, NetworkAdresses adresses) {
|
||||||
|
this->adresses = adresses;
|
||||||
|
|
||||||
if (!WiFi.mode(WIFI_AP_STA))
|
if (!WiFi.mode(WIFI_AP_STA))
|
||||||
std::cout << "Network::connectWiFi failed WiFi.mode" << std::endl;
|
std::cout << "Network::connectWiFi failed WiFi.mode" << std::endl;
|
||||||
|
|
||||||
@@ -81,8 +83,8 @@ void Network::printIPs() {
|
|||||||
}
|
}
|
||||||
std::cout << "WiFi is connected to" << std::endl;
|
std::cout << "WiFi is connected to" << std::endl;
|
||||||
std::cout << "IP address: " << std::endl;
|
std::cout << "IP address: " << std::endl;
|
||||||
std::cout << this->adresses.localIP << std::endl;
|
std::cout << WiFi.localIP().toString().c_str() << std::endl;
|
||||||
std::cout << "WiFi MAC Address: " << WiFi.macAddress() << std::endl << std::endl;
|
std::cout << "WiFi MAC Address: " << WiFi.macAddress().c_str() << std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Network::getCurrentChannel() {
|
uint8_t Network::getCurrentChannel() {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "sensorData.h"
|
#include "sensorData.h"
|
||||||
|
|
||||||
bool SensorData::outputStatusPrintPVTdata = false;
|
bool SensorData::outputStatusPrintPVTdata = false;
|
||||||
bool SensorData::newData = false;
|
|
||||||
uint32_t SensorData::ubxUpdateTimeStatic = 0;
|
uint32_t SensorData::ubxUpdateTimeStatic = 0;
|
||||||
UBX_NAV_PVT_data_t* SensorData::ubxDataStatic = nullptr;
|
UBX_NAV_PVT_data_t* SensorData::ubxDataStatic = nullptr;
|
||||||
|
|
||||||
@@ -161,7 +160,6 @@ void SensorData::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
|||||||
void SensorData::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
void SensorData::savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct) {
|
||||||
SensorData::printPVTdata(ubxDataStruct);
|
SensorData::printPVTdata(ubxDataStruct);
|
||||||
|
|
||||||
SensorData::newData = true;
|
|
||||||
SensorData::ubxDataStatic = ubxDataStruct;
|
SensorData::ubxDataStatic = ubxDataStruct;
|
||||||
SensorData::ubxUpdateTimeStatic = millis();
|
SensorData::ubxUpdateTimeStatic = millis();
|
||||||
}
|
}
|
||||||
@@ -189,11 +187,8 @@ void SensorData::runAsChild() {
|
|||||||
if (this->gnss) {
|
if (this->gnss) {
|
||||||
this->gnss->checkUblox();
|
this->gnss->checkUblox();
|
||||||
this->gnss->checkCallbacks();
|
this->gnss->checkCallbacks();
|
||||||
}
|
if (SensorData::ubxUpdateTimeStatic != this->lastUbxUpdate)
|
||||||
|
this->updateUbxData();
|
||||||
if (SensorData::newData) {
|
|
||||||
SensorData::newData = false;
|
|
||||||
// TODO: Update data
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,3 +205,14 @@ void SensorData::initGnss() {
|
|||||||
this->gnss->setNavigationFrequency(1);
|
this->gnss->setNavigationFrequency(1);
|
||||||
this->gnss->setAutoPVT(true);
|
this->gnss->setAutoPVT(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SensorData::updateUbxData() {
|
||||||
|
this->gnssData = SensorData::ubxDataStatic;
|
||||||
|
this->lastUbxUpdate = SensorData::ubxUpdateTimeStatic;
|
||||||
|
|
||||||
|
Point::Coordinates coords;
|
||||||
|
coords.lat = this->gnssData->lat / 10000000.0;
|
||||||
|
coords.lon = this->gnssData->lon / 10000000.0;
|
||||||
|
|
||||||
|
this->currentPosition = Point(coords, this->gnssData->hAcc);
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ class SensorData : public Component {
|
|||||||
void run() override;
|
void run() override;
|
||||||
void runAsChild() override;
|
void runAsChild() override;
|
||||||
void initGnss();
|
void initGnss();
|
||||||
|
void updateUbxData();
|
||||||
|
|
||||||
|
|
||||||
QMC5883LCompass* realCompass = nullptr;
|
QMC5883LCompass* realCompass = nullptr;
|
||||||
CalcAzimuth* calcCompass = nullptr;
|
CalcAzimuth* calcCompass = nullptr;
|
||||||
@@ -93,8 +95,9 @@ class SensorData : public Component {
|
|||||||
uint16_t port;
|
uint16_t port;
|
||||||
int16_t realAzimuth = INT16_MAX;
|
int16_t realAzimuth = INT16_MAX;
|
||||||
int16_t calcAzimuth = INT16_MAX;
|
int16_t calcAzimuth = INT16_MAX;
|
||||||
|
uint32_t lastUbxUpdate = 0;
|
||||||
|
|
||||||
float yawPitchRoll[3];
|
float yawPitchRoll[3] {0, 0, 0};
|
||||||
|
|
||||||
// static
|
// static
|
||||||
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
static void printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
||||||
@@ -103,7 +106,6 @@ class SensorData : public Component {
|
|||||||
static UBX_NAV_PVT_data_t* ubxDataStatic;
|
static UBX_NAV_PVT_data_t* ubxDataStatic;
|
||||||
static uint32_t ubxUpdateTimeStatic;
|
static uint32_t ubxUpdateTimeStatic;
|
||||||
static bool outputStatusPrintPVTdata;
|
static bool outputStatusPrintPVTdata;
|
||||||
static bool newData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //SENSOR_DATA_H
|
#endif //SENSOR_DATA_H
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
MenuSensorData::MenuSensorData(SensorData* sensorData) :
|
MenuSensorData::MenuSensorData(SensorData* sensorData) :
|
||||||
MenuInformationSites(7) {
|
MenuInformationSites(7) {
|
||||||
this->sensorData = sensorData;
|
this->sensorData = sensorData;
|
||||||
|
this->noEqualLeft = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuSensorData::printPage() const {
|
void MenuSensorData::printPage() const {
|
||||||
@@ -81,20 +82,20 @@ void MenuSensorData::printPage() const {
|
|||||||
lineTwo = "Ntrip: ";
|
lineTwo = "Ntrip: ";
|
||||||
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
||||||
if (carrSoln == 0)
|
if (carrSoln == 0)
|
||||||
lineOne = "None";
|
lineOne.concat("None");
|
||||||
else if (carrSoln == 1)
|
else if (carrSoln == 1)
|
||||||
lineOne = "Floating";
|
lineOne.concat("Floating");
|
||||||
else if (carrSoln == 2)
|
else if (carrSoln == 2)
|
||||||
lineOne = "Fixed";
|
lineOne.concat("Fixed");
|
||||||
else
|
else
|
||||||
lineOne = "UNKNOWN";
|
lineOne = "UNKNOWN";
|
||||||
NTRIPClientStates status = this->sensorData->getNtripState();
|
NTRIPClientStates status = this->sensorData->getNtripState();
|
||||||
if (status == NTRIPClientStates::pushData)
|
if (status == NTRIPClientStates::pushData)
|
||||||
lineTwo = "enabled";
|
lineTwo.concat("enabled");
|
||||||
else if (status == NTRIPClientStates::notAvailable)
|
else if (status == NTRIPClientStates::notAvailable)
|
||||||
lineTwo = " N/A";
|
lineTwo.concat(" N/A");
|
||||||
else
|
else
|
||||||
lineTwo = "disabled";
|
lineTwo.concat("disabled");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -105,8 +106,8 @@ void MenuSensorData::printPage() const {
|
|||||||
lineOne.concat(gpsData->hAcc);
|
lineOne.concat(gpsData->hAcc);
|
||||||
lineTwo.concat(gpsData->numSV);
|
lineTwo.concat(gpsData->numSV);
|
||||||
} else {
|
} else {
|
||||||
lineOne = "-/-";
|
lineOne.concat("-/-");
|
||||||
lineTwo = "-/-";
|
lineTwo.concat("-/-");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,3 @@ void MenuDriveMode::left() {
|
|||||||
this->leaved = true;
|
this->leaved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::no() {
|
|
||||||
this->left();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ class MenuDriveMode : public MenuInformationSites {
|
|||||||
*/
|
*/
|
||||||
void left() override;
|
void left() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Calls left.
|
|
||||||
*/
|
|
||||||
void no() override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void configureOnLeave() {}
|
void configureOnLeave() {}
|
||||||
|
|
||||||
|
|||||||
@@ -18,20 +18,20 @@ DirectionChangeSignal::DirectionChangeSignal(Autopilot* pilot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DirectionChangeSignal::~DirectionChangeSignal() {
|
DirectionChangeSignal::~DirectionChangeSignal() {
|
||||||
pilot->getSensorData()->getCalcCompass()->disableCalcAzimuth();
|
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||||
|
if (calcAzimuth)
|
||||||
|
calcAzimuth->disableCalcAzimuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectionChangeSignal::action() {
|
void DirectionChangeSignal::action() {
|
||||||
pilot->getSensorData()->getCalcCompass()->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||||
|
if (calcAzimuth)
|
||||||
|
calcAzimuth->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Autopilot::Autopilot() {
|
Autopilot::Autopilot() {
|
||||||
this->setInputMode(ManualControl::InputMode::Digital);
|
|
||||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
|
||||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
|
||||||
this->navigation = new Navigation(this->sensorData);
|
|
||||||
this->init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Autopilot::~Autopilot() {
|
Autopilot::~Autopilot() {
|
||||||
@@ -247,3 +247,11 @@ void Autopilot::restartLoop() {
|
|||||||
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection, true);
|
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection, true);
|
||||||
this->updateDisplay = true;
|
this->updateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Autopilot::afterActivate() {
|
||||||
|
this->setInputMode(ManualControl::InputMode::Digital);
|
||||||
|
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||||
|
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||||
|
this->navigation = new Navigation(this->sensorData);
|
||||||
|
this->init();
|
||||||
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ class Autopilot : public ManualControl {
|
|||||||
void askNavigationForOrder();
|
void askNavigationForOrder();
|
||||||
void selfDriving();
|
void selfDriving();
|
||||||
void restartLoop();
|
void restartLoop();
|
||||||
|
void afterActivate() override;
|
||||||
|
|
||||||
Navigation* navigation;
|
Navigation* navigation;
|
||||||
CourseCorrection courseCorrection;
|
CourseCorrection courseCorrection;
|
||||||
|
|||||||
@@ -10,16 +10,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||||
|
#include "captureRoute.h"
|
||||||
CaptureRoute::CaptureRoute() {
|
|
||||||
this->navigation = new Navigation(this->sensorData);
|
|
||||||
this->navigation->getRoute()->clear();
|
|
||||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
|
||||||
this->routeInfo = navigation->getRouteInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
CaptureRoute::~CaptureRoute() {
|
CaptureRoute::~CaptureRoute() {
|
||||||
// this->navigation->getNTRIPClient()->setActivated(false);
|
if (this->navigation)
|
||||||
|
delete this->navigation;
|
||||||
|
|
||||||
|
if (this->sensorData->getNtripClient())
|
||||||
|
this->sensorData->getNtripClient()->setActivated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureRoute::run() {
|
void CaptureRoute::run() {
|
||||||
@@ -34,6 +32,13 @@ void CaptureRoute::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CaptureRoute::afterActivate() {
|
||||||
|
this->navigation = new Navigation(this->sensorData);
|
||||||
|
this->navigation->getRoute()->clear();
|
||||||
|
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||||
|
this->routeInfo = navigation->getRouteInfo();
|
||||||
|
}
|
||||||
|
|
||||||
double CaptureRoute::getDistanceToLastPoint() const {
|
double CaptureRoute::getDistanceToLastPoint() const {
|
||||||
if (!this->lastSavedPoint.isInit())
|
if (!this->lastSavedPoint.isInit())
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -27,8 +27,6 @@
|
|||||||
*/
|
*/
|
||||||
class CaptureRoute : public ManualControl {
|
class CaptureRoute : public ManualControl {
|
||||||
public:
|
public:
|
||||||
CaptureRoute();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the Capture Route object
|
* @brief Destroy the Capture Route object
|
||||||
*
|
*
|
||||||
@@ -68,8 +66,9 @@ class CaptureRoute : public ManualControl {
|
|||||||
bool shouldUpdate();
|
bool shouldUpdate();
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
|
void afterActivate() override;
|
||||||
|
|
||||||
Navigation* navigation;
|
Navigation* navigation = nullptr;
|
||||||
RouteInfo routeInfo;
|
RouteInfo routeInfo;
|
||||||
Point lastSavedPoint;
|
Point lastSavedPoint;
|
||||||
Navigation::Status status = Navigation::Status::Complete;
|
Navigation::Status status = Navigation::Status::Complete;
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ void DriveModi::activate(DriveModiParams params){
|
|||||||
void DriveModi::init() {
|
void DriveModi::init() {
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||||
this->loopDelay = 40;
|
this->loopDelay = 40;
|
||||||
|
this->afterActivate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ class DriveModi : public Component {
|
|||||||
double getMaxRotation() const { return this->maxRotationSpeed; }
|
double getMaxRotation() const { return this->maxRotationSpeed; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void afterActivate() {}
|
||||||
|
|
||||||
MoveControl *moveControl;
|
MoveControl *moveControl;
|
||||||
const ControlPadInput* input;
|
const ControlPadInput* input;
|
||||||
const SensorData* sensorData;
|
const SensorData* sensorData;
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ void setup() {
|
|||||||
sensorData = new SensorData();
|
sensorData = new SensorData();
|
||||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||||
sensorData->enableRealCompass();
|
sensorData->enableRealCompass();
|
||||||
|
sensorData->enableNtrip(NtripConfig::host, NtripConfig::port, NtripConfig::mountPoint, NtripConfig::user, NtripConfig::password);
|
||||||
// sensorData->enableGyroskop();
|
// sensorData->enableGyroskop();
|
||||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user