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/launch.json
|
||||
.vscode/ipch
|
||||
rover-cppcheck-build-dir
|
||||
|
||||
doc/Doxygen/html*
|
||||
doc/Doxygen/generated*
|
||||
|
||||
|
||||
|
||||
workspace.code-workspace
|
||||
projektarbeit.code-workspace
|
||||
|
||||
+6
-17
@@ -6,7 +6,6 @@ Do later:
|
||||
-> Program underfloorLighting
|
||||
-> Add an beeper
|
||||
-> Program the beeper
|
||||
-> Update GNSS Lib to v3
|
||||
-> Engine slow down without curve in motorControl
|
||||
-> Network clean up (Mqtt remove?)
|
||||
-> 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
|
||||
-> Racing Mode
|
||||
-> ConsolControl
|
||||
-> Menü für Sensordaten (kann in jedem Betriebsmodus aufgerufen werden)
|
||||
- GNSS
|
||||
- Ntrip
|
||||
- CalcCompass
|
||||
- RealCompass
|
||||
- Gyroskop
|
||||
- Geschwindigkeiten (vielleicht)
|
||||
-> Menü für Einstellungen
|
||||
- PID
|
||||
- Geschwindigkeiten
|
||||
- WiFi (save in Flash)
|
||||
-> Battery
|
||||
- tabelle mit eigenen Werten übergeben und nicht in header (wiederverwendbarkeit)
|
||||
@@ -37,21 +27,20 @@ Do later:
|
||||
-> Check speration between Ui and Route (RouteMenu)
|
||||
-> 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.
|
||||
-> ESP und Sensoren in den DeepSleep für Auschalten oder Akkuschutz
|
||||
|
||||
|
||||
Do now:
|
||||
Code:
|
||||
Doxygen Kommentare aktualisieren
|
||||
esp und sensoren in den deepsleep
|
||||
magic numbers etc
|
||||
Fernbedienung!
|
||||
|
||||
Latex:
|
||||
Anhang: Liste mit allen Komponenten und Kurzbeschreibung
|
||||
Unterschied funktionale und nicht funktionale Anforderungen
|
||||
Strom nicht über Zeit sondern Rampe
|
||||
Formel für Zeit anfahrrampe Einheiten
|
||||
Überall den Durchmesser der Räder auf 12cm und Pulse auf 384 / 3 = 128
|
||||
Overfull H-Boxen
|
||||
Test Motor, Zeiten kontrolieren. Wenn einfach so dann bezug auf fehler bei Timing und freeRtos
|
||||
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 pwm = 22;
|
||||
constexpr uint8_t encoder = 33;
|
||||
constexpr uint8_t pmwChannel = 0;
|
||||
constexpr uint8_t pmwChannel = 1;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Settings {
|
||||
constexpr float wheelDiameter = 0.1263;
|
||||
constexpr uint16_t encoderSteps = 360;
|
||||
constexpr float wheelDiameter = 0.105;
|
||||
constexpr float wheelDistance = 0.255;
|
||||
constexpr uint16_t encoderSteps = 384;
|
||||
|
||||
namespace Pid {
|
||||
namespace Left {
|
||||
constexpr uint8_t P = 75;
|
||||
constexpr uint8_t P = 5;
|
||||
constexpr uint8_t I = 0;
|
||||
constexpr uint8_t D = 0;
|
||||
}
|
||||
|
||||
namespace Right {
|
||||
constexpr uint8_t P = 75;
|
||||
constexpr uint8_t P = 5;
|
||||
constexpr uint8_t I = 0;
|
||||
constexpr uint8_t D = 0;
|
||||
}
|
||||
|
||||
+13
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define HOTSPOT
|
||||
#define HW1
|
||||
|
||||
#ifdef HOTSPOT
|
||||
namespace NetworkConfig {
|
||||
@@ -28,6 +28,18 @@ namespace NetworkConfig {
|
||||
}
|
||||
#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
|
||||
#ifdef RHEDE
|
||||
namespace NetworkConfig {
|
||||
|
||||
@@ -16,14 +16,14 @@ Speedometer::Speedometer(uint8_t pin, double diameter, uint16_t steps) {
|
||||
this->steps = steps;
|
||||
|
||||
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->resume();
|
||||
|
||||
Component::loopDelay = Speedometer::loopDelay;
|
||||
|
||||
clearAvgBuf();
|
||||
this->clearAvgBuf();
|
||||
}
|
||||
|
||||
Speedometer::~Speedometer() {
|
||||
@@ -47,18 +47,27 @@ void Speedometer::run() {
|
||||
double n = (double)pulse / this->steps; // Wheel revolutions in absolute time
|
||||
double u = n / ((double)elapsedTime / 1000); // Wheel revolutions per second
|
||||
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) {
|
||||
case Direction::Forward :
|
||||
this->speed = ms;
|
||||
this->rad = rad;
|
||||
break;
|
||||
|
||||
case Direction::Backward :
|
||||
this->speed = -ms;
|
||||
this->rad = -rad;
|
||||
break;
|
||||
|
||||
case Direction::None :
|
||||
this->speed = 0;
|
||||
this->rad = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,13 +59,6 @@ class Speedometer : public Component {
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -88,6 +81,7 @@ class Speedometer : public Component {
|
||||
* @return double speed in m/s
|
||||
*/
|
||||
double getSpeed() const { return this->speed; }
|
||||
double getSpeedRad() const { return this->rad; };
|
||||
double getAvgSpeed() const;
|
||||
|
||||
/**
|
||||
@@ -111,7 +105,6 @@ class Speedometer : public Component {
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void init(uint8_t pin, double diameter, uint16_t steps);
|
||||
void clearAvgBuf();
|
||||
void addValToBuf(int16_t val);
|
||||
int16_t calcAverage() const;
|
||||
@@ -126,6 +119,7 @@ class Speedometer : public Component {
|
||||
bool calibrationRunning = false;
|
||||
|
||||
double speed = 0;
|
||||
double rad = 0;
|
||||
double diameter;
|
||||
|
||||
uint8_t printCounter = 0;
|
||||
|
||||
@@ -23,8 +23,6 @@ lib_deps =
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
bblanchon/ArduinoJson@^6.20.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
|
||||
; upload_port = COM6
|
||||
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;
|
||||
}
|
||||
|
||||
if (millis() - this->actionStart > this->maneuverTime || this->abort) {
|
||||
if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort) {
|
||||
this->busy = false;
|
||||
this->abort = false;
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
@@ -83,6 +83,7 @@ bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||
this->maneuver = Maneuver::LeftEngine;
|
||||
std::cout << "TestMode::leftEngine" << std::endl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -112,7 +113,7 @@ void TestMode::abortManeuver() {
|
||||
}
|
||||
|
||||
uint8_t TestMode::getRemainingManeuverTime() const {
|
||||
if (busy)
|
||||
if (this->busy)
|
||||
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||
return 0;
|
||||
}
|
||||
@@ -120,7 +121,7 @@ uint8_t TestMode::getRemainingManeuverTime() const {
|
||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->busy)
|
||||
return false;
|
||||
if (powerPercentage >= 100 || powerPercentage <= -100)
|
||||
if (powerPercentage > 100 || powerPercentage < -100)
|
||||
return false;
|
||||
if (seconds < 0)
|
||||
return false;
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "moveControl.h"
|
||||
#include "navigation.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
|
||||
|
||||
@@ -97,7 +96,6 @@ class TestMode : public DriveModi {
|
||||
void run() override;
|
||||
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
||||
|
||||
Navigation* navigation;
|
||||
Maneuver maneuver = Maneuver::None;
|
||||
int16_t maneuverValueOne = 0;
|
||||
int16_t maneuverValueTwo = 0;
|
||||
|
||||
+12
-8
@@ -80,11 +80,15 @@ void MoveControl::setDrivingStatus(Status status) {
|
||||
this->driving_status = status;
|
||||
// switch (this->driving_status) {
|
||||
// case Status::Stop :
|
||||
// Serial.println("New drivingState = Stop in MoveControl::setDrivingStatus");
|
||||
// std::cout << "New drivingState = Stop in MoveControl::setDrivingStatus" << std::endl;
|
||||
// break;
|
||||
|
||||
// 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;
|
||||
|
||||
// default:
|
||||
@@ -169,12 +173,12 @@ void MoveControl::calcTargetWheelSpeed() {
|
||||
\ 1 -b / \ T / \ Xr / */
|
||||
|
||||
// (1 / r) * 1
|
||||
constexpr double A = 15.82278481;
|
||||
constexpr double A = 1.0 / (Settings::wheelDiameter / 2);
|
||||
// (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_left_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);
|
||||
}
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
@@ -207,6 +211,6 @@ void MoveControl::regulateMotors() {
|
||||
}
|
||||
|
||||
void MoveControl::updateCurrentWheelSpeed() {
|
||||
this->wheelspeed_left = this->left_speedometer->getSpeed();
|
||||
this->wheelspeed_right = this->right_speedometer->getSpeed();
|
||||
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
||||
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user