Skip to content

Commit

Permalink
Complete PID Tuner
Browse files Browse the repository at this point in the history
  • Loading branch information
SachetK committed Nov 12, 2024
1 parent b22b42d commit 31b3592
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package org.firstinspires.ftc.teamcode.opModes.tuning.arm

import com.acmerobotics.dashboard.config.Config
import com.arcrobotics.ftclib.command.CommandOpMode
import com.arcrobotics.ftclib.command.InstantCommand
import com.arcrobotics.ftclib.hardware.motors.Motor
import com.qualcomm.robotcore.eventloop.opmode.TeleOp
import org.firstinspires.ftc.teamcode.constants.ControlBoard
import org.firstinspires.ftc.teamcode.subsystems.arm.ArmSubsystem

@TeleOp
@Config
class ArmPIDTuner : CommandOpMode() {
private lateinit var armLeft: Motor
private lateinit var armRight: Motor
Expand All @@ -17,6 +22,14 @@ class ArmPIDTuner : CommandOpMode() {

armSubsystem = ArmSubsystem(armLeft, armRight)

InstantCommand({
armSubsystem.setpoint = Math.toRadians(target)
}).perpetually().schedule()
}

companion object {
@JvmField
// NOTE THAT THIS VALUE SHOULD BE DEGREES
var target = 0.0
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.firstinspires.ftc.teamcode.subsystems.arm

import com.acmerobotics.dashboard.config.Config
import com.arcrobotics.ftclib.controller.PIDController
import com.arcrobotics.ftclib.controller.wpilibcontroller.ArmFeedforward
import com.arcrobotics.ftclib.hardware.motors.Motor
Expand All @@ -8,6 +9,7 @@ import com.arcrobotics.ftclib.hardware.motors.MotorGroup
import org.firstinspires.ftc.teamcode.utils.PIDSubsystem
import kotlin.math.PI

@Config
class ArmSubsystem(
armLeft: Motor,
armRight: Motor
Expand Down Expand Up @@ -44,9 +46,6 @@ class ArmSubsystem(
override fun getMeasurement() = armAngle

companion object {
@JvmField
var target = 0.0

@JvmField
var kCos = 0.3

Expand Down

0 comments on commit 31b3592

Please sign in to comment.