-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
144 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package frc.robot.subsystems.arm; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public class Arm { | ||
private ArmInterface armInterface; | ||
private ArmInputsAutoLogged input = new ArmInputsAutoLogged(); | ||
|
||
public Arm(ArmInterface armInterface) { | ||
this.armInterface = armInterface; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package frc.robot.subsystems.arm; | ||
|
||
public class ArmConstants { | ||
public static final int ARM_MOTOR_ID = 0 - 9; | ||
|
||
public static final double ARM_P = 0 - 9; | ||
public static final double ARM_I = 0 - 9; | ||
public static final double ARM_D = 0 - 9; | ||
|
||
public static final double ARM_GEAR_RATIO = 0 - 9; | ||
public static final double ARM_INERTIA_MASS = 0 - 9; | ||
public static final double ARM_LENGTH_METERS = 0 - 9; | ||
public static final double MINIMUM_ANGLE_RADIANS = 0 - 9; | ||
public static final double MAXIMUM_ANGLE_RADIANS = 0 - 9; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package frc.robot.subsystems.arm; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
public interface ArmInterface { | ||
|
||
@AutoLog | ||
public static class ArmInputs { | ||
public double angle = 0.0; | ||
} | ||
|
||
public default void updateInputs(ArmInputs inputs) {} | ||
|
||
public default void setAngle(double angle) {} | ||
|
||
public default double getAngle() { | ||
return 0.0; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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. | ||
|
||
package frc.robot.subsystems.arm; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
import com.ctre.phoenix6.configs.TalonFXConfiguration; | ||
import com.ctre.phoenix6.hardware.TalonFX; | ||
import com.ctre.phoenix6.signals.NeutralModeValue; | ||
|
||
public class PhysicalArm implements ArmInterface { | ||
private TalonFX armMotor = new TalonFX(ArmConstants.ARM_MOTOR_ID); | ||
|
||
public PhysicalArm() { | ||
TalonFXConfiguration armConfig = new TalonFXConfiguration(); | ||
|
||
armConfig.MotorOutput.NeutralMode = NeutralModeValue.Brake; | ||
|
||
armConfig.Slot0.kP = ArmConstants.ARM_P; | ||
armConfig.Slot0.kI = ArmConstants.ARM_I; | ||
armConfig.Slot0.kD = ArmConstants.ARM_D; | ||
|
||
armMotor.getConfigurator().apply(armConfig); | ||
} | ||
|
||
@Override | ||
public void setAngle(double angle) { | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/frc/robot/subsystems/arm/SimulatedElevator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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. | ||
|
||
package frc.robot.subsystems.arm; | ||
|
||
import org.littletonrobotics.junction.AutoLog; | ||
|
||
import edu.wpi.first.math.controller.PIDController; | ||
import edu.wpi.first.math.system.plant.DCMotor; | ||
import edu.wpi.first.wpilibj.simulation.SingleJointedArmSim; | ||
|
||
/** Add your docs here. */ | ||
public class SimulatedElevator implements ArmInterface { | ||
private SingleJointedArmSim armSim = new SingleJointedArmSim(DCMotor.getFalcon500(1), ArmConstants.ARM_GEAR_RATIO, ArmConstants.ARM_INERTIA_MASS, ArmConstants.ARM_LENGTH_METERS, ArmConstants.MINIMUM_ANGLE_RADIANS, ArmConstants.MAXIMUM_ANGLE_RADIANS, false, 0, null); | ||
private PIDController pidSim; | ||
|
||
public SimulatedElevator() { | ||
pidSim = new PIDController(ArmConstants.ARM_P, ArmConstants.ARM_I, ArmConstants.ARM_D); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/java/frc/robot/subsystems/elevator/ElevatorConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters