a lot of bullshit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "consolControl.h"
|
||||
|
||||
ConsolControl::ConsolControl() {
|
||||
this->debug = new DebugMqtt("ConsolControl");
|
||||
}
|
||||
|
||||
void ConsolControl::init(MoveControl *MoveControl) {
|
||||
this->moveControl = moveControl;
|
||||
}
|
||||
|
||||
void ConsolControl::run() {
|
||||
uint8_t side = -1;
|
||||
|
||||
if (Serial.available()) {
|
||||
char cmd = Serial.read();
|
||||
if (cmd == 'l') {
|
||||
side = 0;
|
||||
} else if (cmd == 'r') {
|
||||
side = 1;
|
||||
}
|
||||
|
||||
double p = Serial.parseFloat();
|
||||
double i = Serial.parseFloat();
|
||||
double d = Serial.parseFloat();
|
||||
double s = Serial.parseFloat();
|
||||
double r = Serial.parseFloat();
|
||||
|
||||
if (p && i && d && s && r) {
|
||||
Serial.println("ConsolControl changeDate");
|
||||
this->moveControl->setPidTunings(side, p, i, d);
|
||||
this->moveControl->setSpeed(s);
|
||||
this->moveControl->setRotationspeed(r);
|
||||
} else {
|
||||
this->moveControl->setDrivingStatus(DrivingStatus::stop);
|
||||
printManual();
|
||||
debug->sendMsg(Loglevel::error, "not all double are not zero");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsolControl::printManual() {
|
||||
Serial.println("r 12.0 13.0 4.0 1.0 1.0 // site p i d s r");
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef CONSOL_CONTROL_H
|
||||
#define CONSOL_CONTROL_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "moveControl.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
#include "debugMqtt.h"
|
||||
|
||||
class ConsolControl : DriveModi{
|
||||
public:
|
||||
ConsolControl();
|
||||
void init(MoveControl *moveControl);
|
||||
void run();
|
||||
|
||||
private:
|
||||
void printManual();
|
||||
|
||||
MoveControl *moveControl;
|
||||
DebugMqtt *debug;
|
||||
|
||||
};
|
||||
|
||||
#endif // CONSOL_CONTROL_H
|
||||
Reference in New Issue
Block a user