Skip to content

Commit

Permalink
Fix syntax error and format with Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Aug 21, 2024
1 parent 6e1a00c commit d0f75ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/arm/ArmAngle.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ public class ArmAngle {
public static final Rotation2d DROP = Rotation2d.fromDegrees(5);
public static final Rotation2d PODIUM = Rotation2d.fromDegrees(20);
public static final Rotation2d IDLE = Rotation2d.fromDegrees(0);
public static final Rotation2d CLIMBING=Rotation2d.fromDegrees(30);

public static final Rotation2d CLIMBING = Rotation2d.fromDegrees(30);
}
57 changes: 26 additions & 31 deletions src/main/java/frc/robot/arm/ArmSubsystem.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package frc.robot.arm;

import javax.swing.text.Position;

import com.ctre.phoenix6.controls.PositionVoltage;
import com.ctre.phoenix6.controls.VelocityVoltage;
import com.ctre.phoenix6.hardware.TalonFX;

import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap;
import frc.robot.queuer.QueuerState;
import frc.robot.util.scheduling.SubsystemPriority;
import frc.robot.util.state_machines.StateMachine;

Expand All @@ -22,53 +17,53 @@ public class ArmSubsystem extends StateMachine<ArmState> {
private final PositionVoltage positionRequest =
new PositionVoltage(0).withEnableFOC(false).withLimitReverseMotion(false);


public void setAngleToSpeaker(double angle){
public void setAngleToSpeaker(double angle) {
angleToSpeaker = angle;
}
public void setAngleToFeedSpot(double angle){

public void setAngleToFeedSpot(double angle) {
angleToFeedSpot = angle;
}


public ArmSubsystem(TalonFX motor) {
super(SubsystemPriority.ARM, ArmState.IDLE);
this.motor=motor;
speakerDistanceToAngle.put(123.0,321.0);
feedSpotDistanceToAngle.put(123.0,321.0);

this.motor = motor;
speakerDistanceToAngle.put(123.0, 321.0);
feedSpotDistanceToAngle.put(123.0, 321.0);
}
public void setState(ArmState newState){

public void setState(ArmState newState) {
setStateFromRequest(newState);
}
public boolean atGoal(){
return switch (getState()){
case IDLE->MathUtil.isNear.(ArmAngle.IDLE.getDegrees(),armAngle,1);
case SPEAKER_SHOT->MathUtil.isNear(speakerDistanceToAngle.get(angleToSpeaker),armAngle,1);
case DROP->MathUtil.isNear(ArmAngle.DROP,armAngle,1);
case SUBWOOFER_SHOT->MathUtil.isNear(ArmAngle.SUBWOOFER,armAngle,1);
case FEEDING->MathUtil.isNear(feedSpotDistanceToAngle.get(angleToFeedSpot),armAngle,1);
case PODIUM_SHOT->MathUtil.isNear(ArmAngle.PODIUM,armAngle,1);
case CLIMBING->MathUtil.isNear(ArmAngle.CLIMBING,armAngle,1);

public boolean atGoal() {
return switch (getState()) {
case IDLE -> MathUtil.isNear(ArmAngle.IDLE.getDegrees(), armAngle, 1);
case SPEAKER_SHOT -> MathUtil.isNear(speakerDistanceToAngle.get(angleToSpeaker), armAngle, 1);
case DROP -> MathUtil.isNear(ArmAngle.DROP, armAngle, 1);
case SUBWOOFER_SHOT -> MathUtil.isNear(ArmAngle.SUBWOOFER, armAngle, 1);
case FEEDING -> MathUtil.isNear(feedSpotDistanceToAngle.get(angleToFeedSpot), armAngle, 1);
case PODIUM_SHOT -> MathUtil.isNear(ArmAngle.PODIUM, armAngle, 1);
case CLIMBING -> MathUtil.isNear(ArmAngle.CLIMBING, armAngle, 1);
};
}

@Override
protected void collectInputs(){
armAngle = motor.getPosition().getValueAsDouble();//is get position get angle??
protected void collectInputs() {
armAngle = motor.getPosition().getValueAsDouble(); // is get position get angle??
}

@Override
protected void afterTransition(ArmState newState){
switch(newState){
protected void afterTransition(ArmState newState) {
switch (newState) {
case IDLE -> motor.disable();
case CLIMBING->motor.setControl(positionRequest.withPosition(ArmAngle.CLIMBING));
case DROP->motor.setControl(positionRequest.withPosition(ArmAngle.DROP));
case CLIMBING -> motor.setControl(positionRequest.withPosition(ArmAngle.CLIMBING));
case DROP -> motor.setControl(positionRequest.withPosition(ArmAngle.DROP));
}
}

@Override
public void robotPeriodic(){
public void robotPeriodic() {
super.robotPeriodic();
}

}

0 comments on commit d0f75ff

Please sign in to comment.