fix merge bugs
This commit is contained in:
Vendored
+1
@@ -150,6 +150,7 @@
|
|||||||
"Punica",
|
"Punica",
|
||||||
"RHEDE",
|
"RHEDE",
|
||||||
"Rtcm",
|
"Rtcm",
|
||||||
|
"Sats",
|
||||||
"Schalke",
|
"Schalke",
|
||||||
"Soln",
|
"Soln",
|
||||||
"Systeminformation",
|
"Systeminformation",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ void Component::loop()
|
|||||||
(*it)->loop();
|
(*it)->loop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->runAsChild();F
|
this->runAsChild();
|
||||||
|
|
||||||
if (this->onlyChilds)
|
if (this->onlyChilds)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,46 +68,6 @@ void SensorData::enableCalcCompass()
|
|||||||
// TODO: !!! implementieren
|
// TODO: !!! implementieren
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorData::enableGyroscope()
|
|
||||||
{
|
|
||||||
this->gyroscope = new MPU6050();
|
|
||||||
this->gyroscope->initialize();
|
|
||||||
if (!this->gyroscope->testConnection())
|
|
||||||
{
|
|
||||||
std::cout << "SensorData::enableGyroscope: Gyroskop is not conntected. Freeze!" << std::endl;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t deviceStatus = this->gyroscope->dmpInitialize();
|
|
||||||
|
|
||||||
// TODO: !!! MagicNumer 6x
|
|
||||||
this->gyroscope->setXGyroOffset(220);
|
|
||||||
this->gyroscope->setYGyroOffset(76);
|
|
||||||
this->gyroscope->setZGyroOffset(-85);
|
|
||||||
this->gyroscope->setZAccelOffset(1788);
|
|
||||||
|
|
||||||
if (deviceStatus == 0)
|
|
||||||
{
|
|
||||||
this->gyroscope->CalibrateAccel(6);
|
|
||||||
this->gyroscope->CalibrateGyro(6);
|
|
||||||
this->gyroscope->PrintActiveOffsets();
|
|
||||||
this->gyroscope->setDMPEnabled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// ERROR!
|
|
||||||
// 1 = initial memory load failed
|
|
||||||
// 2 = DMP configuration updates failed
|
|
||||||
// (if it's going to break, usually the code will be 1)
|
|
||||||
std::cout << "SensorData::enableGyroscope: DMP Initialization failed (code" << static_cast<int>(deviceStatus) << "). Freeze!" << std::endl;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CalcAzimuth::State SensorData::getCalcAzimuthState() const
|
CalcAzimuth::State SensorData::getCalcAzimuthState() const
|
||||||
{
|
{
|
||||||
if (static_cast<bool>(this->calcCompass))
|
if (static_cast<bool>(this->calcCompass))
|
||||||
@@ -117,15 +77,6 @@ CalcAzimuth::State SensorData::getCalcAzimuthState() const
|
|||||||
return CalcAzimuth::State::Invalid;
|
return CalcAzimuth::State::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTRIPClientStates SensorData::getNtripState() const
|
|
||||||
{
|
|
||||||
if (static_cast<bool>(this->ntripClient))
|
|
||||||
{
|
|
||||||
return this->ntripClient->getClientState();
|
|
||||||
}
|
|
||||||
return NTRIPClientStates::notAvailable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SensorData::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
|
void SensorData::printPVTdata(UBX_NAV_PVT_data_t *ubxDataStruct)
|
||||||
{
|
{
|
||||||
static constexpr uint8_t stringSize = 32;
|
static constexpr uint8_t stringSize = 32;
|
||||||
@@ -220,13 +171,6 @@ void SensorData::run()
|
|||||||
this->realCompass->read();
|
this->realCompass->read();
|
||||||
this->realAzimuth = this->realCompass->getAzimuth();
|
this->realAzimuth = this->realCompass->getAzimuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (static_cast<bool>(this->gyroscope) && this->gyroscope->dmpGetCurrentFIFOPacket(static_cast<uint8_t *>(this->gyroBuffer)))
|
|
||||||
{
|
|
||||||
this->gyroscope->dmpGetQuaternion(&this->quaternion, static_cast<uint8_t *>(this->gyroBuffer));
|
|
||||||
this->gyroscope->dmpGetGravity(&this->gravity, &this->quaternion);
|
|
||||||
this->gyroscope->dmpGetYawPitchRoll(static_cast<float *>(this->yawPitchRoll), &this->quaternion, &this->gravity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SensorData::runAsChild()
|
void SensorData::runAsChild()
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||||
#include <QMC5883LCompass.h>
|
#include <QMC5883LCompass.h>
|
||||||
#include <MPU6050_6Axis_MotionApps20.h>
|
|
||||||
#include "calcAzimuth.h"
|
#include "calcAzimuth.h"
|
||||||
|
|
||||||
#include "point.h"
|
#include "point.h"
|
||||||
@@ -37,8 +36,6 @@ public:
|
|||||||
SensorData();
|
SensorData();
|
||||||
~SensorData();
|
~SensorData();
|
||||||
|
|
||||||
void enableNtrip(String host, uint16_t port, String mountPoint, String user, String password);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable the gnss module over spi
|
* @brief Enable the gnss module over spi
|
||||||
*
|
*
|
||||||
@@ -54,7 +51,6 @@ public:
|
|||||||
|
|
||||||
void enableRealCompass();
|
void enableRealCompass();
|
||||||
void enableCalcCompass();
|
void enableCalcCompass();
|
||||||
void enableGyroscope();
|
|
||||||
|
|
||||||
// Interface Const
|
// Interface Const
|
||||||
/**
|
/**
|
||||||
@@ -84,19 +80,6 @@ public:
|
|||||||
|
|
||||||
Point getCurrentPos() const { return this->currentPosition; }
|
Point getCurrentPos() const { return this->currentPosition; }
|
||||||
const UBX_NAV_PVT_data_t *getGnssData() const { return this->gnssData; };
|
const UBX_NAV_PVT_data_t *getGnssData() const { return this->gnssData; };
|
||||||
NTRIPClientStates getNtripState() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the data from the gyroscope
|
|
||||||
*
|
|
||||||
* The returned float pointer is an array of 3 floats
|
|
||||||
* - Yaw
|
|
||||||
* - Pitch
|
|
||||||
* - Roll
|
|
||||||
*
|
|
||||||
* @return const float*
|
|
||||||
*/
|
|
||||||
const float *getGyroData() const { return this->yawPitchRoll; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the CalcCompass object
|
* @brief Get the CalcCompass object
|
||||||
@@ -110,18 +93,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
QMC5883LCompass *getRealCompass() const { return this->realCompass; }
|
QMC5883LCompass *getRealCompass() const { return this->realCompass; }
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the NTRIPClient object
|
|
||||||
* @return NTRIPClient*
|
|
||||||
*/
|
|
||||||
NTRIPClient *getNtripClient() const { return this->ntripClient; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get the Gyroscope object
|
|
||||||
* @return MPU6050*
|
|
||||||
*/
|
|
||||||
MPU6050 *getGyroscope() const { return this->gyroscope; }
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
/**
|
/**
|
||||||
* @brief Set the output status for PVTdata.
|
* @brief Set the output status for PVTdata.
|
||||||
@@ -142,29 +113,14 @@ private:
|
|||||||
QMC5883LCompass *realCompass = nullptr;
|
QMC5883LCompass *realCompass = nullptr;
|
||||||
CalcAzimuth *calcCompass = nullptr;
|
CalcAzimuth *calcCompass = nullptr;
|
||||||
SFE_UBLOX_GNSS *gnss = nullptr;
|
SFE_UBLOX_GNSS *gnss = nullptr;
|
||||||
NTRIPClient *ntripClient = nullptr;
|
|
||||||
MPU6050 *gyroscope = nullptr;
|
|
||||||
|
|
||||||
UBX_NAV_PVT_data_t *gnssData = nullptr;
|
UBX_NAV_PVT_data_t *gnssData = nullptr;
|
||||||
Point currentPosition;
|
Point currentPosition;
|
||||||
Quaternion quaternion;
|
|
||||||
VectorFloat gravity;
|
|
||||||
|
|
||||||
char *host = nullptr;
|
|
||||||
char *mountPoint = nullptr;
|
|
||||||
char *user = nullptr;
|
|
||||||
char *password = nullptr;
|
|
||||||
|
|
||||||
bool isNtripInit = false;
|
|
||||||
|
|
||||||
uint8_t gyroBuffer[64];
|
|
||||||
uint16_t port = 0;
|
|
||||||
int16_t realAzimuth = INT16_MAX;
|
int16_t realAzimuth = INT16_MAX;
|
||||||
int16_t calcAzimuth = INT16_MAX;
|
int16_t calcAzimuth = INT16_MAX;
|
||||||
uint32_t lastUbxUpdate = 0;
|
uint32_t lastUbxUpdate = 0;
|
||||||
|
|
||||||
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);
|
||||||
static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
static void savePVTdata(UBX_NAV_PVT_data_t *ubxDataStruct);
|
||||||
|
|||||||
@@ -30,15 +30,6 @@ void MenuSensorData::printPage() const
|
|||||||
|
|
||||||
switch (this->getCurrentPage())
|
switch (this->getCurrentPage())
|
||||||
{
|
{
|
||||||
case 0:
|
|
||||||
lineOne = " Y P R :";
|
|
||||||
lineTwo.concat(this->sensorData->getGyroData()[0]);
|
|
||||||
lineTwo.concat(" ");
|
|
||||||
lineTwo.concat(this->sensorData->getGyroData()[1]);
|
|
||||||
lineTwo.concat(" ");
|
|
||||||
lineTwo.concat(this->sensorData->getGyroData()[2]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
lineOne = "Real Azimuth:";
|
lineOne = "Real Azimuth:";
|
||||||
lineTwo.concat(this->sensorData->getRealAzimuth());
|
lineTwo.concat(this->sensorData->getRealAzimuth());
|
||||||
@@ -91,43 +82,6 @@ void MenuSensorData::printPage() const
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
|
||||||
{
|
|
||||||
lineOne = "CarSol: ";
|
|
||||||
lineTwo = "Ntrip: ";
|
|
||||||
const uint8_t carrSoln = gpsData->flags.bits.carrSoln;
|
|
||||||
if (carrSoln == 0)
|
|
||||||
{
|
|
||||||
lineOne.concat("None");
|
|
||||||
}
|
|
||||||
else if (carrSoln == 1)
|
|
||||||
{
|
|
||||||
lineOne.concat("Floating");
|
|
||||||
}
|
|
||||||
else if (carrSoln == 2)
|
|
||||||
{
|
|
||||||
lineOne.concat("Fixed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineOne = "UNKNOWN";
|
|
||||||
}
|
|
||||||
const NTRIPClientStates status = this->sensorData->getNtripState();
|
|
||||||
if (status == NTRIPClientStates::pushData)
|
|
||||||
{
|
|
||||||
lineTwo.concat("enabled");
|
|
||||||
}
|
|
||||||
else if (status == NTRIPClientStates::notAvailable)
|
|
||||||
{
|
|
||||||
lineTwo.concat(" N/A");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineTwo.concat("disabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
lineOne = "HAcc: ";
|
lineOne = "HAcc: ";
|
||||||
lineTwo = "Sats: ";
|
lineTwo = "Sats: ";
|
||||||
|
|||||||
+11
-24
@@ -43,7 +43,6 @@
|
|||||||
#include "SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.h"
|
#include "SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.h"
|
||||||
#include "SpecialMenus/Systeminformation/menuSysteminformation.h"
|
#include "SpecialMenus/Systeminformation/menuSysteminformation.h"
|
||||||
#include "SpecialMenus/PID/menuPidSettings.h"
|
#include "SpecialMenus/PID/menuPidSettings.h"
|
||||||
#include "SpecialMenus/Route/menuRoute.h"
|
|
||||||
#include "SpecialMenus/SensorData/menuSensorData.h"
|
#include "SpecialMenus/SensorData/menuSensorData.h"
|
||||||
#include "SpecialMenus/CalibrateBattery/menuCalibrateBattery.h"
|
#include "SpecialMenus/CalibrateBattery/menuCalibrateBattery.h"
|
||||||
|
|
||||||
@@ -123,12 +122,6 @@ void setup()
|
|||||||
sensorData = new SensorData();
|
sensorData = new SensorData();
|
||||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||||
sensorData->enableRealCompass();
|
sensorData->enableRealCompass();
|
||||||
sensorData->enableNtrip(static_cast<const char *>(NtripConfig::host),
|
|
||||||
NtripConfig::port,
|
|
||||||
static_cast<const char *>(NtripConfig::mountPoint),
|
|
||||||
static_cast<const char *>(NtripConfig::user),
|
|
||||||
static_cast<const char *>(NtripConfig::password));
|
|
||||||
// sensorData->enableGyroscope();
|
|
||||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||||
|
|
||||||
char wifiIndicator = 'X';
|
char wifiIndicator = 'X';
|
||||||
@@ -158,7 +151,7 @@ void loop()
|
|||||||
lcdWrapper->loop();
|
lcdWrapper->loop();
|
||||||
mainBattery->loop();
|
mainBattery->loop();
|
||||||
|
|
||||||
// new Value ervery 0.5s
|
// new Value every 0.5s
|
||||||
if (mainBattery->isNewValue())
|
if (mainBattery->isNewValue())
|
||||||
{
|
{
|
||||||
static uint8_t batteryLowCounter = 0;
|
static uint8_t batteryLowCounter = 0;
|
||||||
@@ -191,14 +184,14 @@ void loop()
|
|||||||
void i2cScanner()
|
void i2cScanner()
|
||||||
{
|
{
|
||||||
constexpr uint8_t checkForLength = 16;
|
constexpr uint8_t checkForLength = 16;
|
||||||
constexpr uint8_t maxAdresses = UINT8_MAX / 2;
|
constexpr uint8_t maxAddresses = UINT8_MAX / 2;
|
||||||
std::cout << "\nI2C Scanner" << std::endl;
|
std::cout << "\nI2C Scanner" << std::endl;
|
||||||
|
|
||||||
byte error = 0;
|
byte error = 0;
|
||||||
byte address = 0;
|
byte address = 0;
|
||||||
int nDevices = 0;
|
int nDevices = 0;
|
||||||
std::cout << "Scanning..." << std::endl;
|
std::cout << "Scanning..." << std::endl;
|
||||||
for (address = 1; address < maxAdresses; address++)
|
for (address = 1; address < maxAddresses; address++)
|
||||||
{
|
{
|
||||||
Wire.beginTransmission(address);
|
Wire.beginTransmission(address);
|
||||||
error = Wire.endTransmission();
|
error = Wire.endTransmission();
|
||||||
@@ -252,24 +245,18 @@ void makeMenu()
|
|||||||
auto *pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
auto *pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
||||||
auto *speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
auto *speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
||||||
auto *man_m = new MenuManualControl(driveManager);
|
auto *man_m = new MenuManualControl(driveManager);
|
||||||
auto *cap_m = new MenuCaptureRoute(driveManager);
|
|
||||||
auto *auto_m = new MenuAutopilot(driveManager);
|
|
||||||
auto *testM_m = new MenuTestMode(driveManager);
|
auto *testM_m = new MenuTestMode(driveManager);
|
||||||
auto *comp_m = new MenuCalibrateCompass(driveManager);
|
auto *comp_m = new MenuCalibrateCompass(driveManager);
|
||||||
auto *sys_m = new MenuSysteminformation(mainBattery);
|
auto *sys_m = new MenuSysteminformation(mainBattery);
|
||||||
auto *sen_m = new MenuSensorData(sensorData);
|
auto *sen_m = new MenuSensorData(sensorData);
|
||||||
// TODO: Wie bekommt jeder die dumme Route?
|
|
||||||
auto *rout_m = new MenuRoute(new Route());
|
|
||||||
auto *bat_m = new MenuCalibrateBattery(mainBattery);
|
auto *bat_m = new MenuCalibrateBattery(mainBattery);
|
||||||
|
|
||||||
auto_m->setUpdateDelay(displayUpdateDelay);
|
|
||||||
sys_m->setUpdateDelay(displayUpdateDelay);
|
sys_m->setUpdateDelay(displayUpdateDelay);
|
||||||
sen_m->setUpdateDelay(displayUpdateDelay);
|
sen_m->setUpdateDelay(displayUpdateDelay);
|
||||||
|
|
||||||
// Entry for the main menu
|
// Entry for the main menu
|
||||||
main_m->addEntry(new MenuAction("Mode", mode_m));
|
main_m->addEntry(new MenuAction("Mode", mode_m));
|
||||||
main_m->addEntry(new MenuAction("Sensor", sen_m));
|
main_m->addEntry(new MenuAction("Sensor", sen_m));
|
||||||
main_m->addEntry(new MenuAction("Route", rout_m));
|
|
||||||
main_m->addEntry(new MenuAction("Settings", set_m));
|
main_m->addEntry(new MenuAction("Settings", set_m));
|
||||||
main_m->addEntry(new MenuAction("Systeminfo", sys_m));
|
main_m->addEntry(new MenuAction("Systeminfo", sys_m));
|
||||||
main_m->addEntry(new MenuAction("Restart", restart));
|
main_m->addEntry(new MenuAction("Restart", restart));
|
||||||
@@ -353,16 +340,16 @@ void lcdWrapperCallback(const char data[][LcdWrapper::totalRows], uint8_t lines,
|
|||||||
|
|
||||||
NetworkAddresses setIPs()
|
NetworkAddresses setIPs()
|
||||||
{
|
{
|
||||||
NetworkAddresses adresses;
|
NetworkAddresses addresses;
|
||||||
adresses.localIP.fromString(static_cast<const char *>(NetworkConfig::ip));
|
addresses.localIP.fromString(static_cast<const char *>(NetworkConfig::ip));
|
||||||
adresses.subnet.fromString(static_cast<const char *>(NetworkConfig::subnet));
|
addresses.subnet.fromString(static_cast<const char *>(NetworkConfig::subnet));
|
||||||
adresses.gateway.fromString(static_cast<const char *>(NetworkConfig::gateway));
|
addresses.gateway.fromString(static_cast<const char *>(NetworkConfig::gateway));
|
||||||
adresses.dnsServer.fromString(static_cast<const char *>(NetworkConfig::dns));
|
addresses.dnsServer.fromString(static_cast<const char *>(NetworkConfig::dns));
|
||||||
if (NetworkConfig::mqtt)
|
if (NetworkConfig::mqtt)
|
||||||
{
|
{
|
||||||
adresses.mqttServer.fromString(static_cast<const char *>(MqttConfig::server));
|
addresses.mqttServer.fromString(static_cast<const char *>(MqttConfig::server));
|
||||||
adresses.mqttPort = MqttConfig::port;
|
addresses.mqttPort = MqttConfig::port;
|
||||||
}
|
}
|
||||||
|
|
||||||
return adresses;
|
return addresses;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user