new start to work on this
This commit is contained in:
@@ -7,34 +7,38 @@ ConsolControl::ConsolControl() {
|
||||
|
||||
void ConsolControl::init(MoveControl *MoveControl) {
|
||||
this->moveControl = moveControl;
|
||||
this->left_pid = this->moveControl->getPID(0);
|
||||
this->right_pid = this->moveControl->getPID(1);
|
||||
}
|
||||
|
||||
void ConsolControl::run() {
|
||||
PID *selectedPID;
|
||||
uint8_t side = -1;
|
||||
|
||||
if (Serial.available()) {
|
||||
char cmd = Serial.read();
|
||||
if (cmd == 'l') {
|
||||
selectedPID = this->left_pid;
|
||||
side = 0;
|
||||
} else if (cmd == 'r') {
|
||||
selectedPID = this->right_pid;
|
||||
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) {
|
||||
if (p && i && d && s && r) {
|
||||
Serial.println("ConsolControl changeDate");
|
||||
selectedPID->SetTunings(p, i, d);
|
||||
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 printManual() {
|
||||
Serial.println("r 12.0 13.0 4.0 // site p i d");
|
||||
void ConsolControl::printManual() {
|
||||
Serial.println("r 12.0 13.0 4.0 // site p i d s r");
|
||||
}
|
||||
@@ -15,9 +15,6 @@ class ConsolControl {
|
||||
|
||||
MoveControl *moveControl;
|
||||
DebugMqtt *debug;
|
||||
PID *left_pid;
|
||||
PID *right_pid;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user