Merge branch 'cleanup' of https://github.com/Team4388/2022NoWayHome into cleanup

This commit is contained in:
Ryan
2022-04-08 13:33:46 -06:00
2 changed files with 14 additions and 6 deletions
@@ -341,5 +341,8 @@ public final class Constants {
public static final double EDGE_TO_CENTER = 20;
public static final double LIMELIGHT_RADIUS = 8;
public static final double SHOOTER_CORRECTION = 1.d;
public static final double PIXELS_PER_DEGREE = LIME_HIXELS / H_FOV;
public static final double DEGREES_PER_PIXEL = 1 / PIXELS_PER_DEGREE;
}
}
@@ -105,12 +105,8 @@ public class TrackTarget extends CommandBase {
}
// points = getFakePoints();
//// points = filterPoints(points);
Point average = VisionOdometry.averagePoint(points);
double output = ((average.x + 40) - VisionConstants.LIME_HIXELS/2.d) / VisionConstants.LIME_HIXELS;
output *= 2.1;
m_turret.runTurretWithInput(output);
// double position = m_turret.m_boomBoomRotateEncoder.getPosition();
// if(Math.abs(position - ShooterConstants.TURRET_FORWARD_SOFT_LIMIT) < 5 ||
@@ -121,9 +117,18 @@ public class TrackTarget extends CommandBase {
// RobotContainer.getDriverController().getRightX(), RobotContainer.getDriverController().getRightY(),
// true);
double regressedDistance = getDistance(average.y);
// ! offset trig solution
double desiredOffset = 10; // * inches
double angleOffset = Math.toDegrees(Math.atan(desiredOffset / regressedDistance)); // * degrees
double pixelOffset = angleOffset * VisionConstants.PIXELS_PER_DEGREE;
double output = ((average.x + pixelOffset) - VisionConstants.LIME_HIXELS/2.d) / VisionConstants.LIME_HIXELS;
output *= 2.1;
m_turret.runTurretWithInput(output);
// ! no longer a +30 lol -aarav
double distAdj = SmartDashboard.getNumber("Distance Adjust", -35);
velocity = m_boomBoom.getVelocity(regressedDistance + distAdj);