Skip to content

Commit

Permalink
Wpiformat
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriae committed Jan 25, 2024
1 parent ad00f6f commit 972ddaa
Show file tree
Hide file tree
Showing 34 changed files with 54 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .pathplanner/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"defaultMaxAngVel": 180.0,
"defaultMaxAngAccel": 360.0,
"maxModuleSpeed": 4.67
}
}
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ generatedFileExclude {

modifiableFileExclude {
\.png$
\.chrp$
}

licenseUpdateExclude {
Expand Down
2 changes: 1 addition & 1 deletion elastic-layout.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/MAZE AUTO.auto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
},
"folder": null,
"choreoAuto": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
},
"folder": null,
"choreoAuto": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/New Auto.auto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
},
"folder": null,
"choreoAuto": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/amp.auto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
},
"folder": null,
"choreoAuto": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/spin.auto
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
},
"folder": null,
"choreoAuto": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/ultra amp.auto
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
},
"folder": null,
"choreoAuto": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/navgrid.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/Maze copy.path
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/New New New Path.path
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/amp path.path
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/spin pt 1.path
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/spin pt 2.path
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/ultra amp path pt.1.path
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/ultra amp path pt.2.path
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
}
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static class Physical {
public static final double SHOOTER_FLYWHEEL_CIRCUMFERENCE = 2 * Math.PI * SHOOTER_FLYWHEEL_RADIUS;

public static final double ELEVATOR_GEAR_RATIO = 27;

public static final double SHOOTER_HEIGHT_STOWED = 0; //TODO: Get this value

public static final SwerveDriveKinematics SWERVE_KINEMATICS = new SwerveDriveKinematics(
Expand Down Expand Up @@ -131,7 +131,7 @@ public static class FieldConstants {
public static final AprilTagFieldLayout APRILTAG_LAYOUT = UtilFuncs.MakeField();

public static final double SPEAKER_HEIGHT = .200;

public static final int SPEAKER_TAG_BLUE = 7;
public static final int SPEAKER_TAG_RED = 4;

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/frc/robot/commands/elevator/HoldElevator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.commands.elevator;

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/frc/robot/commands/elevator/SetElevator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.commands.elevator;

Expand All @@ -16,7 +15,7 @@
public class SetElevator extends Command {
/**
* Creates a new SetElevator.
*
*
* @param height The double supplier that returns the desired height of the elevator in meters.
*/
private final ElevatorSubsystem _elevator;
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/frc/robot/commands/shooter/AngleShooter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.commands.shooter;

Expand Down Expand Up @@ -34,7 +33,7 @@ public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute(

) {}

// Called once the command ends or is interrupted.
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/frc/robot/commands/shooter/AutoAim.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.commands.shooter;

Expand All @@ -11,7 +10,6 @@
import frc.robot.subsystems.VisionSubsystem;

public class AutoAim extends Command {

private ShooterSubsystem _shooter;
private VisionSubsystem _vision;
private SwerveDriveSubsystem _swerve;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/frc/robot/commands/shooter/HoldShooter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.commands.shooter;

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/frc/robot/subsystems/ElevatorSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.revrobotics.CANSparkLowLevel.MotorType;

public class ElevatorSubsystem extends SubsystemBase {

private final CANSparkMax _leftMotor = new CANSparkMax(Constants.CAN.ELEVATOR_LEFT, MotorType.kBrushless);
private final CANSparkMax _rightMotor = new CANSparkMax(Constants.CAN.ELEVATOR_RIGHT, MotorType.kBrushless);

Expand All @@ -29,7 +28,6 @@ public ElevatorSubsystem() {

@Override
public void periodic() {

// This method will be called once per scheduler run
//harry chen code maybe fix
// setMotor(elevatorFeed.calculate(0));
Expand All @@ -47,7 +45,7 @@ public boolean atDesiredHeight() {
*/
public void setElevatorHeight(double heightMeters) {
driveElevator(
_heightController.calculate(getElevatorHeight(), heightMeters) + _elevatorFeed.calculate(0)
_heightController.calculate(getElevatorHeight(), heightMeters) + _elevatorFeed.calculate(0)
);
}

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ShooterSubsystem() {
NeoConfig.configureFollowerNeo(_rightMotor, _leftMotor, true);
}

@Override
@Override
public void periodic() {
// This method will be called once per scheduler run
}
Expand All @@ -62,12 +62,10 @@ public double getAngle() {

/** Drives the angle motors at the desired percent output */
public void driveAngle(double speed) {

}

/** Stops the angle motors completely, should be called with caution. */
public void stopAngle() {

}

/** Get the velocity of the back wheel (left side) in m/s. */
Expand Down Expand Up @@ -96,4 +94,3 @@ public void stopShooter() {
_leftMotor.set(0);
}
}

15 changes: 7 additions & 8 deletions src/main/java/frc/robot/subsystems/SwerveDriveSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class SwerveDriveSubsystem extends SubsystemBase {

/** A boolean for whether the swerve is field oriented or not. */
public boolean fieldOriented = false;

StructArrayPublisher<SwerveModuleState> publisher = NetworkTableInstance.getDefault().getStructArrayTopic("MyStates", SwerveModuleState.struct).publish();

// private final SysIdRoutine _sysID = new SysIdRoutine(
Expand Down Expand Up @@ -175,7 +175,7 @@ public SwerveDriveSubsystem(VisionSubsystem visionSubsystem) {
return true;
}
return false;
},
},
this
);
SmartDashboard.putData("Swerve Drive", new Sendable() {
Expand Down Expand Up @@ -206,20 +206,19 @@ public void initSendable(SendableBuilder builder) {
builder.addDoubleProperty("Pose", () -> getHeading().getDegrees(), null);
}
});


}

@Override
public void periodic() {

publisher.set(states);

// This method will be called once per scheduler run
// SmartDashboard.putNumber("Gyro", getHeading().getDegrees());
SmartDashboard.putBoolean("Field Oriented", fieldOriented);



_frontLeft.displayInfo();
_frontRight.displayInfo();
Expand Down Expand Up @@ -374,7 +373,7 @@ public Rotation2d getHeadingRaw() {
return Rotation2d.fromDegrees(-Math.IEEEremainder(_gyro.getHeading(), 360));
}

/**
/**
* Get the shooter's angle to the speaker hole using the drive's pose estimator.
*/
public double shooterAngleToSpeaker() {
Expand All @@ -391,10 +390,10 @@ public double shooterAngleToSpeaker() {
}

double distnaceToRobot = Math.sqrt(Math.pow(xDifference, 2) + Math.pow(yDifference, 2));

double zDifference = FieldConstants.SPEAKER_HEIGHT - Constants.Physical.SHOOTER_HEIGHT_STOWED;

double angle = Math.atan(zDifference/distnaceToRobot);
double angle = Math.atan(zDifference/distnaceToRobot);
return angle;
}
}
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/VisionSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public Optional<Pose2d> get_botpose() {
Rotation2d botposeRotation = new Rotation2d(botposeYaw);

Pose2d botPose2D = new Pose2d(botposeX, botposeY, botposeRotation);

return Optional.of(botPose2D);
}
}
}

public boolean isApriltagVisible() {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/utils/LimelightHelper.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Team 334 */
/* Copyright (c) 2024 Team 334. All Rights Reserved. */

package frc.robot.utils;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/utils/SwerveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public SwerveModule(
// encoderConfig.MagnetOffset = (angleOffset / 180) / 2;

_encoder = new CANcoder(encoderId);

// _encoder.getConfigurator().apply(encoderConfig);

_name = name;
Expand Down Expand Up @@ -90,7 +90,7 @@ public void displayInfo() {

/**
* Get the talons belonging to this module as an array.
*
*
* @return [drive talon, rotation talon]
*/
public TalonFX[] getTalons() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/utils/UtilFuncs.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static double ApplyDeadband(double val, double deadband) {
/**
* Control a motor controller with voltage by converting a voltage output into
* percent output with a scale factor.
*
*
* @param volts The voltage output.
* @return The percent output to set the controller to.
*/
Expand All @@ -50,8 +50,8 @@ public static DriverStation.Alliance getCurrentAlliance() {
}

/**
*
*
*
*
* @return
*/
public static AprilTagFieldLayout MakeField() {
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/PathplannerLib.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
]
}
]
}
}

0 comments on commit 972ddaa

Please sign in to comment.