feat:ftc2024-autonome.java update autonomous mode 2
This commit is contained in:
parent
d236f152c0
commit
c231b871bb
1 changed files with 15 additions and 8 deletions
|
@ -61,17 +61,24 @@ public class ftc2024_autonome extends LinearOpMode {
|
|||
}
|
||||
else {
|
||||
double[][] operations = {
|
||||
{3.0,-1.0,1.0}, // operation 1: 3 sec , lm=-1 , rm = 1
|
||||
{5.0,1.0,1.0},
|
||||
{2.0,-1.0,1.0},
|
||||
{3.0,-1.0,-1.0},
|
||||
{10.0,1.0,-1.0}
|
||||
{-1.0,1.0}, // vectors
|
||||
{1.0,1.0},
|
||||
{-1.0,1.0},
|
||||
{-1.0,-1.0},
|
||||
{1.0,-1.0}
|
||||
};
|
||||
//mode Aurelien
|
||||
for(int i = 0; i<operations.length; i++){
|
||||
double time = operations[i][0];
|
||||
double lmvalue = operations[i][1];
|
||||
double rmvalue = operations[i][2];
|
||||
double vec = operations[i];
|
||||
double x = vec[0];
|
||||
double y = vec[1];
|
||||
double total_dist = (double) math.sqrt(Math.pow(y,2)+Math.pow(x,2));
|
||||
double time = time_for_dist(speed, time);
|
||||
double a = (-y+x)/Math.pow(2,1/2);
|
||||
double b = (-y-x)/Math.pow(2,1/2);
|
||||
double vmean = (Math.abs(a)+Math.abs(b))/2;
|
||||
lmvalue = (a/vmean);
|
||||
rmvalue = (b/vmean);
|
||||
runtime.reset();
|
||||
while (opModeIsActive() && (runtime.seconds() <= time)) {
|
||||
lm.setPower(lmvalue);
|
||||
|
|
Loading…
Reference in a new issue