Merge branch 'main' of git.kleiax.de:kleiax/Projektarbeit-Rover
This commit is contained in:
+1
-2
@@ -3,11 +3,10 @@
|
|||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/ipch
|
.vscode/ipch
|
||||||
|
rover-cppcheck-build-dir
|
||||||
|
|
||||||
doc/Doxygen/html*
|
doc/Doxygen/html*
|
||||||
doc/Doxygen/generated*
|
doc/Doxygen/generated*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
workspace.code-workspace
|
workspace.code-workspace
|
||||||
projektarbeit.code-workspace
|
projektarbeit.code-workspace
|
||||||
|
|||||||
+6
-17
@@ -6,7 +6,6 @@ Do later:
|
|||||||
-> Program underfloorLighting
|
-> Program underfloorLighting
|
||||||
-> Add an beeper
|
-> Add an beeper
|
||||||
-> Program the beeper
|
-> Program the beeper
|
||||||
-> Update GNSS Lib to v3
|
|
||||||
-> Engine slow down without curve in motorControl
|
-> Engine slow down without curve in motorControl
|
||||||
-> Network clean up (Mqtt remove?)
|
-> Network clean up (Mqtt remove?)
|
||||||
-> Extra class for maneuver, autopilot should inherit from int16_t
|
-> Extra class for maneuver, autopilot should inherit from int16_t
|
||||||
@@ -19,16 +18,7 @@ Do later:
|
|||||||
-> Menu Display from parent as run() to make Menu as Component
|
-> Menu Display from parent as run() to make Menu as Component
|
||||||
-> Racing Mode
|
-> Racing Mode
|
||||||
-> ConsolControl
|
-> ConsolControl
|
||||||
-> Menü für Sensordaten (kann in jedem Betriebsmodus aufgerufen werden)
|
|
||||||
- GNSS
|
|
||||||
- Ntrip
|
|
||||||
- CalcCompass
|
|
||||||
- RealCompass
|
|
||||||
- Gyroskop
|
|
||||||
- Geschwindigkeiten (vielleicht)
|
|
||||||
-> Menü für Einstellungen
|
-> Menü für Einstellungen
|
||||||
- PID
|
|
||||||
- Geschwindigkeiten
|
|
||||||
- WiFi (save in Flash)
|
- WiFi (save in Flash)
|
||||||
-> Battery
|
-> Battery
|
||||||
- tabelle mit eigenen Werten übergeben und nicht in header (wiederverwendbarkeit)
|
- tabelle mit eigenen Werten übergeben und nicht in header (wiederverwendbarkeit)
|
||||||
@@ -37,21 +27,20 @@ Do later:
|
|||||||
-> Check speration between Ui and Route (RouteMenu)
|
-> Check speration between Ui and Route (RouteMenu)
|
||||||
-> update sparkfun gnss auf v3 für SPI korrekturdatenüvbetragung
|
-> update sparkfun gnss auf v3 für SPI korrekturdatenüvbetragung
|
||||||
-> Rover Objekt mit Error zustand freeze, damit das wenn möglich auch auf dem Display angezeigt wird.
|
-> Rover Objekt mit Error zustand freeze, damit das wenn möglich auch auf dem Display angezeigt wird.
|
||||||
|
-> ESP und Sensoren in den DeepSleep für Auschalten oder Akkuschutz
|
||||||
|
|
||||||
|
|
||||||
Do now:
|
Do now:
|
||||||
Code:
|
Code:
|
||||||
Doxygen Kommentare aktualisieren
|
Doxygen Kommentare aktualisieren
|
||||||
esp und sensoren in den deepsleep
|
|
||||||
magic numbers etc
|
magic numbers etc
|
||||||
|
Fernbedienung!
|
||||||
|
|
||||||
Latex:
|
Latex:
|
||||||
Anhang: Liste mit allen Komponenten und Kurzbeschreibung
|
Anhang: Liste mit allen Komponenten und Kurzbeschreibung
|
||||||
Unterschied funktionale und nicht funktionale Anforderungen
|
Unterschied funktionale und nicht funktionale Anforderungen
|
||||||
Strom nicht über Zeit sondern Rampe
|
Overfull H-Boxen
|
||||||
Formel für Zeit anfahrrampe Einheiten
|
Test Motor, Zeiten kontrolieren. Wenn einfach so dann bezug auf fehler bei Timing und freeRtos
|
||||||
Überall den Durchmesser der Räder auf 12cm und Pulse auf 384 / 3 = 128
|
Was mit den nicht erfüllten Anforderungen machen?
|
||||||
|
Hardware doppelt erklärt
|
||||||
|
|
||||||
3D:
|
|
||||||
|
|
||||||
Rover:
|
|
||||||
|
|||||||
+6
-5
@@ -30,23 +30,24 @@ namespace PinNumbers {
|
|||||||
constexpr uint8_t dir2 = 23;
|
constexpr uint8_t dir2 = 23;
|
||||||
constexpr uint8_t pwm = 22;
|
constexpr uint8_t pwm = 22;
|
||||||
constexpr uint8_t encoder = 33;
|
constexpr uint8_t encoder = 33;
|
||||||
constexpr uint8_t pmwChannel = 0;
|
constexpr uint8_t pmwChannel = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
constexpr float wheelDiameter = 0.1263;
|
constexpr float wheelDiameter = 0.105;
|
||||||
constexpr uint16_t encoderSteps = 360;
|
constexpr float wheelDistance = 0.255;
|
||||||
|
constexpr uint16_t encoderSteps = 384;
|
||||||
|
|
||||||
namespace Pid {
|
namespace Pid {
|
||||||
namespace Left {
|
namespace Left {
|
||||||
constexpr uint8_t P = 75;
|
constexpr uint8_t P = 5;
|
||||||
constexpr uint8_t I = 0;
|
constexpr uint8_t I = 0;
|
||||||
constexpr uint8_t D = 0;
|
constexpr uint8_t D = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Right {
|
namespace Right {
|
||||||
constexpr uint8_t P = 75;
|
constexpr uint8_t P = 5;
|
||||||
constexpr uint8_t I = 0;
|
constexpr uint8_t I = 0;
|
||||||
constexpr uint8_t D = 0;
|
constexpr uint8_t D = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-1
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define HOTSPOT
|
#define HW1
|
||||||
|
|
||||||
#ifdef HOTSPOT
|
#ifdef HOTSPOT
|
||||||
namespace NetworkConfig {
|
namespace NetworkConfig {
|
||||||
@@ -28,6 +28,18 @@ namespace NetworkConfig {
|
|||||||
}
|
}
|
||||||
#endif //HOTSPOT
|
#endif //HOTSPOT
|
||||||
|
|
||||||
|
#ifdef HW1
|
||||||
|
namespace NetworkConfig {
|
||||||
|
const char ssid[] = "hw1_gast";
|
||||||
|
const char password[] = "KeineAhnung";
|
||||||
|
const char ip[] = "192.168.0.4";
|
||||||
|
const char subnet[] = "255.255.255.0";
|
||||||
|
const char gateway[] = "192.168.0.1";
|
||||||
|
const char dns[] = "8.8.8.8";
|
||||||
|
const bool mqtt = false;
|
||||||
|
}
|
||||||
|
#endif //HW1
|
||||||
|
|
||||||
//Network config Rhede
|
//Network config Rhede
|
||||||
#ifdef RHEDE
|
#ifdef RHEDE
|
||||||
namespace NetworkConfig {
|
namespace NetworkConfig {
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ Speedometer::Speedometer(uint8_t pin, double diameter, uint16_t steps) {
|
|||||||
this->steps = steps;
|
this->steps = steps;
|
||||||
|
|
||||||
this->pulseCounter = new Counter(pin);
|
this->pulseCounter = new Counter(pin);
|
||||||
this->pulseCounter->setFilterValue(1000); // ignore pulses less than 1000 x 2.5ns
|
this->pulseCounter->setFilterValue(1023); // ignore pulses less than 1000 x 2.5ns
|
||||||
|
|
||||||
this->pulseCounter->clear();
|
this->pulseCounter->clear();
|
||||||
this->pulseCounter->resume();
|
this->pulseCounter->resume();
|
||||||
|
|
||||||
Component::loopDelay = Speedometer::loopDelay;
|
Component::loopDelay = Speedometer::loopDelay;
|
||||||
|
|
||||||
clearAvgBuf();
|
this->clearAvgBuf();
|
||||||
}
|
}
|
||||||
|
|
||||||
Speedometer::~Speedometer() {
|
Speedometer::~Speedometer() {
|
||||||
@@ -47,18 +47,27 @@ void Speedometer::run() {
|
|||||||
double n = (double)pulse / this->steps; // Wheel revolutions in absolute time
|
double n = (double)pulse / this->steps; // Wheel revolutions in absolute time
|
||||||
double u = n / ((double)elapsedTime / 1000); // Wheel revolutions per second
|
double u = n / ((double)elapsedTime / 1000); // Wheel revolutions per second
|
||||||
double ms = u * (diameter * PI); // Speed in m/s
|
double ms = u * (diameter * PI); // Speed in m/s
|
||||||
|
double rad = u * 2 * PI;
|
||||||
|
|
||||||
|
if (speed < 0.1) {
|
||||||
|
speed = 0;
|
||||||
|
rad = 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (this->currentDirection) {
|
switch (this->currentDirection) {
|
||||||
case Direction::Forward :
|
case Direction::Forward :
|
||||||
this->speed = ms;
|
this->speed = ms;
|
||||||
|
this->rad = rad;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Direction::Backward :
|
case Direction::Backward :
|
||||||
this->speed = -ms;
|
this->speed = -ms;
|
||||||
|
this->rad = -rad;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Direction::None :
|
case Direction::None :
|
||||||
this->speed = 0;
|
this->speed = 0;
|
||||||
|
this->rad = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,13 +59,6 @@ class Speedometer : public Component {
|
|||||||
*/
|
*/
|
||||||
void setDirection(Direction dir);
|
void setDirection(Direction dir);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Set the number of last values to be taken into account for the average.
|
|
||||||
*
|
|
||||||
* @param val length of the array
|
|
||||||
*/
|
|
||||||
void setNumOfValForAvg(uint8_t val);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the Enc Filter to prevent bouncing
|
* @brief Set the Enc Filter to prevent bouncing
|
||||||
*
|
*
|
||||||
@@ -88,6 +81,7 @@ class Speedometer : public Component {
|
|||||||
* @return double speed in m/s
|
* @return double speed in m/s
|
||||||
*/
|
*/
|
||||||
double getSpeed() const { return this->speed; }
|
double getSpeed() const { return this->speed; }
|
||||||
|
double getSpeedRad() const { return this->rad; };
|
||||||
double getAvgSpeed() const;
|
double getAvgSpeed() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,7 +105,6 @@ class Speedometer : public Component {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
void init(uint8_t pin, double diameter, uint16_t steps);
|
|
||||||
void clearAvgBuf();
|
void clearAvgBuf();
|
||||||
void addValToBuf(int16_t val);
|
void addValToBuf(int16_t val);
|
||||||
int16_t calcAverage() const;
|
int16_t calcAverage() const;
|
||||||
@@ -126,6 +119,7 @@ class Speedometer : public Component {
|
|||||||
bool calibrationRunning = false;
|
bool calibrationRunning = false;
|
||||||
|
|
||||||
double speed = 0;
|
double speed = 0;
|
||||||
|
double rad = 0;
|
||||||
double diameter;
|
double diameter;
|
||||||
|
|
||||||
uint8_t printCounter = 0;
|
uint8_t printCounter = 0;
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ lib_deps =
|
|||||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||||
bblanchon/ArduinoJson@^6.20.0
|
bblanchon/ArduinoJson@^6.20.0
|
||||||
mprograms/QMC5883LCompass@^1.2.0
|
mprograms/QMC5883LCompass@^1.2.0
|
||||||
https://git.kleiax.de/PlatformIO-Libs/Menu.git
|
|
||||||
nrf24/RF24@^1.4.5
|
|
||||||
jrowberg/I2Cdevlib-MPU6050@^1.0.0
|
jrowberg/I2Cdevlib-MPU6050@^1.0.0
|
||||||
; upload_port = COM6
|
; upload_port = COM6
|
||||||
test_ignore = test_desktop
|
test_ignore = test_desktop
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="1">
|
||||||
|
<builddir>rover-cppcheck-build-dir</builddir>
|
||||||
|
<analyze-all-vs-configs>false</analyze-all-vs-configs>
|
||||||
|
<check-headers>true</check-headers>
|
||||||
|
<check-unused-templates>true</check-unused-templates>
|
||||||
|
<max-ctu-depth>2</max-ctu-depth>
|
||||||
|
<max-template-recursion>100</max-template-recursion>
|
||||||
|
<paths>
|
||||||
|
<dir name="src"/>
|
||||||
|
<dir name="lib"/>
|
||||||
|
<dir name="include"/>
|
||||||
|
<dir name=".pio/libdeps/embedded/Menu"/>
|
||||||
|
</paths>
|
||||||
|
<project-name>rover</project-name>
|
||||||
|
</project>
|
||||||
@@ -17,7 +17,7 @@ void TestMode::run() {
|
|||||||
this->abort = true;
|
this->abort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (millis() - this->actionStart > this->maneuverTime || this->abort) {
|
if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort) {
|
||||||
this->busy = false;
|
this->busy = false;
|
||||||
this->abort = false;
|
this->abort = false;
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||||
@@ -83,6 +83,7 @@ bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
|||||||
if (this->engineInit(powerPercentage, seconds)) {
|
if (this->engineInit(powerPercentage, seconds)) {
|
||||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||||
this->maneuver = Maneuver::LeftEngine;
|
this->maneuver = Maneuver::LeftEngine;
|
||||||
|
std::cout << "TestMode::leftEngine" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -112,7 +113,7 @@ void TestMode::abortManeuver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TestMode::getRemainingManeuverTime() const {
|
uint8_t TestMode::getRemainingManeuverTime() const {
|
||||||
if (busy)
|
if (this->busy)
|
||||||
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ uint8_t TestMode::getRemainingManeuverTime() const {
|
|||||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
||||||
if (this->busy)
|
if (this->busy)
|
||||||
return false;
|
return false;
|
||||||
if (powerPercentage >= 100 || powerPercentage <= -100)
|
if (powerPercentage > 100 || powerPercentage < -100)
|
||||||
return false;
|
return false;
|
||||||
if (seconds < 0)
|
if (seconds < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "moveControl.h"
|
#include "moveControl.h"
|
||||||
#include "navigation.h"
|
|
||||||
#include "driveModi/driveModi.h"
|
#include "driveModi/driveModi.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +96,6 @@ class TestMode : public DriveModi {
|
|||||||
void run() override;
|
void run() override;
|
||||||
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
||||||
|
|
||||||
Navigation* navigation;
|
|
||||||
Maneuver maneuver = Maneuver::None;
|
Maneuver maneuver = Maneuver::None;
|
||||||
int16_t maneuverValueOne = 0;
|
int16_t maneuverValueOne = 0;
|
||||||
int16_t maneuverValueTwo = 0;
|
int16_t maneuverValueTwo = 0;
|
||||||
|
|||||||
+13
-9
@@ -44,7 +44,7 @@ MoveControl::MoveControl() {
|
|||||||
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
||||||
|
|
||||||
this->addChildComponent(this->left_motor);
|
this->addChildComponent(this->left_motor);
|
||||||
this->addChildComponent(this->right_motor);
|
this->addChildComponent(this->right_motor);
|
||||||
this->addChildComponent(this->left_speedometer);
|
this->addChildComponent(this->left_speedometer);
|
||||||
this->addChildComponent(this->right_speedometer);
|
this->addChildComponent(this->right_speedometer);
|
||||||
}
|
}
|
||||||
@@ -80,11 +80,15 @@ void MoveControl::setDrivingStatus(Status status) {
|
|||||||
this->driving_status = status;
|
this->driving_status = status;
|
||||||
// switch (this->driving_status) {
|
// switch (this->driving_status) {
|
||||||
// case Status::Stop :
|
// case Status::Stop :
|
||||||
// Serial.println("New drivingState = Stop in MoveControl::setDrivingStatus");
|
// std::cout << "New drivingState = Stop in MoveControl::setDrivingStatus" << std::endl;
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
// case Status::Drive :
|
// case Status::Drive :
|
||||||
// Serial.println("New drivingState = Drive in MoveControl::setDrivingStatus");
|
// std::cout << "New drivingState = Drive in MoveControl::setDrivingStatus" << std::endl;
|
||||||
|
// break;
|
||||||
|
|
||||||
|
// case Status::Raw :
|
||||||
|
// std::cout << "New drivingState = Raw in MoveControl::setDrivingStatus" << std::endl;
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
// default:
|
// default:
|
||||||
@@ -169,12 +173,12 @@ void MoveControl::calcTargetWheelSpeed() {
|
|||||||
\ 1 -b / \ T / \ Xr / */
|
\ 1 -b / \ T / \ Xr / */
|
||||||
|
|
||||||
// (1 / r) * 1
|
// (1 / r) * 1
|
||||||
constexpr double A = 15.82278481;
|
constexpr double A = 1.0 / (Settings::wheelDiameter / 2);
|
||||||
// (1 / r) * b
|
// (1 / r) * b
|
||||||
constexpr double B = 2.096518987;
|
constexpr double B = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
||||||
|
|
||||||
this->wheelspeed_right_target = (A * this->drivingSpeeds.x + B * this->drivingSpeeds.rot) * (Settings::wheelDiameter / 2);
|
this->wheelspeed_right_target = (A * this->drivingSpeeds.x + B * this->drivingSpeeds.rot);
|
||||||
this->wheelspeed_left_target = (A * this->drivingSpeeds.x + (-B) * this->drivingSpeeds.rot) * (Settings::wheelDiameter / 2);
|
this->wheelspeed_left_target = (A * this->drivingSpeeds.x + (-B) * this->drivingSpeeds.rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::regulateMotors() {
|
void MoveControl::regulateMotors() {
|
||||||
@@ -207,6 +211,6 @@ void MoveControl::regulateMotors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::updateCurrentWheelSpeed() {
|
void MoveControl::updateCurrentWheelSpeed() {
|
||||||
this->wheelspeed_left = this->left_speedometer->getSpeed();
|
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
||||||
this->wheelspeed_right = this->right_speedometer->getSpeed();
|
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user