lines now working: angle of each motor was est to 0 in constructor

code_midgen
EmaMaker 2019-12-05 12:51:23 +01:00
parent c3bb06f89d
commit 049b0c1830
4 changed files with 10 additions and 8 deletions

View File

@ -28,6 +28,10 @@ DriveController::DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_)
errorP = 0; errorP = 0;
errorI = 0; errorI = 0;
errorD = 0; errorD = 0;
errorePre = 0;
pidfactor = 0;
integral = 0;
} }
void DriveController::prepareDrive(int dir, int speed, int tilt){ void DriveController::prepareDrive(int dir, int speed, int tilt){

View File

@ -64,7 +64,7 @@ void DataSourceCtrlLines::postProcess(){
} }
void DataSourceCtrlLines::outOfBounds(){ void DataSourceCtrlLines::outOfBounds(){
//handleExtern(); handleExtern();
handleIntern(); handleIntern();
} }
@ -144,8 +144,8 @@ void DataSourceCtrlLines::handleIntern(){
break; break;
} }
if(exitTimer < 45) outVel = 200; if(exitTimer < 45) outVel = 350;
else outVel = 150; else outVel = 330;
drive->prepareDrive(outDir, outVel, 0); drive->prepareDrive(outDir, outVel, 0);
// keeper_backToGoalPost = true; // keeper_backToGoalPost = true;
// keeper_tookTimer = true; // keeper_tookTimer = true;
@ -154,7 +154,7 @@ void DataSourceCtrlLines::handleIntern(){
inVOldX = 0; inVOldX = 0;
inVOldY = 0; inVOldY = 0;
// lineSensByteBak = 30; // lineSensByteBak = 30;
//drive->canUnlock = true; drive->canUnlock = true;
} }
// lineSensByteBak = linesensbyteI; // lineSensByteBak = linesensbyteI;

View File

@ -11,12 +11,12 @@ void setup() {
delay(2000); delay(2000);
} }
void loop() { void loop() {
updateSensors(); updateSensors();
drive->prepareDrive(0,0,0); drive->prepareDrive(0,0,0);
linesCtrl->update(); linesCtrl->update();
drive->drivePrepared(); drive->drivePrepared();
} }

View File

@ -11,8 +11,6 @@ Motor::Motor(int a, int b, int pwm, int angle_){
pinMode(pinA, OUTPUT); pinMode(pinA, OUTPUT);
pinMode(pinB, OUTPUT); pinMode(pinB, OUTPUT);
pinMode(pinPwm, OUTPUT); pinMode(pinPwm, OUTPUT);
angle = 0;
} }
Motor::Motor(){ } Motor::Motor(){ }