holon movement: recalculate max possible velocity
The velocity has been calculated by using the holon movement formulas in an excel spritesheetand and empirically tested to find a suitable valuecode_newgen
parent
71cf8ff249
commit
7deaeff7c0
|
@ -18,6 +18,12 @@
|
||||||
|
|
||||||
#define UNLOCK_THRESH 800
|
#define UNLOCK_THRESH 800
|
||||||
|
|
||||||
|
#define MAX_VEL 310
|
||||||
|
#define MAX_VEL_EIGTH 248
|
||||||
|
#define MAX_VEL_HALF 155
|
||||||
|
#define MAX_VEL_3QUARTERS 232
|
||||||
|
#define MAX_VEL_QUARTER 78
|
||||||
|
|
||||||
class DriveController{
|
class DriveController{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -58,7 +58,7 @@ void Striker::striker()
|
||||||
dir = dir + 360; //se sto nel quadrante negativo ricappotto
|
dir = dir + 360; //se sto nel quadrante negativo ricappotto
|
||||||
else
|
else
|
||||||
dir = dir;
|
dir = dir;
|
||||||
drive->prepareDrive(dir, 100, 0);
|
drive->prepareDrive(dir, MAX_VEL_EIGTH, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Striker::storcimentoPorta()
|
void Striker::storcimentoPorta()
|
||||||
|
|
|
@ -118,7 +118,7 @@ void PositionSysCamera::CameraPID(){
|
||||||
dir = (dir+360) % 360;
|
dir = (dir+360) % 360;
|
||||||
|
|
||||||
int dist = sqrt(Outputx*Outputx + Outputy*Outputy);
|
int dist = sqrt(Outputx*Outputx + Outputy*Outputy);
|
||||||
int speed = map(dist*DIST_MULT, 0, MAX_DIST, 0, 350);
|
int speed = map(dist*DIST_MULT, 0, MAX_DIST, 0, MAX_VEL);
|
||||||
drive->prepareDrive(dir, speed, 0);
|
drive->prepareDrive(dir, speed, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue