Skip to content

Commit e8e78f9

Browse files
committed
Merge branch 'develop' of https://github.com/Blu-Cru/Deocde into develop
2 parents e3000d4 + 2f82c0b commit e8e78f9

6 files changed

Lines changed: 26 additions & 13 deletions

File tree

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/common/subsytems/drivetrain/localization/Octoquad.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Octoquad(OctoQuad octoquad){
4141
OctoQuad.LocalizerDataBlock info = octoquad.readLocalizerData();
4242
pose = new Pose2d(info.posX_mm, info.posY_mm, info.heading_rad);
4343
vel = new Pose2d(info.velX_mmS, info.velY_mmS, info.velHeading_radS);
44-
44+
Robot.getInstance().positionHistory.add(pose, vel);
4545
}
4646

4747
@Override
@@ -50,6 +50,7 @@ public void read() {
5050
//dividing for unit conversion
5151
pose = new Pose2d(info.posX_mm / 25.4, info.posY_mm / 25.4, info.heading_rad);
5252
vel = new Pose2d(info.velX_mmS / 25.4, info.velY_mmS / 25.4, info.velHeading_radS);
53+
Robot.getInstance().positionHistory.add(pose, vel);
5354
}
5455
/**
5556
* returns pose in x,y,h in inch,inch,radian

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/common/subsytems/outtake/TagCamera.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import java.util.ArrayList;
3030

31-
public class TagCamera implements BluSubsystem, Subsystem {
31+
public class TagCamera implements BluSubsystem, Subsystem {
3232
AprilTagProcessor tags;
3333
VisionPortal portal;
3434
AprilTagDetection detection;
@@ -82,6 +82,8 @@ public TagCamera(){
8282
@Override
8383
public void init() {
8484
read();
85+
xFilter.setVal(Robot.getInstance().sixWheelDrivetrain.getPos().getX());
86+
yFilter.setVal(Robot.getInstance().sixWheelDrivetrain.getPos().getY());
8587
}
8688

8789
@Override
@@ -155,6 +157,7 @@ public void read() {
155157
// now that we know offsets we can assume we havent changed off that much
156158
botposeOnTheMove = new Pose2d(Robot.getInstance().sixWheelDrivetrain.getPos().vec().addNotInPlace(offset),
157159
Robot.getInstance().sixWheelDrivetrain.getPos().getH());
160+
xFilter.update(Robot.getInstance().sixWheelDrivetrain.getPos().getX(), botposeOnTheMove.getX());
158161

159162
//non-vector code
160163
/*double camToTagFieldX = dx * Math.cos(angle) - dy * Math.sin(angle);

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/common/subsytems/outtake/turret/Turret.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public class Turret implements BluSubsystem, Subsystem {
3636
public static double kP = 0.028;
3737
public static double kI = 0.02;
3838
public static double kD = 0.0018;
39-
public static double kPTags = 0.0011;
39+
public static double kPTags = 0.00125;
4040
public static double kITags = 0;
41-
public static double kDTags = 0.000215;
41+
public static double kDTags = 0.0002125;
4242

4343
public static double acceptableError = 0.5;
4444
public static double powerClip = 1;

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/common/util/KalmanFilter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ public KalmanFilter(double x, double Q, double R, double P, double K) {
2020
this.P = P;
2121
this.K = K;
2222
}
23-
public void update(double input) {
24-
double predictedinput = input-lastinput;
23+
public void update(double firstInput, double secondInput) {
24+
double predictedinput = firstInput-lastinput;
2525
u = predictedinput; // The delta
2626
x = x_previous + u;
2727

2828
P = p_previous + Q;
2929

3030
K = P/(P + R);
3131

32-
z = input; // The known current input
32+
z = secondInput; // The known current input
3333

3434
x = x + K * (z - x);
3535

3636
P = (1 - K) * P;
3737

3838
x_previous = x;
3939
p_previous = P;
40-
lastinput = input;
40+
lastinput = firstInput;
4141
}
4242

43-
public void update(double input, double givenlastinput) {
43+
/*public void update(double input, double givenlastinput) {
4444
double predictedinput = input-givenlastinput;
4545
u = predictedinput; // The delta
4646
x = x_previous + u;
@@ -58,6 +58,9 @@ public void update(double input, double givenlastinput) {
5858
x_previous = x;
5959
p_previous = P;
6060
lastinput = input;
61+
}*/
62+
public void setVal(double val){
63+
this.x = val;
6164
}
6265

6366
public double get() {

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/opmodes/Tele.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public enum State{
5454
public void initialize(){
5555
reportTelemetry = true;
5656
robot.clear();
57+
addSixWheel();
5758
robot.addTurretCam();
5859
//addLLTagDetector();
59-
addSixWheel();
6060
addIntake();
6161
addElevator();
6262
addTransfer();

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blucru/opmodes/test/TurretLockOnGoalTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111
public class TurretLockOnGoalTest extends BluLinearOpMode {
1212
public void initialize(){
1313
robot.clear();
14-
robot.addTurretCam();
1514
addSixWheel();
16-
addTurret();
15+
robot.addTurretCam();
16+
//addLLTagDetector();
17+
addIntake();
18+
addElevator();
19+
addTransfer();
1720
addShooter();
21+
addTurret();
22+
addTilt();
1823
Globals.multiTelemetry = new MultipleTelemetry(telemetry);
1924
}
2025

21-
public void periodic(){
26+
public void periodic() throws InterruptedException {
2227
if (gamepad1.a){
2328
turret.lockOnGoal();
2429
}
@@ -35,5 +40,6 @@ public void periodic(){
3540
if (driver1.pressedLeftBumper()){
3641
Globals.setAlliance(Alliance.BLUE);
3742
}
43+
//Thread.sleep(10);
3844
}
3945
}

0 commit comments

Comments
 (0)