Skip to content

Commit

Permalink
Revert "Merge branch 'Shooter/#6-NewShooter'"
Browse files Browse the repository at this point in the history
This reverts commit ddb6dab, reversing
changes made to 21614e3.
  • Loading branch information
5687 committed Nov 17, 2023
1 parent ddb6dab commit a1b9c6c
Show file tree
Hide file tree
Showing 24 changed files with 790 additions and 422 deletions.
6 changes: 2 additions & 4 deletions src/main/java/org/frc5687/lib/drivers/OutliersTalon.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import com.ctre.phoenixpro.signals.NeutralModeValue;

/**
* TalonFX wrapper class that uses 254's LazyTalonFX that reduces CAN bus / CPU
* overhead by skipping
* duplicate set commands. (By default the Talon flushes the Tx buffer on every
* set call).
* TalonFX wrapper class that uses 254's LazyTalonFX that reduces CAN bus / CPU overhead by skipping
* duplicate set commands. (By default the Talon flushes the Tx buffer on every set call).
*/
public class OutliersTalon extends TalonFX {
// private final String _name;
Expand Down
34 changes: 4 additions & 30 deletions src/main/java/org/frc5687/lib/oi/Gamepad.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
/** Copied by Caleb on 1/13/2017. */

/**
* Handle input from standard Joysticks connected to the Driver Station. This
* class handles standard
* input that comes from the Driver Station. Each time a value is requested the
* most recent value is
* returned. There is a single class instance for each joystick and the mapping
* of ports to hardware
* Handle input from standard Joysticks connected to the Driver Station. This class handles standard
* input that comes from the Driver Station. Each time a value is requested the most recent value is
* returned. There is a single class instance for each joystick and the mapping of ports to hardware
* buttons depends on the code in the driver station.
*/
public class Gamepad extends Joystick {
Expand Down Expand Up @@ -106,30 +103,6 @@ public double getRawAxis(Axes axis) {
return super.getRawAxis(axis.getNumber());
}

/**
* Returns the direction in degrees of a control stick.
* Should override Joystick.getDirectionRadians().
*
* @param xAxisValue x axis of the stick.
* @param yAxisValue y axis of the stick.
* @return double radians
*/
public double getDirectionRadians(double xAxisValue, double yAxisValue) {
return Math.atan2(-xAxisValue, -yAxisValue);
}

/**
* Returns the direction in degrees of a control stick.
* Should override Joystick.getDirectionDegrees().
*
* @param xAxisValue x axis of the stick.
* @param yAxisValue y axis of the stick.
* @return double degrees
*/
public double getDirectionDegrees(double xAxisValue, double yAxisValue) {
return Math.toDegrees(getDirectionRadians(xAxisValue, yAxisValue));
}

/**
* Checks if the specified button is pressed
*
Expand Down Expand Up @@ -180,3 +153,4 @@ public JoystickButton getRightStickButton() {
return _rightStick;
}
}

105 changes: 38 additions & 67 deletions src/main/java/org/frc5687/swerret/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public static class DifferentialSwerveModule {
public static final double MAX_MODULE_JERK = MAX_MODULE_ACCELERATION * 2;
}

public static class Turret {
public static class TURRET {
public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG = new OutliersTalon.ClosedLoopConfiguration();

static {
Expand All @@ -285,88 +285,59 @@ public static class Turret {
CONTROLLER_CONFIG.JERK = 3200;
}

public static final double GEAR_RATIO = 54.5;
public static final double GEAR_RATIO = 56.0;
public static final double ANGLE_TOLERANCE = 0.05;
public static final double TURRET_DEADBAND = 0.2;
public static final double RANGE_OF_MOTION = Math.PI * 3.0;
}

public static class Shooter {
public static class Intake {
public static final double IN_SPEED = -0.458;
public static final double OUT_SPEED = 1.0;
public static final double IDLESPEED = -0.05;

public static final double ARM_GEAR_RATIO = 30.0;
public static final double ROLLER_GEAR_RATIO = 7.2;
public static final double INTAKE_ANGLE_RAD = 0.0; //TODO: CHANGE THIS PWEASE
public static final double SHOOT_ANGLE_RAD = 0.0; //TODO: CHANGE THIS PWEASE
public static final double IDLE_ANGLE_RAD = 0.0; //TODO: CHANGE THIS PWEASE
public static final double INTAKE_ROLLER_SPEED = 0.0; //TODO: CHANGE THIS PWEASE
public static final double SHOOT_ROLLER_SPEED = 0.0; //TODO: CHANGE THIS PWEASE
public static final double IDLE_ROLLER_SPEED = 0.0; //TODO: CHANGE THIS PWEASE

public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG = new OutliersTalon.ClosedLoopConfiguration();
public static final OutliersTalon.Configuration TOP_CONFIG = new OutliersTalon.Configuration();

static {
CONTROLLER_CONFIG.SLOT = 0;
TOP_CONFIG.TIME_OUT = 0.1;

CONTROLLER_CONFIG.kP = 1.3;
CONTROLLER_CONFIG.kI = 0;
CONTROLLER_CONFIG.kD = 0.0;
CONTROLLER_CONFIG.kF = 0.0;

CONTROLLER_CONFIG.CRUISE_VELOCITY = 50;
CONTROLLER_CONFIG.ACCELERATION = 600;
CONTROLLER_CONFIG.JERK = 3200;
}
}
TOP_CONFIG.NEUTRAL_MODE = NeutralModeValue.Brake;
TOP_CONFIG.INVERTED = InvertedValue.Clockwise_Positive;

// public static class Intake {
// public static final double IN_SPEED = -0.458;
// public static final double OUT_SPEED = 1.0;
// public static final double IDLESPEED = -0.05;
TOP_CONFIG.MAX_VOLTAGE = 12.0;

// public static final OutliersTalon.Configuration TOP_CONFIG = new OutliersTalon.Configuration();

// static {
// TOP_CONFIG.TIME_OUT = 0.1;

// TOP_CONFIG.NEUTRAL_MODE = NeutralModeValue.Brake;
// TOP_CONFIG.INVERTED = InvertedValue.Clockwise_Positive;

// TOP_CONFIG.MAX_VOLTAGE = 12.0;

// TOP_CONFIG.MAX_STATOR_CURRENT = 60;
// TOP_CONFIG.ENABLE_STATOR_CURRENT_LIMIT = true;
// TOP_CONFIG.USE_FOC = true;
// }
TOP_CONFIG.MAX_STATOR_CURRENT = 60;
TOP_CONFIG.ENABLE_STATOR_CURRENT_LIMIT = true;
TOP_CONFIG.USE_FOC = true;
}

// public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG_TOP = new OutliersTalon.ClosedLoopConfiguration();
public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG_TOP = new OutliersTalon.ClosedLoopConfiguration();

// static {
// CONTROLLER_CONFIG_TOP.CRUISE_VELOCITY = 101;
// CONTROLLER_CONFIG_TOP.ACCELERATION = 400;
// CONTROLLER_CONFIG_TOP.JERK = 2500;
// }
static {
CONTROLLER_CONFIG_TOP.CRUISE_VELOCITY = 101;
CONTROLLER_CONFIG_TOP.ACCELERATION = 400;
CONTROLLER_CONFIG_TOP.JERK = 2500;
}

// public static final OutliersTalon.Configuration BOTTOM_CONFIG = new OutliersTalon.Configuration();
public static final OutliersTalon.Configuration BOTTOM_CONFIG = new OutliersTalon.Configuration();

// static {
// TOP_CONFIG.TIME_OUT = 0.1;
static {
TOP_CONFIG.TIME_OUT = 0.1;

// TOP_CONFIG.NEUTRAL_MODE = NeutralModeValue.Brake;
// TOP_CONFIG.INVERTED = InvertedValue.Clockwise_Positive;
TOP_CONFIG.NEUTRAL_MODE = NeutralModeValue.Brake;
TOP_CONFIG.INVERTED = InvertedValue.Clockwise_Positive;

// TOP_CONFIG.MAX_VOLTAGE = 12.0;
TOP_CONFIG.MAX_VOLTAGE = 12.0;

// TOP_CONFIG.MAX_STATOR_CURRENT = 60;
// TOP_CONFIG.ENABLE_STATOR_CURRENT_LIMIT = true;
// TOP_CONFIG.USE_FOC = true;
// }
TOP_CONFIG.MAX_STATOR_CURRENT = 60;
TOP_CONFIG.ENABLE_STATOR_CURRENT_LIMIT = true;
TOP_CONFIG.USE_FOC = true;
}

// public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG_BOTTOM = new OutliersTalon.ClosedLoopConfiguration();
public static final OutliersTalon.ClosedLoopConfiguration CONTROLLER_CONFIG_BOTTOM = new OutliersTalon.ClosedLoopConfiguration();

// static {
// CONTROLLER_CONFIG_TOP.CRUISE_VELOCITY = 101;
// CONTROLLER_CONFIG_TOP.ACCELERATION = 400;
// CONTROLLER_CONFIG_TOP.JERK = 2500;
// }
// }
static {
CONTROLLER_CONFIG_TOP.CRUISE_VELOCITY = 101;
CONTROLLER_CONFIG_TOP.ACCELERATION = 400;
CONTROLLER_CONFIG_TOP.JERK = 2500;
}
}
}
31 changes: 15 additions & 16 deletions src/main/java/org/frc5687/swerret/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import org.frc5687.lib.oi.AxisButton;
import org.frc5687.lib.oi.Gamepad;
import org.frc5687.swerret.commands.*;
import org.frc5687.swerret.commands.CubeShooter.Intake;
import org.frc5687.swerret.commands.CubeShooter.Shoot;
import org.frc5687.swerret.commands.Turret.SetTurretHeadingMod2Pi;
import org.frc5687.swerret.commands.Turret.SetTurretHeadingRaw;
import org.frc5687.swerret.commands.Intake.IntakeIntake;
import org.frc5687.swerret.commands.Intake.Shoot;
import org.frc5687.swerret.subsystems.*;
import org.frc5687.swerret.util.OutliersProxy;

Expand Down Expand Up @@ -49,8 +51,8 @@ public OI() {

public void initializeButtons(
DriveTrain drivetrain,
Turret turret,
CubeShooter cubeShooter) {
Intake intake,
Turret turret) {
_povButtonLeft.whileTrue(new DriveWithSpeeds(drivetrain, 0, 1));
_povButtonRight.whileTrue(new DriveWithSpeeds(drivetrain, 0, -1));
_povButtonUp.whileTrue(new DriveWithSpeeds(drivetrain, 1, 0));
Expand All @@ -69,8 +71,11 @@ public void initializeButtons(
// _operatorGamepad.getYButton().onTrue(new SetTurretHeadingMod2Pi(turret, Math.PI));
// _operatorGamepad.getXButton().onTrue(new SetTurretHeadingMod2Pi(turret, Math.PI / 2));

_driverLeftTrigger.whileTrue(new Intake(cubeShooter));
_driverRightTrigger.whileTrue(new Shoot(cubeShooter));
_operatorGamepad.getRightBumper().whileTrue(new Shoot(intake));
_operatorGamepad.getLeftBumper().whileTrue(new IntakeIntake(intake));

// _driverLeftTrigger.whileTrue(new IntakeIntake(intake));
// _driverRightTrigger.whileTrue(new Shoot(intake));
}

public boolean getSlowMode() {
Expand Down Expand Up @@ -99,16 +104,10 @@ public double getRotationX() {
return speed;
}

public double getTargetTurretHeading() {
double angle = _driverGamepad.getDirectionRadians(
_driverGamepad.getRawAxis(Gamepad.Axes.LEFT_X.getNumber()),
_driverGamepad.getRawAxis(Gamepad.Axes.LEFT_Y.getNumber()));
return angle;
}

public boolean isTargetWithinDeadband() {
return Math.abs(_driverGamepad.getRawAxis(Gamepad.Axes.LEFT_X.getNumber())) < Constants.Turret.TURRET_DEADBAND
&& Math.abs(_driverGamepad.getRawAxis(Gamepad.Axes.LEFT_Y.getNumber())) < Constants.Turret.TURRET_DEADBAND;
public double getTurretX() {
double speed = -getSpeedFromAxis(_operatorGamepad, Gamepad.Axes.RIGHT_X.getNumber());
speed = applyDeadband(speed, Constants.DriveTrain.ROTATION_DEADBAND);
return speed;
}

protected double getSpeedFromAxis(Joystick gamepad, int axisNumber) {
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/org/frc5687/swerret/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import org.frc5687.swerret.commands.Drive;
import org.frc5687.swerret.commands.OutliersCommand;
import org.frc5687.swerret.commands.Auto.DriveForTime;
import org.frc5687.swerret.commands.CubeShooter.IdleCubeShooter;
import org.frc5687.swerret.commands.Turret.SetTurretHeadingContinuous;
import org.frc5687.swerret.commands.Turret.TurretWiggle;
import org.frc5687.swerret.commands.Intake.IdleIntake;
import org.frc5687.swerret.subsystems.*;
import org.frc5687.swerret.util.*;

Expand All @@ -25,7 +24,7 @@ public class RobotContainer extends OutliersContainer {
private Robot _robot;
private DriveTrain _driveTrain;
private Turret _turret;
private CubeShooter _cubeShooter;
private Intake _intake;
// private PhotonProcessor _photonProcessor;
// private Trajectories _trajectories;

Expand Down Expand Up @@ -59,15 +58,14 @@ public void init() {

_driveTrain = new DriveTrain(this, _imu);
// This is for auto temporarily, need to fix for both in future.
_turret = new Turret(this);
_cubeShooter = new CubeShooter(this);
// _turret = new Turret(this);
_intake = new Intake(this);

_oi.initializeButtons(_driveTrain, _turret, _cubeShooter);
_oi.initializeButtons(_driveTrain, _intake, _turret);
// This is for auto temporarily, need to fix for both in future.

// setDefaultCommand(_driveTrain, new Drive(_driveTrain, _oi));
setDefaultCommand(_turret, new SetTurretHeadingContinuous(_driveTrain, _turret, _oi));
// setDefaultCommand(_cubeShooter, new IdleCubeShooter(_cubeShooter));
setDefaultCommand(_driveTrain, new Drive(_driveTrain, _oi));
setDefaultCommand(_intake, new IdleIntake(_intake));

// _visionProcessor.start();
_robot.addPeriodic(this::controllerPeriodic, 0.005, 0.00);
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/frc5687/swerret/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ public class RobotMap {
public static class CAN {

public static class TALONFX {
public static final int NORTH_EAST_OUTER = 1;
public static final int NORTH_WEST_OUTER = 8;
public static final int NORTH_WEST_INNER = 7;
public static final int NORTH_EAST_INNER = 2;
public static final int NORTH_WEST_INNER = 8;
public static final int NORTH_WEST_OUTER = 7;
public static final int SOUTH_WEST_OUTER = 6;
public static final int NORTH_EAST_OUTER = 1;
public static final int SOUTH_EAST_OUTER = 4;
public static final int SOUTH_EAST_INNER = 3;
public static final int SOUTH_WEST_INNER = 5;
public static final int SOUTH_EAST_INNER = 4;
public static final int SOUTH_EAST_OUTER = 3;
public static final int SOUTH_WEST_OUTER = 6;
public static final int TURRET = 9;
public static final int SHOOTER_ARM = 10;
public static final int SHOOTER_ROLLER = 11;
public static final int TOP_INTAKE = 10;
public static final int BOTTOM_INTAKE = 11;
}

public static class PIGEON {
Expand Down

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/org/frc5687/swerret/commands/CubeShooter/Intake.java

This file was deleted.

Loading

0 comments on commit a1b9c6c

Please sign in to comment.