mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
Merge branch 'cleanup' of https://github.com/Team4388/2022NoWayHome into cleanup
This commit is contained in:
@@ -341,5 +341,8 @@ public final class Constants {
|
|||||||
public static final double EDGE_TO_CENTER = 20;
|
public static final double EDGE_TO_CENTER = 20;
|
||||||
public static final double LIMELIGHT_RADIUS = 8;
|
public static final double LIMELIGHT_RADIUS = 8;
|
||||||
public static final double SHOOTER_CORRECTION = 1.d;
|
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 = getFakePoints();
|
||||||
//// points = filterPoints(points);
|
//// points = filterPoints(points);
|
||||||
|
|
||||||
Point average = VisionOdometry.averagePoint(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();
|
// double position = m_turret.m_boomBoomRotateEncoder.getPosition();
|
||||||
|
|
||||||
// if(Math.abs(position - ShooterConstants.TURRET_FORWARD_SOFT_LIMIT) < 5 ||
|
// 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(),
|
// RobotContainer.getDriverController().getRightX(), RobotContainer.getDriverController().getRightY(),
|
||||||
// true);
|
// true);
|
||||||
|
|
||||||
|
|
||||||
double regressedDistance = getDistance(average.y);
|
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
|
// ! no longer a +30 lol -aarav
|
||||||
double distAdj = SmartDashboard.getNumber("Distance Adjust", -35);
|
double distAdj = SmartDashboard.getNumber("Distance Adjust", -35);
|
||||||
velocity = m_boomBoom.getVelocity(regressedDistance + distAdj);
|
velocity = m_boomBoom.getVelocity(regressedDistance + distAdj);
|
||||||
|
|||||||
Reference in New Issue
Block a user