11package org.firstinspires.ftc.teamcode.opmode.auton
22
3+ import com.bylazar.configurables.annotations.Configurable
34import com.millburnx.cmdx.commandGroups.Sequential
45import com.millburnx.cmdxpedro.FollowPath
56import com.millburnx.cmdxpedro.paths.PedroPath
@@ -20,92 +21,98 @@ import org.firstinspires.ftc.teamcode.common.subsystem.Uppies
2021import org.firstinspires.ftc.teamcode.opmode.OpMode
2122
2223@Autonomous
23- class BlueAuton : CloseAuton (isRed = false )
24+ class BlueAuton : CloseAuton (isRed = false )
2425
2526@Autonomous
26- class RedAuton : CloseAuton (isRed = true )
27+ class RedAuton : CloseAuton (isRed = true )
2728
29+ @Configurable
2830open class CloseAuton (val isRed : Boolean ) : OpMode() {
2931 override fun run () {
3032 val intake = Intake (this , isTeleop = false )
3133 val flyWheel = FlyWheel (this , isTeleop = false )
3234 val uppies = Uppies (this , { flyWheel.state }, isTeleop = false )
33- val pedro = Pedro (this , Pose2d (p(Vec2d (26 .0 ,129 .0 )), p(145 .0 )), isTeleop = false )
35+ val pedro = Pedro (this , Pose2d (p(Vec2d (15 .0 , 111 .0 )), p(90 .0 )), isTeleop = false )
3436
3537 uppies.nextState()
3638
3739 val shootBallOne = PedroPath (
3840 pedro.follower, Line (
39- p(Vec2d (26 , 129 )), p(Vec2d (48 , 104 ))
40- ), LinearHeading (p(145 .0 ), p(140 .0 ))
41+ p(Vec2d (15 , 111 )), p(Vec2d (32 , shootY0 ))
42+ ), LinearHeading (p(90 .0 ), p(135 .0 ))
4143 )
4244
4345 val preRowOne = PedroPath (
44- pedro.follower, Line (
45- p(Vec2d (48 , 104 )), p(Vec2d (48 , 92 ))
46+ pedro.follower, CubicBezier (
47+ p(Vec2d (32 , shootY0)),
48+ p(Vec2d (48 , shootY0)),
49+ p(Vec2d (preRowX + 12 , rowY1)),
50+ p(Vec2d (preRowX, rowY1))
4651 ),
47- LinearHeading (p(135.0 ), p(5 .0 ))
52+ LinearHeading (p(135.0 ), p(0 .0 ))
4853 )
4954
5055 val intakeRowOne = PedroPath (
5156 pedro.follower, Line (
52- p(Vec2d (48 , 94 )), p(Vec2d (25 , 94 ))
57+ p(Vec2d (preRowX, rowY1 )), p(Vec2d (16 , rowY1 ))
5358 ),
54- LinearHeading (p(0.0 ), p(5 .0 ))
59+ LinearHeading (p(0.0 ), p(0 .0 ))
5560 )
5661
5762 val shootRowOne = PedroPath (
5863 pedro.follower, CubicBezier (
59- p(Vec2d (26 , 94 )),
60- p(Vec2d (28 , 96 )),
61- p(Vec2d (32 , 96 )),
62- p(Vec2d (48 , 110 ))
64+ p(Vec2d (16 , rowY1 )),
65+ p(Vec2d (48 , rowY1 )),
66+ p(Vec2d (48 , rowY1 )),
67+ p(Vec2d (48 , shootY1 ))
6368 ),
64- LinearHeading (p(0.0 ), p(140 .0 ))
69+ LinearHeading (p(0.0 ), p(135 .0 ))
6570 )
6671
6772 val preRowTwo = PedroPath (
6873 pedro.follower, CubicBezier (
69- p(Vec2d (48 , 96 )),
70- p(Vec2d (60 , 76 )),
71- p(Vec2d (54 , 76 )),
72- p(Vec2d (48 , 78 )),
73- ), LinearHeading (p(135.0 ), p(0 .0 ))
74+ p(Vec2d (48 , shootY1 )),
75+ p(Vec2d (60 , shootY1 - 12 )),
76+ p(Vec2d (60 , rowY2 + 2 )),
77+ p(Vec2d (preRowX, rowY2 + 2 )),
78+ ), LinearHeading (p(135.0 ), p(5 .0 ))
7479 )
7580
7681 val intakeRowTwo = PedroPath (
7782 pedro.follower, Line (
78- p(Vec2d (48 , 74 )), p(Vec2d (16 , 70 ))
83+ p(Vec2d (preRowX, rowY2 + 2 )), p(Vec2d (9 , rowY2 - 2 ))
7984 ),
80- LinearHeading (p(5.0 ), p(10 .0 ))
85+ LinearHeading (p(5.0 ), p(0 .0 ))
8186 )
8287
8388 val shootRowTwo = PedroPath (
8489 pedro.follower, CubicBezier (
85- p(Vec2d (16 , 70 )),
86- p(Vec2d (48 , 70 )),
87- p(Vec2d (48 , 70 )),
88- p(Vec2d (48 , 120 )),
90+ p(Vec2d (9 , rowY2 - 2 )),
91+ p(Vec2d (24 , rowY2 - 2 )),
92+ p(Vec2d (48 , 72 )),
93+ p(Vec2d (48 , shootY2 )),
8994 ),
90- LinearHeading (p(0.0 ), p(145 .0 ))
95+ LinearHeading (p(0.0 ), p(135 .0 ))
9196 )
9297
9398 scheduler.schedule(Sequential {
9499 Command { WaitFor { isStarted } }
95100 + FollowPath (pedro.follower, shootBallOne) { opModeIsActive() }
96101 Command { SleepFor { 500 } }
97102 + AutoFire (this @CloseAuton, null , intake, flyWheel, uppies, isTeleop = false )
103+
98104 + FollowPath (pedro.follower, preRowOne) { opModeIsActive() }
99105 Command { intake.power = 1.0 }
100106 + FollowPath (pedro.follower, intakeRowOne) { opModeIsActive() }
101- Command { SleepFor { 250 }; uppies.nextState(); SleepFor { 500 } }
107+ Command { SleepFor { 125 }; uppies.nextState(); SleepFor { 625 } }
102108 + FollowPath (pedro.follower, shootRowOne) { opModeIsActive() }
103109 Command { SleepFor { 500 } }
104110 + AutoFire (this @CloseAuton, null , intake, flyWheel, uppies, isTeleop = false )
111+
105112 + FollowPath (pedro.follower, preRowTwo) { opModeIsActive() }
106113 Command { intake.power = 1.0 }
107114 + FollowPath (pedro.follower, intakeRowTwo) { opModeIsActive() }
108- Command { SleepFor { 250 }; uppies.nextState(); SleepFor { 250 } }
115+ Command { SleepFor { 125 }; uppies.nextState(); SleepFor { 375 } }
109116 + FollowPath (pedro.follower, shootRowTwo) { opModeIsActive() }
110117 Command { SleepFor { 500 } }
111118 + AutoFire (this @CloseAuton, null , intake, flyWheel, uppies, isTeleop = false )
@@ -119,4 +126,24 @@ open class CloseAuton(val isRed: Boolean) : OpMode() {
119126 fun p (double : Double ): Double {
120127 return if (isRed) double.fieldMirror() else double
121128 }
129+
130+ companion object {
131+ @JvmField
132+ var preRowX = 48.0
133+
134+ @JvmField
135+ var rowY1 = 84.0
136+
137+ @JvmField
138+ var rowY2 = 60.0
139+
140+ @JvmField
141+ var shootY0 = 111
142+
143+ @JvmField
144+ var shootY1 = 96
145+
146+ @JvmField
147+ var shootY2 = 96
148+ }
122149}
0 commit comments