|
9 | 9 | import java.util.Optional; |
10 | 10 |
|
11 | 11 | import com.ctre.phoenix6.configs.CANcoderConfiguration; |
| 12 | +import com.ctre.phoenix6.configs.CANrangeConfiguration; |
12 | 13 | import com.ctre.phoenix6.configs.TalonFXConfiguration; |
13 | 14 | import com.ctre.phoenix6.signals.GravityTypeValue; |
14 | 15 | import com.ctre.phoenix6.signals.InvertedValue; |
15 | 16 | import com.ctre.phoenix6.signals.NeutralModeValue; |
16 | 17 | import com.ctre.phoenix6.signals.SensorDirectionValue; |
17 | 18 | import com.ctre.phoenix6.signals.StaticFeedforwardSignValue; |
| 19 | +import com.ctre.phoenix6.signals.UpdateModeValue; |
18 | 20 | import com.frcteam3255.components.swerve.SN_SwerveConstants; |
19 | 21 | import com.pathplanner.lib.config.ModuleConfig; |
20 | 22 | import com.pathplanner.lib.config.PIDConstants; |
@@ -221,6 +223,57 @@ public static class constIntake { |
221 | 223 | // TODO: Replace with actual measurements |
222 | 224 | public static final Current ALGAE_INTAKE_HAS_GP_CURRENT = Units.Amps.of(15); |
223 | 225 | public static final AngularVelocity ALGAE_INTAKE_HAS_GP_VELOCITY = Units.RotationsPerSecond.of(2102 / 60); |
| 226 | + public static final TalonFXConfiguration INTAKE_PIVOT_CONFIG = new TalonFXConfiguration(); |
| 227 | + public static final TalonFXConfiguration ALGAE_INTAKE_CONFIG = new TalonFXConfiguration(); |
| 228 | + public static final TalonFXConfiguration CORAL_INTAKE_CONFIG = new TalonFXConfiguration(); |
| 229 | + public static final CANrangeConfiguration CORAL_INTAKE_SENSOR_CONFIG = new CANrangeConfiguration(); |
| 230 | + |
| 231 | + static { |
| 232 | + // intake pivot motor |
| 233 | + INTAKE_PIVOT_CONFIG.MotorOutput.NeutralMode = NeutralModeValue.Brake; |
| 234 | + INTAKE_PIVOT_CONFIG.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive; |
| 235 | + |
| 236 | + INTAKE_PIVOT_CONFIG.SoftwareLimitSwitch.ForwardSoftLimitEnable = true; |
| 237 | + INTAKE_PIVOT_CONFIG.SoftwareLimitSwitch.ForwardSoftLimitThreshold = Units.Rotations.of(57) |
| 238 | + .in(Units.Degrees); |
| 239 | + INTAKE_PIVOT_CONFIG.SoftwareLimitSwitch.ReverseSoftLimitEnable = true; |
| 240 | + INTAKE_PIVOT_CONFIG.SoftwareLimitSwitch.ReverseSoftLimitThreshold = Units.Rotations.of(-37) |
| 241 | + .in(Units.Degrees); |
| 242 | + |
| 243 | + INTAKE_PIVOT_CONFIG.Feedback.SensorToMechanismRatio = 1000 / 27;// just like intake pivot, we still need |
| 244 | + // to get the ratio from fab |
| 245 | + INTAKE_PIVOT_CONFIG.Slot0.GravityType = GravityTypeValue.Arm_Cosine; |
| 246 | + INTAKE_PIVOT_CONFIG.Slot0.StaticFeedforwardSign = StaticFeedforwardSignValue.UseClosedLoopSign; |
| 247 | + |
| 248 | + INTAKE_PIVOT_CONFIG.MotionMagic.MotionMagicCruiseVelocity = 9999; |
| 249 | + INTAKE_PIVOT_CONFIG.MotionMagic.MotionMagicAcceleration = 9999; |
| 250 | + |
| 251 | + INTAKE_PIVOT_CONFIG.CurrentLimits.SupplyCurrentLimitEnable = true; |
| 252 | + INTAKE_PIVOT_CONFIG.CurrentLimits.SupplyCurrentLowerLimit = 30; |
| 253 | + INTAKE_PIVOT_CONFIG.CurrentLimits.SupplyCurrentLimit = 45; |
| 254 | + INTAKE_PIVOT_CONFIG.CurrentLimits.SupplyCurrentLowerTime = 0.5; |
| 255 | + |
| 256 | + // algae intake motor config |
| 257 | + ALGAE_INTAKE_CONFIG.MotorOutput.NeutralMode = NeutralModeValue.Brake; |
| 258 | + ALGAE_INTAKE_CONFIG.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive; |
| 259 | + |
| 260 | + ALGAE_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLimitEnable = true; |
| 261 | + ALGAE_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLowerLimit = 30; |
| 262 | + ALGAE_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLimit = 60; |
| 263 | + ALGAE_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLowerTime = 0.5; |
| 264 | + // coral intake motor config |
| 265 | + CORAL_INTAKE_CONFIG.MotorOutput.NeutralMode = NeutralModeValue.Brake; |
| 266 | + CORAL_INTAKE_CONFIG.MotorOutput.Inverted = InvertedValue.CounterClockwise_Positive; |
| 267 | + |
| 268 | + CORAL_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLimitEnable = true; |
| 269 | + CORAL_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLowerLimit = 30; |
| 270 | + CORAL_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLimit = 60; |
| 271 | + CORAL_INTAKE_CONFIG.CurrentLimits.SupplyCurrentLowerTime = 0.5; |
| 272 | + // coral intake sensor config |
| 273 | + CORAL_INTAKE_SENSOR_CONFIG.ToFParams.UpdateMode = UpdateModeValue.ShortRange100Hz; |
| 274 | + CORAL_INTAKE_SENSOR_CONFIG.ProximityParams.ProximityThreshold = Units.Inches.of(3.95).in(Units.Meters); |
| 275 | + } |
| 276 | + |
224 | 277 | } |
225 | 278 |
|
226 | 279 | public static class constField { |
|
0 commit comments