-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
14 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/constants/IntakeConstants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package org.firstinspires.ftc.teamcode.constants | ||
|
||
enum class IntakeConstants(val value: Double) { | ||
kP(0.0), | ||
kP(0.6), | ||
kI(0.0), | ||
kD(0.0), | ||
|
||
INTAKE_MIN(-2000.0), | ||
INTAKE_MAX(2000.0) | ||
INTAKE_MAX_VELOCITY(4.0), | ||
INTAKE_MAX_ACCELERATION(5.0) | ||
} |
63 changes: 63 additions & 0 deletions
63
...ain/kotlin/org/firstinspires/ftc/teamcode/opModes/tuning/intake/IntakeConstraintsTuner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.firstinspires.ftc.teamcode.opModes.tuning.intake | ||
|
||
import com.acmerobotics.dashboard.FtcDashboard | ||
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode | ||
import com.qualcomm.robotcore.util.ElapsedTime | ||
import org.firstinspires.ftc.teamcode.subsystems.arm.ArmSubsystem | ||
import org.firstinspires.ftc.teamcode.subsystems.intake.IntakeSubsystem | ||
|
||
@Autonomous | ||
class IntakeConstraintsTuner : LinearOpMode() { | ||
private var maxVel = 0.0 | ||
private var maxAccel = 0.0 | ||
|
||
private val timer = ElapsedTime(ElapsedTime.Resolution.SECONDS) | ||
override fun runOpMode() { | ||
telemetry = MultipleTelemetry(FtcDashboard.getInstance().telemetry, telemetry) | ||
IntakeSubsystem.initialize(hardwareMap) | ||
|
||
waitForStart() | ||
|
||
var dt = 0.0 | ||
var prev = 0.0 | ||
|
||
timer.reset() | ||
while (opModeIsActive()) { | ||
while (timer.seconds() < TIME_TO_RUN) { | ||
IntakeSubsystem.wristUp() | ||
|
||
dt = timer.seconds() - dt | ||
|
||
val curr = IntakeSubsystem.velocity | ||
val dv = curr - prev | ||
|
||
maxVel = IntakeSubsystem.velocity.coerceAtLeast(maxVel) | ||
maxAccel = maxAccel.coerceAtLeast(dv / dt) | ||
|
||
prev = curr | ||
|
||
telemetry.addData("Velocity", IntakeSubsystem.velocity) | ||
telemetry.addData("Angle", IntakeSubsystem.position) | ||
|
||
telemetry.addData("Max Velocity", maxVel) | ||
telemetry.addData("Max Acceleration", maxAccel) | ||
|
||
telemetry.update() | ||
|
||
if (isStopRequested) break | ||
} | ||
ArmSubsystem.stop() | ||
|
||
telemetry.addData("Final Max Velocity", maxVel) | ||
telemetry.addData("Final Max Acceleration", maxAccel) | ||
telemetry.update() | ||
} | ||
} | ||
|
||
companion object { | ||
@JvmField | ||
var TIME_TO_RUN = 1.5 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters