Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ tasks {

from({ sourceSets.main.get().allSource })
}

register<JavaExec>("replayWatch", JavaExec::class.java) {
mainClass = "org.littletonrobotics.junction.ReplayWatch"
classpath = sourceSets.main.get().runtimeClasspath
}
}

gversion {
Expand Down
27 changes: 9 additions & 18 deletions src/main/kotlin/org/frc5183/robot/Robot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import edu.wpi.first.hal.FRCNetComm
import edu.wpi.first.hal.HAL
import edu.wpi.first.math.geometry.Pose2d
import edu.wpi.first.units.Units
import edu.wpi.first.wpilibj.RobotBase
import edu.wpi.first.wpilibj.Threads
import edu.wpi.first.wpilibj.util.WPILibVersion
import edu.wpi.first.wpilibj2.command.CommandScheduler
import org.frc5183.robot.commands.drive.TeleopDriveCommand
import org.frc5183.robot.constants.*
import org.frc5183.robot.constants.swerve.SwerveConstants
import org.frc5183.robot.constants.swerve.SwervePIDConstants
import org.frc5183.robot.subsystems.drive.SwerveDriveSubsystem
import org.frc5183.robot.subsystems.drive.io.RealSwerveDriveIO
import org.frc5183.robot.subsystems.drive.io.SimulatedSwerveDriveIO
import org.littletonrobotics.junction.LoggedRobot
import org.littletonrobotics.junction.Logger
import swervelib.SwerveDrive
Expand Down Expand Up @@ -47,20 +42,16 @@ object Robot : LoggedRobot() {

Logger.start()

val swerve =
SwerveDrive(
SwerveConstants.YAGSL,
SwerveConstants.YAGSL_CONTROLLER_CONFIG,
PhysicalConstants.MAX_VELOCITY.`in`(Units.MetersPerSecond),
Pose2d.kZero,
)

drive =
if (RobotBase.isReal()) {
SwerveDriveSubsystem(RealSwerveDriveIO(swerve))
} else {
SwerveDriveSubsystem(SimulatedSwerveDriveIO(swerve))
}
SwerveDriveSubsystem(
SwerveDrive(
SwerveConstants.YAGSL,
SwerveConstants.YAGSL_CONTROLLER_CONFIG,
PhysicalConstants.MAX_VELOCITY.`in`(Units.MetersPerSecond),
Pose2d.kZero,
),
null,
)
}

override fun robotPeriodic() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.frc5183.robot.commands.collector

import edu.wpi.first.wpilibj2.command.Command
import org.frc5183.robot.subsystems.collector.CollectorSubsystem

class DriveCollector(
val collector: CollectorSubsystem,
val input: () -> Double,
) : Command() {
init {
addRequirements(collector)
}

override fun execute() {
collector.runIntake(input())
}

override fun end(interrupted: Boolean) {
collector.stopIntake()
}

override fun isFinished(): Boolean = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.frc5183.robot.commands.collector

import edu.wpi.first.wpilibj2.command.Command
import org.frc5183.robot.subsystems.collector.CollectorSubsystem
import org.frc5183.robot.subsystems.shooter.ShooterSubsystem

class IntakeCommand(
val collector: CollectorSubsystem,
) : Command() {
init {
addRequirements(collector)
}

override fun initialize() {
collector.runIntake(1.0)
}

override fun end(interrupted: Boolean) {
collector.stopIntake()
}

override fun isFinished(): Boolean = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.frc5183.robot.commands.collector

import edu.wpi.first.wpilibj2.command.Command
import org.frc5183.robot.subsystems.collector.CollectorSubsystem
import org.frc5183.robot.subsystems.shooter.ShooterSubsystem
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unused import.

ShooterSubsystem is imported but never used in this class.

🧹 Proposed fix
 import edu.wpi.first.wpilibj2.command.Command
 import org.frc5183.robot.subsystems.collector.CollectorSubsystem
-import org.frc5183.robot.subsystems.shooter.ShooterSubsystem
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import org.frc5183.robot.subsystems.shooter.ShooterSubsystem
import edu.wpi.first.wpilibj2.command.Command
import org.frc5183.robot.subsystems.collector.CollectorSubsystem
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/kotlin/org/frc5183/robot/commands/collector/LowerCollector.kt` at
line 5, The import of ShooterSubsystem at the top of LowerCollector is unused;
open the LowerCollector class and remove the line importing
org.frc5183.robot.subsystems.shooter.ShooterSubsystem so the file no longer
contains an unused import (leave all other imports and the LowerCollector class
unchanged).


class LowerCollector(
val collector: CollectorSubsystem,
) : Command() {
init {
addRequirements(collector)
}

override fun initialize() {
collector.runArm(-1.0)
}

override fun end(interrupted: Boolean) {
collector.stopArm()
}

override fun isFinished(): Boolean = collector.atBottom
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.frc5183.robot.commands.collector

import edu.wpi.first.wpilibj2.command.Command
import org.frc5183.robot.subsystems.collector.CollectorSubsystem
import org.frc5183.robot.subsystems.shooter.ShooterSubsystem

class RaiseCollector(
val collector: CollectorSubsystem,
) : Command() {
init {
addRequirements(collector)
}

override fun initialize() {
collector.runArm(1.0)
}

override fun end(interrupted: Boolean) {
collector.stopArm()
}

override fun isFinished(): Boolean = collector.atTop
}
9 changes: 9 additions & 0 deletions src/main/kotlin/org/frc5183/robot/constants/Constants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.frc5183.robot.constants

import edu.wpi.first.units.measure.Angle

object Constants {
val COLLECTOR_ARM_TOP: Angle
val COLLECTOR_ARM_BOTTOM: Angle
val COLLECTOR_ARM_DELTA: Angle
}
Comment on lines +5 to +9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Uninitialized val properties will cause compilation error.

In Kotlin, val properties within an object declaration must be initialized. These three properties lack initializers, which will fail compilation.

🐛 Proposed fix: Initialize the constants with appropriate values
 object Constants {
-    val COLLECTOR_ARM_TOP: Angle
-    val COLLECTOR_ARM_BOTTOM: Angle
-    val COLLECTOR_ARM_DELTA: Angle
+    val COLLECTOR_ARM_TOP: Angle = Units.Rotations.of(0.0) // TODO: Set actual top position
+    val COLLECTOR_ARM_BOTTOM: Angle = Units.Rotations.of(0.0) // TODO: Set actual bottom position
+    val COLLECTOR_ARM_DELTA: Angle = Units.Rotations.of(0.01) // TODO: Set actual tolerance
 }

You'll need to add the import:

import edu.wpi.first.units.Units
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/kotlin/org/frc5183/robot/constants/Constants.kt` around lines 5 - 9,
The three vals in the Constants object (COLLECTOR_ARM_TOP, COLLECTOR_ARM_BOTTOM,
COLLECTOR_ARM_DELTA) are declared without initializers and will not compile; fix
by assigning each an appropriate Angle value (e.g., using Units to convert
degrees/radians as required) and add the import edu.wpi.first.units.Units at the
top so you can construct the Angle constants (update the Constants object to
initialize COLLECTOR_ARM_TOP, COLLECTOR_ARM_BOTTOM, and COLLECTOR_ARM_DELTA with
concrete Angle expressions).

13 changes: 3 additions & 10 deletions src/main/kotlin/org/frc5183/robot/constants/Controls.kt
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
package org.frc5183.robot.constants

import edu.wpi.first.wpilibj2.command.Command
import edu.wpi.first.wpilibj2.command.CommandScheduler
import edu.wpi.first.wpilibj2.command.button.CommandXboxController
import org.frc5183.robot.commands.drive.TeleopDriveCommand
import org.frc5183.robot.subsystems.drive.SwerveDriveSubsystem
import swervelib.SwerveInputStream
import kotlin.math.absoluteValue

object Controls {
val DRIVER_CONTROLLER: CommandXboxController = CommandXboxController(0)
val OPERATOR_CONTROLLER: CommandXboxController = CommandXboxController(1)

lateinit var TELEOP_DRIVE_COMMAND: TeleopDriveCommand
lateinit var DRIVE_COMMAND: Command

fun registerControls(drive: SwerveDriveSubsystem) {
CommandScheduler.getInstance().activeButtonLoop.clear()

TELEOP_DRIVE_COMMAND =
TeleopDriveCommand(
drive,
xInput = { if (DRIVER_CONTROLLER.leftX.absoluteValue < .2) 0.0 else DRIVER_CONTROLLER.leftX },
yInput = { if (DRIVER_CONTROLLER.leftY.absoluteValue < .2) 0.0 else DRIVER_CONTROLLER.leftY },
rotationInput = { 0.0 },
fieldRelative = false,
)

drive.defaultCommand = TELEOP_DRIVE_COMMAND
Comment on lines +15 to 20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

TELEOP_DRIVE_COMMAND is undefined; should use DRIVE_COMMAND.

Line 20 references TELEOP_DRIVE_COMMAND which doesn't exist. The declared property is DRIVE_COMMAND. This will fail compilation.

🐛 Proposed fix
-        drive.defaultCommand = TELEOP_DRIVE_COMMAND
+        drive.defaultCommand = DRIVE_COMMAND
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
lateinit var DRIVE_COMMAND: Command
fun registerControls(drive: SwerveDriveSubsystem) {
CommandScheduler.getInstance().activeButtonLoop.clear()
TELEOP_DRIVE_COMMAND =
TeleopDriveCommand(
drive,
xInput = { if (DRIVER_CONTROLLER.leftX.absoluteValue < .2) 0.0 else DRIVER_CONTROLLER.leftX },
yInput = { if (DRIVER_CONTROLLER.leftY.absoluteValue < .2) 0.0 else DRIVER_CONTROLLER.leftY },
rotationInput = { 0.0 },
fieldRelative = false,
)
drive.defaultCommand = TELEOP_DRIVE_COMMAND
lateinit var DRIVE_COMMAND: Command
fun registerControls(drive: SwerveDriveSubsystem) {
CommandScheduler.getInstance().activeButtonLoop.clear()
drive.defaultCommand = DRIVE_COMMAND
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/kotlin/org/frc5183/robot/constants/Controls.kt` around lines 15 -
20, The registerControls function is setting drive.defaultCommand to an
undefined symbol TELEOP_DRIVE_COMMAND; replace that reference with the declared
property DRIVE_COMMAND so the code compiles (update the assignment in
registerControls where drive.defaultCommand is set to use DRIVE_COMMAND instead
of TELEOP_DRIVE_COMMAND).

}
}
141 changes: 0 additions & 141 deletions src/main/kotlin/org/frc5183/robot/logging/AutoLogInputs.kt

This file was deleted.

This file was deleted.

Loading
Loading