Skip to content

Commit

Permalink
basic subsystems
Browse files Browse the repository at this point in the history
  • Loading branch information
SachetK committed Nov 20, 2024
1 parent 15e13a1 commit fbb95c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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),
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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()
class IntakeSubsystem(
private val intake: CRServo
) : SubsystemBase() {
fun intake() = intake.set(1.0)

fun outtake() = intake.set(-1.0)

fun stop() = intake.stop()
}

0 comments on commit fbb95c0

Please sign in to comment.