Skip to content

Commit 5cc12e0

Browse files
committed
created a single path automode
1 parent 2225b78 commit 5cc12e0

4 files changed

Lines changed: 72 additions & 2 deletions

File tree

src/main/deploy/pathplanner/paths/ThreeCoral1.path

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"waypoints": [
44
{
55
"anchor": {
6-
"x": 7.18930027173913,
6+
"x": 7.189,
77
"y": 1.2
88
},
99
"prevControl": null,
1010
"nextControl": {
11-
"x": 6.312992527173914,
11+
"x": 6.312692255434784,
1212
"y": 1.2679093070652152
1313
},
1414
"isLocked": false,
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": "2025.0",
3+
"waypoints": [
4+
{
5+
"anchor": {
6+
"x": 7.1892,
7+
"y": 1.2
8+
},
9+
"prevControl": null,
10+
"nextControl": {
11+
"x": 6.195681180221097,
12+
"y": 1.3276333302327707
13+
},
14+
"isLocked": false,
15+
"linkedName": null
16+
},
17+
{
18+
"anchor": {
19+
"x": 5.123625,
20+
"y": 2.5527499999999996
21+
},
22+
"prevControl": {
23+
"x": 5.357128780026418,
24+
"y": 2.3065557804007697
25+
},
26+
"nextControl": null,
27+
"isLocked": false,
28+
"linkedName": null
29+
}
30+
],
31+
"rotationTargets": [],
32+
"constraintZones": [],
33+
"pointTowardsZones": [],
34+
"eventMarkers": [],
35+
"globalConstraints": {
36+
"maxVelocity": 3.0,
37+
"maxAcceleration": 3.0,
38+
"maxAngularVelocity": 540.0,
39+
"maxAngularAcceleration": 720.0,
40+
"nominalVoltage": 12.0,
41+
"unlimited": false
42+
},
43+
"goalEndState": {
44+
"velocity": 0,
45+
"rotation": 121.28265368163976
46+
},
47+
"reversed": false,
48+
"folder": null,
49+
"idealStartingState": {
50+
"velocity": 0,
51+
"rotation": 179.0502341435398
52+
},
53+
"useDefaultConstraints": false
54+
}

src/main/java/frc/robot/RobotContainer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,8 @@ public void setupAutos() {
424424

425425
autoChooser_.addDefaultOption("Do Nothing", new AutoModeBaseCmd("Do Nothing")) ;
426426

427+
autoChooser_.addOption("RunOnePath", AutoCommands.runOnePath(drivebase_, true)) ;
428+
427429
autoChooser_.addOption("Left Side Coral (2 Coral)",
428430
AutoCommands.twoCoralSideAuto(brain_, vision_, drivebase_, manipulator_, grabber_, funnel_, true));
429431

src/main/java/frc/robot/commands/auto/AutoCommands.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ private static Command logState(String mode, String state) {
6262
return kDebug ? new StateCmd("Autos/" + mode, state) : null;
6363
}
6464

65+
public static AutoModeBaseCmd runOnePath(Drive driveSub, boolean mirroredX) {
66+
final String onepath = "onepath" ;
67+
68+
Optional<PathPlannerPath> path = DriveCommands.findPath(onepath, mirroredX) ;
69+
if (!path.isPresent()) {
70+
return new AutoModeBaseCmd("empty") ;
71+
}
72+
73+
AutoModeBaseCmd seq = new AutoModeBaseCmd("runOnePath", path.get()) ;
74+
seq.addCommands(DriveCommands.followPathCommand(onepath, mirroredX)) ;
75+
76+
return seq ;
77+
}
78+
6579
public static AutoModeBaseCmd twoCoralSideAuto(BrainSubsystem brainSub, AprilTagVision vision, Drive driveSub, ManipulatorSubsystem manipSub, GrabberSubsystem grabberSub, FunnelSubsystem funnelSub, boolean mirroredX) {
6680
final String modename = "twoCoralSideAuto" ;
6781

0 commit comments

Comments
 (0)