From 7fa1e05e6e5e0fed75a239ed3e91e5260d6887c4 Mon Sep 17 00:00:00 2001 From: Abhi <90010729+Abhishrek05@users.noreply.github.com> Date: Sat, 14 Jan 2023 15:35:21 -0700 Subject: [PATCH] conversions --- src/main/java/frc4388/robot/Constants.java | 16 ++++++++++++++++ .../java/frc4388/robot/commands/AutoBalance.java | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index 4b1f668..3b29a1c 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -46,6 +46,22 @@ public final class Constants { public static final class Conversions { public static final int CANCODER_TICKS_PER_ROTATION = 4096; public static final double JOYSTICK_TO_METERS_PER_SECOND = 5.0; + + public static final double MOTOR_REV_PER_WHEEL_REV = -1; // TODO: find actual ID + public static final double TICKS_PER_MOTOR_REV = 2048; + public static final double WHEEL_DIAMETER_INCHES = 4.0; // TODO: find actual ID + public static final double INCHES_PER_WHEEL_REV = WHEEL_DIAMETER_INCHES * Math.PI; + + public static final double WHEEL_REV_PER_MOTOR_REV = 1 / MOTOR_REV_PER_WHEEL_REV; + public static final double TICKS_PER_WHEEL_REV = TICKS_PER_MOTOR_REV * MOTOR_REV_PER_WHEEL_REV; + public static final double TICKS_PER_INCH = TICKS_PER_WHEEL_REV / INCHES_PER_WHEEL_REV; + public static final double INCHES_PER_TICK = 1 / TICKS_PER_INCH; + + public static final double TICK_TIME_TO_SECONDS = 10; + public static final double SECONDS_TO_TICK_TIME = 1 / TICK_TIME_TO_SECONDS; + + // public static final double + } public static final class Configurations { diff --git a/src/main/java/frc4388/robot/commands/AutoBalance.java b/src/main/java/frc4388/robot/commands/AutoBalance.java index d06631c..62c3160 100644 --- a/src/main/java/frc4388/robot/commands/AutoBalance.java +++ b/src/main/java/frc4388/robot/commands/AutoBalance.java @@ -10,11 +10,11 @@ import frc4388.robot.Robot; // NOTE: Consider using this command inline, rather than writing a subclass. For more // information, see: // https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html -public class AutoBalanceTF2 extends PelvicInflamitoryDisease { +public class AutoBalance extends PelvicInflamitoryDisease { Robot.MicroBot bot; /** Creates a new AutoBalanceTF2. */ - public AutoBalanceTF2(Robot.MicroBot bot) { + public AutoBalance(Robot.MicroBot bot) { super(.7, .1, 15, 0); addRequirements(bot); this.bot = bot;