From 445cce2ca6595ce4d8dfbe0aa5d369c51a43a148 Mon Sep 17 00:00:00 2001 From: Raghav66296 <90011037+Raghav66296@users.noreply.github.com> Date: Fri, 21 Jan 2022 17:59:12 -0700 Subject: [PATCH 1/2] commets --- src/main/java/frc4388/robot/Constants.java | 3 +++ .../java/frc4388/robot/RobotContainer.java | 4 +++- src/main/java/frc4388/robot/RobotMap.java | 1 + .../java/frc4388/robot/subsystems/Turret.java | 20 ++++++++++++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index 80a21ee..9c743e6 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -91,6 +91,9 @@ public final class Constants { public static final Gains SHOOTER_TURRET_GAINS = new Gains(0.6, 0.0, 0.0, 0.0, 0, 1.0); public static final Gains SHOOTER_ANGLE_GAINS = new Gains(0.05, 0.0, 0.0, 0.0, 0, 0.3); public static final double SHOOTER_TURRET_MIN = -1.0; + + /* Turret Constants */ + //ID } } diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 70fd283..de750b6 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -66,8 +66,10 @@ public class RobotContainer { // continually sends updates to the Blinkin LED controller to keep the lights on m_robotLED.setDefaultCommand(new RunCommand(m_robotLED::updateLED, m_robotLED)); - } + + //Turret default command + /** * Use this method to define your button->command mappings. Buttons can be * created by instantiating a {@link GenericHID} or one of its subclasses diff --git a/src/main/java/frc4388/robot/RobotMap.java b/src/main/java/frc4388/robot/RobotMap.java index 225a8b4..ac08cff 100644 --- a/src/main/java/frc4388/robot/RobotMap.java +++ b/src/main/java/frc4388/robot/RobotMap.java @@ -97,6 +97,7 @@ public class RobotMap { /*Boom Boom Subsystem*/ public final WPI_TalonFX shooterFalconLeft = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_LEFT_CAN_ID); public final WPI_TalonFX shooterFalconRight = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_RIGHT_CAN_ID); + //Create motor CANSparkMAx void ConfigureShooterMotorControllers() { } diff --git a/src/main/java/frc4388/robot/subsystems/Turret.java b/src/main/java/frc4388/robot/subsystems/Turret.java index 6dcd581..f570a34 100644 --- a/src/main/java/frc4388/robot/subsystems/Turret.java +++ b/src/main/java/frc4388/robot/subsystems/Turret.java @@ -8,10 +8,28 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Turret extends SubsystemBase { /** Creates a new Turret. */ - public Turret() {} + //Motor object + //Variables + public Turret(/*Motor argument*/ */) { + //Motor object = motor argument + //Config motor + } @Override public void periodic() { // This method will be called once per scheduler run } + + //function turnWithJoystick(double input) + // motor.set(input) } + + +/** TODO +* Constants ID +* RobotMap configs +* RobotContainer defaultCommand and Instantiation +* turnWithJoystick function +* setPosition function +* Limit switches +**/ \ No newline at end of file From 2b49f8ed8d9474acbe1717c9971f07df3898d6a6 Mon Sep 17 00:00:00 2001 From: neil92150 <90288985+neil92150@users.noreply.github.com> Date: Fri, 21 Jan 2022 20:56:25 -0700 Subject: [PATCH 2/2] Turret WIP --- src/main/java/frc4388/robot/Constants.java | 21 +++++++++++++++++-- .../java/frc4388/robot/RobotContainer.java | 4 ++++ src/main/java/frc4388/robot/RobotMap.java | 6 +++++- .../java/frc4388/robot/subsystems/Turret.java | 18 +++++++++------- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index 9c743e6..552cb8b 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -88,12 +88,29 @@ public final class Constants { public static final int SHOOTER_SLOT_IDX = 0; public static final int SHOOTER_PID_LOOP_IDX = 1; public static final SupplyCurrentLimitConfiguration SUPPLY_CURRENT_LIMIT_CONFIG = new SupplyCurrentLimitConfiguration(true, 60, 40, 0.5); + public static final int SHOOTER_FALCON_LEFT_CAN_ID = 0; + public static final int SHOOTER_FALCON_RIGHT_CAN_ID = 0; + + /* Turret Constants */ + //ID + public static final int TURRET_MOTOR_CAN_ID = 0; public static final Gains SHOOTER_TURRET_GAINS = new Gains(0.6, 0.0, 0.0, 0.0, 0, 1.0); public static final Gains SHOOTER_ANGLE_GAINS = new Gains(0.05, 0.0, 0.0, 0.0, 0, 0.3); public static final double SHOOTER_TURRET_MIN = -1.0; + public static final double ENCODER_TRICKS_PER_REV = 0; + public static final double NEO_UNITS_PER_REV = 0; + public static final double DEGREES_PER_ROT = 0; + + + public static final SupplyCurrentLimitConfiguration SUPPLY_CURRENT_LIMIT_CONFIG = new SupplyCurrentLimitConfiguration(ture,0,0,0); + + public static final int TURRET_RIGHT_SOFT_LIMIT = 0; + public static final int TURRET_LEFT_SOFT_LIMIT = 0; + public static final double TURRET_SPEED_MULTIPLIER = 0.3; + public static final double TURRET_CALIBRATE_SPEED = 0.075; + public static final double TURRET_MOTOR_ROTS_PER_ROT = 1; + public static final double TURRET_MOTOR_POS_AT_ZERO_ROT = 0; - /* Turret Constants */ - //ID } } diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index de750b6..c117e60 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -68,8 +68,12 @@ public class RobotContainer { m_robotLED.setDefaultCommand(new RunCommand(m_robotLED::updateLED, m_robotLED)); + //Turret default command + + m_robotTurret.setDefaultCommand( + new RunCommand(() -> m_robotTurret.aimToCenter())); /** * Use this method to define your button->command mappings. Buttons can be * created by instantiating a {@link GenericHID} or one of its subclasses diff --git a/src/main/java/frc4388/robot/RobotMap.java b/src/main/java/frc4388/robot/RobotMap.java index ac08cff..d713cbe 100644 --- a/src/main/java/frc4388/robot/RobotMap.java +++ b/src/main/java/frc4388/robot/RobotMap.java @@ -97,9 +97,13 @@ public class RobotMap { /*Boom Boom Subsystem*/ public final WPI_TalonFX shooterFalconLeft = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_LEFT_CAN_ID); public final WPI_TalonFX shooterFalconRight = new WPI_TalonFX(ShooterConstants.SHOOTER_FALCON_RIGHT_CAN_ID); - //Create motor CANSparkMAx + public final CANSparkMax shooterTurret = new CANSparkMax(ShooterConstants.SHOOTER_TURRET_CAN_ID); + //Create motor CANSparkMax void ConfigureShooterMotorControllers() { + /*Turret Subsytem*/ + + } diff --git a/src/main/java/frc4388/robot/subsystems/Turret.java b/src/main/java/frc4388/robot/subsystems/Turret.java index f570a34..428fe00 100644 --- a/src/main/java/frc4388/robot/subsystems/Turret.java +++ b/src/main/java/frc4388/robot/subsystems/Turret.java @@ -8,11 +8,10 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class Turret extends SubsystemBase { /** Creates a new Turret. */ - //Motor object + public CANSparkMax m_turretMotor; //Variables - public Turret(/*Motor argument*/ */) { - //Motor object = motor argument - //Config motor + public Turret() { + m_turretMotor = turretMotor; } @Override @@ -20,16 +19,19 @@ public class Turret extends SubsystemBase { // This method will be called once per scheduler run } + public void turnWithJoystick (double input) + { + m_turretMotor.set(input); + + } + //function turnWithJoystick(double input) // motor.set(input) } + /** TODO -* Constants ID -* RobotMap configs -* RobotContainer defaultCommand and Instantiation -* turnWithJoystick function * setPosition function * Limit switches **/ \ No newline at end of file