-
Notifications
You must be signed in to change notification settings - Fork 35
/
CharacterizeDrivebaseMode.java
38 lines (30 loc) · 1.48 KB
/
CharacterizeDrivebaseMode.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.team254.frc2019.auto.modes;
import com.team254.frc2019.auto.AutoModeEndedException;
import com.team254.frc2019.auto.actions.CollectAccelerationDataAction;
import com.team254.frc2019.auto.actions.CollectVelocityDataAction;
import com.team254.frc2019.auto.actions.WaitAction;
import com.team254.lib.physics.DriveCharacterization;
import java.util.ArrayList;
import java.util.List;
public class CharacterizeDrivebaseMode extends AutoModeBase {
private final boolean highGear;
private final boolean reverse;
private final boolean turn;
public CharacterizeDrivebaseMode(boolean highGear, boolean reverse, boolean turn) {
this.highGear = highGear;
this.reverse = reverse;
this.turn = turn;
}
@Override
protected void routine() throws AutoModeEndedException {
List<DriveCharacterization.DataPoint> velocityData = new ArrayList<>();
List<DriveCharacterization.DataPoint> accelerationData = new ArrayList<>();
runAction(new CollectVelocityDataAction(velocityData, highGear, reverse, turn));
runAction(new WaitAction(10));
runAction(new CollectAccelerationDataAction(accelerationData, highGear, reverse, turn));
DriveCharacterization.CharacterizationConstants constants = DriveCharacterization.characterizeDrive(velocityData, accelerationData);
System.out.println("ks: " + constants.ks);
System.out.println("kv: " + constants.kv);
System.out.println("ka: " + constants.ka);
}
}