Skip to content

Commit fd3680d

Browse files
committed
03/12/26 - 00 26
1 parent 6a05612 commit fd3680d

3 files changed

Lines changed: 76 additions & 132 deletions

File tree

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/auton/AutonManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import com.pedropathing.paths.PathBuilder
1212
import org.firstinspires.ftc.teamcode.common.subsystem.Drive
1313
import org.firstinspires.ftc.teamcode.opmode.OpMode
1414

15-
// TODO: create the pedro subsystem and pass it so we can automatically the starting pose
16-
// (find a way to do it cleanly since this is created after it)
17-
// i think we let auton manager create pedro, drive can have pedro passed in. if not it'll create itself
18-
class AutonManager(val opMode: OpMode, val drive: Drive, val sequenceName: String, val isMirrored: Boolean = false) {
15+
open class BaseAutonManager(val opMode: OpMode, val drive: Drive, val isMirrored: Boolean = false) {
1916
val builder: PedroBuilder = PedroBuilder(isMirrored)
17+
}
18+
19+
class AutonManager(opMode: OpMode, drive: Drive, val sequenceName: String, isMirrored: Boolean = false): BaseAutonManager(opMode, drive, isMirrored) {
2020
val loadedSequence: Sequence = PedroLoader.load("Paths/$sequenceName.pp")
2121
val loadedPath: List<Pair<com.millburnx.cmdxpedro.paths.path.Path, HeadingInterpolation>>
2222
get() = PedroLoader.sequenceToPath(loadedSequence)

TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/auton/Close18BallAutonBezier.kt

Lines changed: 0 additions & 128 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package org.firstinspires.ftc.teamcode.opmode.test.pedro
2+
3+
import com.bylazar.configurables.annotations.Configurable
4+
import com.millburnx.cmdx.Command
5+
import com.millburnx.cmdx.commandGroups.Sequential
6+
import com.millburnx.cmdxpedro.paths.heading.LinearHeading
7+
import com.millburnx.cmdxpedro.paths.path.Line
8+
import com.millburnx.util.vector.Vec2d
9+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp
10+
import org.firstinspires.ftc.teamcode.common.subsystem.TeleOpDrive
11+
import org.firstinspires.ftc.teamcode.opmode.OpMode
12+
import org.firstinspires.ftc.teamcode.opmode.auton.BaseAutonManager
13+
14+
@Configurable
15+
@TeleOp
16+
class LineTest : OpMode() {
17+
override fun run() {
18+
val drive = TeleOpDrive(this, true)
19+
20+
val autonManager = BaseAutonManager(this, drive, false)
21+
22+
val forward = {
23+
autonManager.builder.PathCommand(
24+
drive.follower, Line(
25+
Vec2d(0.0, 0.0),
26+
Vec2d(distance, 0.0),
27+
),
28+
LinearHeading(0.0, 0.0),
29+
{ !isStopRequested }
30+
)
31+
}
32+
val backward = {
33+
autonManager.builder.PathCommand(
34+
drive.follower, Line(
35+
Vec2d(distance, 0.0),
36+
Vec2d(0.0, 0.0),
37+
),
38+
LinearHeading(0.0, 0.0),
39+
{ !isStopRequested }
40+
)
41+
}
42+
43+
var isBusy = false
44+
45+
scheduler.schedule(
46+
Command {
47+
while (!isStopRequested) {
48+
if (!gp1.prev.rightBumper && gp1.current.rightBumper) {
49+
isRunning = !isRunning
50+
}
51+
if (!isBusy && isRunning) {
52+
isBusy = true
53+
scheduler.schedule(Sequential {
54+
+forward()
55+
+backward()
56+
Command { isBusy = false }
57+
})
58+
}
59+
sync()
60+
}
61+
}
62+
)
63+
}
64+
65+
companion object {
66+
@JvmField
67+
var distance = 48.0
68+
69+
@JvmField
70+
var isRunning = false
71+
}
72+
}

0 commit comments

Comments
 (0)