-
Notifications
You must be signed in to change notification settings - Fork 3
test #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bad-intake
Are you sure you want to change the base?
test #17
Changes from all commits
a9473d8
b4acc19
b2db648
18c840d
d6fa14d
9b6e9d3
37356ce
15e78d0
1f15e15
5750ec3
e5620d6
d133067
faba953
5fd10e4
3991ba5
1af1595
cd2edf5
04e7f1c
67553d1
1c58b7e
64b30ec
df466bc
3a0a52e
97eebb1
3e8acd0
283d34d
c1d3cdd
3a9a85d
7d60dd1
725a114
936b2af
248332b
55b8bb2
00300d0
0cf2f77
2c77761
151cf8f
c74e58f
8df2b1b
953d51c
9a7366e
c00cc6c
5cda037
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package frc.robot; | ||
| import edu.wpi.first.math.system.plant.DCMotor; | ||
| import edu.wpi.first.math.util.Units; | ||
|
|
||
| public class KrakenX44 { | ||
| public static DCMotor getX44(int numMotors) { | ||
| return new DCMotor( | ||
| 12, 4.05, 275, 1.4, Units.rotationsPerMinuteToRadiansPerSecond(7530), numMotors); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
| import com.ctre.phoenix6.swerve.SwerveRequest; | ||
|
|
||
| import edu.wpi.first.math.geometry.Rotation2d; | ||
| import edu.wpi.first.units.measure.Angle; | ||
| import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d; | ||
| import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; | ||
| import edu.wpi.first.wpilibj2.command.Command; | ||
|
|
@@ -20,10 +21,15 @@ | |
| import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction; | ||
|
|
||
| import frc.robot.generated.TunerConstants; | ||
| import frc.robot.subsystems.ArmS; | ||
| import frc.robot.subsystems.CommandSwerveDrivetrain; | ||
| import frc.robot.subsystems.IntakePivotS; | ||
| import frc.robot.subsystems.IntakeRollerS; | ||
| import frc.robot.subsystems.ElevatorS; | ||
| import frc.robot.subsystems.HandS; | ||
|
|
||
| import frc.robot.subsystems.HandS.HandConstants; | ||
|
|
||
| import frc.robot.subsystems.YAMSIntakePivot; | ||
| import frc.robot.subsystems.YAMSIntakeRollerS; | ||
|
|
||
| public class RobotContainer { | ||
| private double MaxSpeed = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed | ||
|
|
@@ -43,27 +49,39 @@ public class RobotContainer { | |
|
|
||
| public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain(); | ||
|
|
||
| public final IntakePivotS intakePivot = new IntakePivotS(); | ||
| //public final IntakePivotS intakePivot = new IntakePivotS(); | ||
|
|
||
| // public final IntakeRollerS intakeRoller = new IntakeRollerS(); | ||
| public final YAMSIntakeRollerS intakeRoller = new YAMSIntakeRollerS(); | ||
|
|
||
| public final HandS handRoller = new HandS(); | ||
|
|
||
| public final ArmS Arm = new ArmS(); | ||
|
|
||
| public final ElevatorS elevator = new ElevatorS(); | ||
|
|
||
| public final YAMSIntakePivot yIntakePivot = new YAMSIntakePivot(); | ||
|
|
||
| private Mechanism2d VISUALIZER; | ||
|
|
||
| public final IntakeRollerS intakeRoller = new IntakeRollerS(); | ||
|
|
||
| private Mechanism2d VISUALIZER; | ||
|
|
||
| public RobotContainer() { | ||
| VISUALIZER = logger.MECH_VISUALIZER; | ||
| logger.addIntake(intakePivot.IntakePivotVisualizer); | ||
|
|
||
| configureBindings(); | ||
| SmartDashboard.putData("Visualzer", VISUALIZER); | ||
| SmartDashboard.putData("Visualizer", VISUALIZER); | ||
| } | ||
|
|
||
| private void configureBindings() { | ||
| // Note that X is defined as forward according to WPILib convention, | ||
| // and Y is defined as to the left according to WPILib convention. | ||
| drivetrain.setDefaultCommand( | ||
| // Drivetrain will execute this command periodically | ||
| drivetrain.applyRequest(() -> drive.withVelocityX(-joystick.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward) | ||
| drivetrain.applyRequest(() -> drive.withVelocityX(-joystick.getLeftY() * MaxSpeed) // Drive forward with | ||
| // negative Y | ||
| // (forward) | ||
| .withVelocityY(-joystick.getLeftX() * MaxSpeed) // Drive left with negative X (left) | ||
| .withRotationalRate(-joystick.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left) | ||
| .withRotationalRate(-joystick.getRightX() * MaxAngularRate) // Drive counterclockwise with | ||
| // negative X (left) | ||
| )); | ||
|
|
||
| // Idle while the robot is disabled. This ensures the configured | ||
|
|
@@ -72,62 +90,64 @@ private void configureBindings() { | |
| RobotModeTriggers.disabled().whileTrue( | ||
| drivetrain.applyRequest(() -> idle).ignoringDisable(true)); | ||
|
|
||
| joystick.a().onTrue(intakeRoller.coralIntake()); | ||
| joystick.x().whileTrue(intakePivot.moveToAngle(IntakePivotS.IntakePivotConstants.SOME_ANGLE)); | ||
| // joystick.y().whileTrue(intakePivot.slapUp()); | ||
| joystick.b().whileTrue(intakeRoller.outTakeRollers()); | ||
| /* | ||
| * joystick.a().whileTrue(drivetrain.applyRequest(() -> brake)); | ||
| * l1-score-and-intake-merge | ||
| * joystick.b().whileTrue(drivetrain.applyRequest(() -> | ||
| * point.withModuleDirection(new Rotation2d(-joystick.getLeftY(), | ||
| * -joystick.getLeftX())) | ||
| * )); | ||
| * | ||
| * // Run SysId routines when holding back/start and X/Y. | ||
| * // Note that each routine should be run exactly once in a single log. | ||
| * joystick.back().and(joystick.y()).whileTrue(drivetrain.sysIdDynamic(Direction | ||
| * .kForward)); | ||
| * joystick.back().and(joystick.x()).whileTrue(drivetrain.sysIdDynamic(Direction | ||
| * .kReverse)); | ||
| * joystick.start().and(joystick.y()).whileTrue(drivetrain.sysIdQuasistatic( | ||
| * Direction.kForward)); | ||
| * joystick.start().and(joystick.x()).whileTrue(drivetrain.sysIdQuasistatic( | ||
| * Direction.kReverse)); | ||
| * | ||
| * // reset the field-centric heading on left bumper press | ||
| * joystick.leftBumper().onTrue(drivetrain.runOnce(() -> | ||
| * drivetrain.seedFieldCentric())); | ||
| * | ||
| * drivetrain.registerTelemetry(logger::telemeterize); | ||
| * | ||
| * joystick.x().whileTrue(intakePivot.slapDown()); | ||
| * | ||
| * joystick.y() | ||
| * .whileTrue(intakeRoller.intakeRollers()) // Start rollers while the button is | ||
| * pressed | ||
| * .onFalse(intakeRoller.stopRollers()); // Stop rollers when the button is | ||
| * released/* | ||
| */ | ||
| drivetrain.registerTelemetry(logger::telemeterize); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| * public Command Intake() { | ||
| * return Commands.parallel(intakePivot.slapDown(),intakeRoller.intakeRollers()) | ||
| * .until(()->intakeRoller.getCurrent() > 10).andThen(intakePivot.slapUp()); | ||
| * } | ||
| * | ||
| * public Command IntakeRollersStartCommand() { | ||
| * return( | ||
| * new ScheduleCommand(intakeRoller.intakeRollersStart())); | ||
| * | ||
| * } | ||
| */ | ||
| //set button bindings | ||
| joystick.a().onTrue(intakeCoral()); | ||
| joystick.b().onTrue(Handoff()); | ||
| joystick.x().onTrue(Stow()); | ||
| joystick.y().whileTrue(L1Score()); | ||
| joystick.rightBumper().whileTrue(elevator.setHeight(Inches.of(70))); | ||
| joystick.rightBumper().whileTrue(elevator.setHeight(Inches.of(12))); | ||
|
|
||
|
|
||
| drivetrain.registerTelemetry(logger::telemeterize); | ||
|
|
||
| } | ||
|
|
||
| public Command getAutonomousCommand() { | ||
| return Commands.print("No autonomous command configured"); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| //Commands combining multiple subsystem functions | ||
| public Command intakeCoral() { | ||
| return Commands.race(yIntakePivot.setAngle(yIntakePivot.DOWN_ANGLE), intakeRoller.coralIntake()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- RobotContainer.java relevant region ---'
sed -n '80,135p' src/main/java/frc/robot/RobotContainer.java
printf '%s\n' '--- direct declarations and call sites ---'
rg -n -C 4 'intakeCoral|coralIntake|setAngle|DOWN_ANGLE|Commands\.(race|parallel|deadline|alongWith)' src/main/java
printf '%s\n' '--- focused diff ---'
git diff -- src/main/java/frc/robot/RobotContainer.javaRepository: frc6995/OffSeasonBot-2025 Length of output: 12907 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- RobotContainer imports and command wiring ---'
sed -n '1,45p' src/main/java/frc/robot/RobotContainer.java
sed -n '108,122p' src/main/java/frc/robot/RobotContainer.java
printf '%s\n' '--- YAMSIntakeRollerS implementation ---'
sed -n '1,155p' src/main/java/frc/robot/subsystems/YAMSIntakeRollerS.java
printf '%s\n' '--- YAMSIntakePivot and ArmS command implementations ---'
sed -n '100,130p' src/main/java/frc/robot/subsystems/YAMSIntakePivot.java
sed -n '95,135p' src/main/java/frc/robot/subsystems/ArmS.java
printf '%s\n' '--- project WPILib dependency/version declarations ---'
rg -n -C 3 'wpilib|wpilibj|202[0-9]\\.\\d+\\.\\d+|Commands\\.race|Commands\\.parallel' build.gradle gradle.properties vendordeps src 2>/dev/nullRepository: frc6995/OffSeasonBot-2025 Length of output: 25254 🌐 Web query:
💡 Result: In the WPILib Java command-based framework, the Citations:
Use a completion composition that waits for both intake operations. 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| public Command Stow() { | ||
| return yIntakePivot.setAngle(yIntakePivot.L1_ANGLE); | ||
| } | ||
| public Command L1Score() { | ||
| return intakeRoller.outTakeRollers(); | ||
| } | ||
|
|
||
| public Command Handoff() { | ||
| return yIntakePivot.setAngle(yIntakePivot.HANDOFF_ANGLE); | ||
| } | ||
| /* | ||
| public Command Arm_L2scoring(){ | ||
| return Arm.moveToAngle(PivotConstants.SCORE_ANGLE_L2); | ||
| } | ||
| public Command Arm_L3Scoring(){ | ||
| return Arm.moveToAngle(PivotConstants.SCORE_ANGLE_L3); | ||
| } | ||
| public Command Arm_L4Scoring(){ | ||
| return Arm.setAngle(Arm.SCORE_ANGLE_L4); | ||
| } | ||
| public Command Arm_Hand_Off_Angle(){ | ||
| return Arm.setAngle(Arm.HANDOFF_ANGLE); | ||
| /* */ | ||
|
|
||
| public Command Hand_Voltage_Scoring(){ | ||
| return handRoller.setHandRollerVoltage(HandConstants.HAND_ROLLER_OUT_VOLTAGE); | ||
| } | ||
| public Command Hand_Rollers_In(){ | ||
| return handRoller.HandCoralIntake(); | ||
| } | ||
| public Command Arm_Scoring_postion(){ | ||
| return Arm.setAngle(Arm.SOME_ANGLE); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| public Command getAutonomousCommand() { | ||
| return Commands.print("No autonomous command configured"); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 22573
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 4889
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 6180
🌐 Web query:
YAMS 2025.9.8 Java Elevator setHeight source requirements WPILib💡 Result:
In the YAMS (Yet-Another-Software-Suite) library, the Elevator mechanism provides a fluent API for controlling height. The setHeight method is a command factory that returns a WPILib Command to move the elevator to a specific position [1][2]. Source Requirements and Usage: 1. Configuration: You must create an ElevatorConfig object, which requires an underlying SmartMotorController [1][3]. The configuration should specify parameters such as the carriage mass, drum radius, and hard limits (minimum and maximum height) [3][4]. 2. Constructor: Instantiate the Elevator subsystem by passing the configured ElevatorConfig object to the constructor [2][4]. 3. Command Execution: Use the setHeight(Distance height) or setHeight(Supplier height) methods to generate a Command that can be scheduled [1]. For example: elevator.setHeight(Meters.of(1.2)).schedule; The YAMS library abstracts the underlying WPILib calls, handling the conversion to motor controller setpoints automatically based on the provided configuration [2][5]. Note that while standard WPILib provides ElevatorSim for physical simulation (requiring parameters like gearbox, gearing, and mass) [6][7], YAMS handles these simulations internally through the Elevator mechanism's simulation methods (e.g., simIterate) when configured correctly [8][4]. For complete implementation, ensure your motor controllers are properly initialized with closed-loop constants (PID and feedforward) within the SmartMotorControllerConfig, as the YAMS Elevator relies on these for positional accuracy [1][3].
Citations:
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 12772
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 13183
🏁 Script executed:
Repository: frc6995/OffSeasonBot-2025
Length of output: 3422
🌐 Web query:
WPILib 2025 Trigger whileTrue same trigger command scheduling order CommandScheduler requirements interruption behavior Java💡 Result:
In the WPILib command-based framework, the
whileTruetrigger binding schedules a command when a trigger transitions fromfalsetotrue(e.g., a button press) and cancels the command when the trigger transitions fromtruetofalse(e.g., button release) [1][2]. Scheduling and Requirements: 1. Trigger Evaluation: TheCommandSchedulerpolls registered triggers during each iteration [3][4]. 2. Command Scheduling: When the trigger conditions forwhileTrueare met, the scheduler attempts to add the command to the list of running commands [3][4]. 3. Requirements Check: If the command requires subsystems already in use by other commands, the scheduler checks theInterruptionBehaviorof the currently running command(s) [3][5][4]. Interruption Behavior: - Default (kCancelSelf): If a new command with conflicting requirements is scheduled, the currently running command is interrupted; itsend(true)method is invoked before the new command'sinitialize()method [3][5][6]. -kCancelIncoming: If a running command has this interruption behavior, it will not be interrupted; the new command's scheduling attempt will be aborted [5][7]. - Manual Cancellation: Regardless of theInterruptionBehaviorsetting, any command can be explicitly canceled, which will trigger itsend(true)method [5][8]. Scheduling Order and Lifecycle: - The command bound towhileTruewill not automatically restart if it finishes naturally while the trigger is still held in thetruestate [1][2]. To achieve re-scheduling behavior, you should wrap the command in aRepeatCommandor use aRunCommand[1][9]. - When the scheduler handles requirement conflicts, it processes commands in the order they were scheduled [3][6]. When an interruption occurs, theend(true)method of the interrupted command is executed before theinitialize()method of the incoming command [3][6][4].Citations:
Bind only one elevator command to
joystick.rightBumper().Both
ElevatorS.setHeight(...)commands create YAMSCommands.runcommands that require the sameElevatorSsubsystem. When the right bumper becomes active, the scheduler can cancel one command when it schedules the other. The two height targets therefore cannot run concurrently, so the 70-inch target may be superseded by the 12-inch target. Use a different trigger or an explicit mode condition.🤖 Prompt for AI Agents