corrected a few errors, Furio plays is more precise than ever when playing

pull/1/head
EmaMaker 2020-02-10 19:55:56 +01:00
parent 2577cd568c
commit fc840b84be
2 changed files with 1 additions and 17 deletions

View File

@ -18,8 +18,7 @@ class DriveController{
DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_); DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_);
void drive(int dir=0, int speed=0, int tilt=0); void drive(int dir=0, int speed=0, int tilt=0);
void prepareDrive(int dir, int speed, int tilt); void prepareDrive(int dir, int speed, int tilt=0);
void prepareDrive(int dir, int speed);
void drivePrepared(); void drivePrepared();
float updatePid(); float updatePid();
float torad(float f); float torad(float f);

View File

@ -15,9 +15,6 @@ DriveController::DriveController(Motor* m1_, Motor* m2_, Motor* m3_, Motor* m4_)
pDir = 0; pDir = 0;
pSpeed = 0; pSpeed = 0;
pTilt = 0; pTilt = 0;
gDir = 0;
gSpeed = 0;
gTilt = 0;
vx = 0; vx = 0;
vy = 0; vy = 0;
@ -51,12 +48,6 @@ void DriveController::prepareDrive(int dir, int speed, int tilt){
pTilt = tilt; pTilt = tilt;
} }
void DriveController::prepareDrive(int dir, int speed){
pDir = dir;
pSpeed = speed;
pDir = gTilt;
}
void DriveController::drivePrepared(){ void DriveController::drivePrepared(){
drive(pDir, pSpeed, pTilt); drive(pDir, pSpeed, pTilt);
} }
@ -66,10 +57,6 @@ float DriveController::torad(float f){
} }
void DriveController::drive(int dir, int speed, int tilt){ void DriveController::drive(int dir, int speed, int tilt){
gDir = dir;
gSpeed = speed;
gTilt = tilt;
vx = ((speed * cosins[dir])); vx = ((speed * cosins[dir]));
vy = ((-speed * sins[dir])); vy = ((-speed * sins[dir]));
@ -100,9 +87,7 @@ void DriveController::drive(int dir, int speed, int tilt){
} }
input = delta; input = delta;
pid->Compute(); pid->Compute();
pidfactor = delta > 180 ? output*-1 : output; pidfactor = delta > 180 ? output*-1 : output;
speed1 += pidfactor; speed1 += pidfactor;