From fbb95c072418a779c8086baf43c1766723307e4b Mon Sep 17 00:00:00 2001 From: Sachet Korada Date: Tue, 19 Nov 2024 20:08:40 -0500 Subject: [PATCH] basic subsystems --- .idea/misc.xml | 2 +- .../ftc/teamcode/commands/drive/DriveCommand.kt | 13 ++++++------- .../teamcode/subsystems/intake/IntakeSubsystem.kt | 11 ++++++++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 3b0be22..74dd639 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + diff --git a/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/commands/drive/DriveCommand.kt b/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/commands/drive/DriveCommand.kt index 3a64ebc..bdba1b3 100644 --- a/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/commands/drive/DriveCommand.kt +++ b/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/commands/drive/DriveCommand.kt @@ -2,14 +2,13 @@ package org.firstinspires.ftc.teamcode.commands.drive import com.arcrobotics.ftclib.command.CommandBase import org.firstinspires.ftc.teamcode.subsystems.drive.DriveSubsystem -import java.util.function.DoubleSupplier import kotlin.math.pow class DriveCommand( private val subsystem: DriveSubsystem, - private val leftX: DoubleSupplier, - private val leftY: DoubleSupplier, - private val rightX: DoubleSupplier, + private val leftX: () -> Double, + private val leftY: () -> Double, + private val rightX: () -> Double, private val zoneVal: Double, ) : CommandBase() { init { @@ -18,9 +17,9 @@ class DriveCommand( override fun execute() { subsystem.drive( - leftY = zonedDrive(-leftY.asDouble, zoneVal).pow(3), - leftX = zonedDrive(leftX.asDouble, zoneVal).pow(3), - rightX = zonedDrive(rightX.asDouble, zoneVal).pow(3), + leftY = zonedDrive(-leftY.invoke(), zoneVal).pow(3), + leftX = zonedDrive(leftX.invoke(), zoneVal).pow(3), + rightX = zonedDrive(rightX.invoke(), zoneVal).pow(3), ) } diff --git a/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/subsystems/intake/IntakeSubsystem.kt b/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/subsystems/intake/IntakeSubsystem.kt index 0d01382..3772401 100644 --- a/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/subsystems/intake/IntakeSubsystem.kt +++ b/TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/subsystems/intake/IntakeSubsystem.kt @@ -1,5 +1,14 @@ package org.firstinspires.ftc.teamcode.subsystems.intake import com.arcrobotics.ftclib.command.SubsystemBase +import com.arcrobotics.ftclib.hardware.motors.CRServo -class IntakeSubsystem : SubsystemBase() \ No newline at end of file +class IntakeSubsystem( + private val intake: CRServo +) : SubsystemBase() { + fun intake() = intake.set(1.0) + + fun outtake() = intake.set(-1.0) + + fun stop() = intake.stop() +} \ No newline at end of file