drive: only drive when the PID is calculated
no need to recalibrate the pidpull/1/head
parent
714b00ee25
commit
15ba2991a1
|
@ -52,7 +52,7 @@ void loop() {
|
||||||
|
|
||||||
striker->play(striker_condition);
|
striker->play(striker_condition);
|
||||||
keeper->play(keeper_condition);
|
keeper->play(keeper_condition);
|
||||||
// testmenu->testMenu();
|
testmenu->testMenu();
|
||||||
|
|
||||||
// Last thing to do: movement and update status vector
|
// Last thing to do: movement and update status vector
|
||||||
drive->drivePrepared();
|
drive->drivePrepared();
|
||||||
|
|
|
@ -96,8 +96,7 @@ void DriveController::drive(int dir, int speed, int tilt){
|
||||||
input = delta;
|
input = delta;
|
||||||
setpoint = tilt;
|
setpoint = tilt;
|
||||||
|
|
||||||
pid->Compute();
|
if(pid->Compute()){
|
||||||
|
|
||||||
pidfactor = -output;
|
pidfactor = -output;
|
||||||
speed1 += pidfactor;
|
speed1 += pidfactor;
|
||||||
speed2 += pidfactor;
|
speed2 += pidfactor;
|
||||||
|
@ -143,6 +142,7 @@ void DriveController::drive(int dir, int speed, int tilt){
|
||||||
m4->drive((int) speed4);
|
m4->drive((int) speed4);
|
||||||
|
|
||||||
oldSpeed = speed;
|
oldSpeed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
CURRENT_DATA_WRITE.dir = dir;
|
CURRENT_DATA_WRITE.dir = dir;
|
||||||
CURRENT_DATA_WRITE.speed = speed;
|
CURRENT_DATA_WRITE.speed = speed;
|
||||||
|
|
Loading…
Reference in New Issue