Skip to content

Commit

Permalink
Added linked waypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AccidentalMistake committed Feb 28, 2025
1 parent 4a83ed7 commit b928ca7
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 89 deletions.
6 changes: 0 additions & 6 deletions src/main/deploy/pathplanner/autos/L-J4-L4.auto
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
]
}
},
{
"type": "named",
"data": {
"name": "Print Me"
}
},
{
"type": "named",
"data": {
Expand Down
66 changes: 66 additions & 0 deletions src/main/deploy/pathplanner/paths/coral-a4.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"version": "2025.0",
"waypoints": [
{
"anchor": {
"x": 1.589,
"y": 7.33
},
"prevControl": null,
"nextControl": {
"x": 2.1724224275690256,
"y": 6.60509553280222
},
"isLocked": true,
"linkedName": null
},
{
"anchor": {
"x": 3.1887295081967215,
"y": 3.9890368852459024
},
"prevControl": {
"x": 3.1053290580005295,
"y": 4.31664510801174
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"pointTowardsZones": [],
"eventMarkers": [
{
"name": "AutonElevatorL4",
"waypointRelativePos": 0.686868686868689,
"endWaypointRelativePos": null,
"command": {
"type": "named",
"data": {
"name": "AutonElevatorL4"
}
}
}
],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 2.5,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
"unlimited": false
},
"goalEndState": {
"velocity": 0,
"rotation": 0.0
},
"reversed": false,
"folder": null,
"idealStartingState": {
"velocity": 0,
"rotation": -55.0
},
"useDefaultConstraints": true
}
12 changes: 6 additions & 6 deletions src/main/deploy/pathplanner/paths/coral-l4.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"waypoints": [
{
"anchor": {
"x": 1.589,
"y": 7.33
"x": 1.58925,
"y": 7.3302499999999995
},
"prevControl": null,
"nextControl": {
"x": 1.9956274530055549,
"y": 6.904312341126338
"x": 1.995877453005555,
"y": 6.904562341126337
},
"isLocked": true,
"linkedName": null
"linkedName": "Coral Left"
},
{
"anchor": {
Expand All @@ -25,7 +25,7 @@
},
"nextControl": null,
"isLocked": false,
"linkedName": null
"linkedName": "L Branch"
}
],
"rotationTargets": [],
Expand Down
30 changes: 9 additions & 21 deletions src/main/deploy/pathplanner/paths/j-coral.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,35 @@
"waypoints": [
{
"anchor": {
"x": 4.963,
"y": 5.116
"x": 5.058811475409836,
"y": 5.05594262295082
},
"prevControl": null,
"nextControl": {
"x": 4.169062603458528,
"y": 5.598460073639451
"x": 4.255971727872007,
"y": 5.503157799248037
},
"isLocked": false,
"linkedName": null
"linkedName": "J Branch"
},
{
"anchor": {
"x": 1.58925,
"y": 7.3302499999999995
},
"prevControl": {
"x": 2.137493718110874,
"y": 6.894665148750694
"x": 2.069016228179425,
"y": 6.937346410238761
},
"nextControl": null,
"isLocked": false,
"linkedName": null
"linkedName": "Coral Left"
}
],
"rotationTargets": [],
"constraintZones": [],
"pointTowardsZones": [],
"eventMarkers": [
{
"name": "ElevatorL0",
"waypointRelativePos": 0.0,
"endWaypointRelativePos": null,
"command": {
"type": "named",
"data": {
"name": "AutonElevatorL0"
}
}
}
],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 2.5,
Expand Down
34 changes: 11 additions & 23 deletions src/main/deploy/pathplanner/paths/l-coral.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,35 @@
"waypoints": [
{
"anchor": {
"x": 3.68,
"y": 5.044
"x": 3.6802254098360656,
"y": 5.043954918032787
},
"prevControl": null,
"nextControl": {
"x": 4.036867284207851,
"y": 4.667062582778861
"x": 4.037092694043917,
"y": 4.667017500811649
},
"isLocked": false,
"linkedName": null
"linkedName": "L Branch"
},
{
"anchor": {
"x": 1.589,
"y": 7.33
"x": 1.58925,
"y": 7.3302499999999995
},
"prevControl": {
"x": 1.4080663971863612,
"y": 7.512871326349569
"x": 1.4083163971863613,
"y": 7.513121326349569
},
"nextControl": null,
"isLocked": false,
"linkedName": null
"linkedName": "Coral Left"
}
],
"rotationTargets": [],
"constraintZones": [],
"pointTowardsZones": [],
"eventMarkers": [
{
"name": "AutonElevatorL0",
"waypointRelativePos": 0,
"endWaypointRelativePos": null,
"command": {
"type": "named",
"data": {
"name": "AutonElevatorL0"
}
}
}
],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 2.5,
Expand Down
16 changes: 8 additions & 8 deletions src/main/deploy/pathplanner/paths/l-j4.path
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
},
"prevControl": null,
"nextControl": {
"x": 6.382505716821357,
"y": 6.910923122592814
"x": 6.5735589411869535,
"y": 6.736568065392607
},
"isLocked": true,
"linkedName": null
},
{
"anchor": {
"x": 4.963,
"y": 5.115881147540984
"x": 5.058811475409836,
"y": 5.05594262295082
},
"prevControl": {
"x": 5.4441774183939255,
"y": 5.946924135947702
"x": 5.520785029650235,
"y": 5.888626091056476
},
"nextControl": null,
"isLocked": false,
"linkedName": null
"isLocked": true,
"linkedName": "J Branch"
}
],
"rotationTargets": [],
Expand Down
1 change: 0 additions & 1 deletion src/main/java/team/gif/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.RepeatCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import team.gif.robot.commands.climber.ClimberDeploy;
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/team/gif/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,4 @@ static public void enableRobotModeManual() {
static public void enableRobotModeStandardOp() {
robotMode = RobotMode.STANDARD_OP;
}

/**
* returns true if robot is in manual mode
* Needed for dashboard functionality
*
* @return true if robot is in manual mode, false if in StandardOp mode
*/
public static boolean getRobotModeManual() {
return robotMode == RobotMode.MANUAL;
}

}
3 changes: 2 additions & 1 deletion src/main/java/team/gif/robot/UiSmartDashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import team.gif.lib.RobotMode;
import team.gif.lib.delay;
import team.gif.robot.commands.drivetrain.Reset180;

Expand Down Expand Up @@ -60,7 +61,7 @@ public void updateUI() {

SmartDashboard.putNumber("Left", Robot.shooter.getLeftD());
SmartDashboard.putNumber("Right", Robot.shooter.getRightD());
SmartDashboard.putBoolean("Mode(Std)", Robot.getRobotModeManual());
SmartDashboard.putBoolean("Mode(Std)", Robot.getRobotMode() == RobotMode.STANDARD_OP);
SmartDashboard.putString("Piston", Robot.climber.getPistonStateAsString());

// Update Diagnostics tab
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package team.gif.robot.commands.drivetrain;
import edu.wpi.first.wpilibj2.command.Command;
import team.gif.robot.Robot;

public class MoveModulesIn extends Command {
public MoveModulesIn() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import edu.wpi.first.wpilibj2.command.Command;
import team.gif.lib.drivePace;
import team.gif.robot.Constants;
import team.gif.robot.Robot;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public AutonShootReset() {
new ParallelRaceGroup( // ends when any command ends // if robot does not have a target, don't shoot
new AutonHasNoTarget(),
new Shoot()
),
new ParallelCommandGroup(
new ShortDriveAway(),
new SetElevatorPosition(0)
)
// new ParallelCommandGroup(
// new ShortDriveAway(),
// new SetElevatorPosition(0)
// )
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
public class AutonStrafeToTarget extends Command {

private boolean hasTarget;
private int counter;

public AutonStrafeToTarget() {
super();
Expand All @@ -20,14 +19,16 @@ public AutonStrafeToTarget() {
public void initialize() {
hasTarget = false;
Robot.swerveDrive.setDrivePace(drivePace.COAST_RR);
counter = 0;
}

// Called every time the scheduler runs (~20ms) while the command is scheduled
@Override
public void execute() {
if (Robot.elevator.getPosition() < Constants.Elevator.LEVEL_4_POSITION - 1 ) {
System.out.println("counter " + counter++);
// Ensure elevator is at level 4 before checking reef sensors to move
// This makes sure the sensors don't trip if the robot lined up
// correctly and is still raising the elevator
// Since this only runs in auto, safe to just chcek height of level 4
if (Robot.elevator.getPosition() < Constants.Elevator.LEVEL_4_POSITION - 0.3 ) {
return;
}

Expand Down Expand Up @@ -67,5 +68,4 @@ public void end(boolean interrupted) {
Robot.swerveDrive.drive(0.0, 0.0, 0.0);
Robot.swerveDrive.setDrivePace(drivePace.COAST_FR);
}
}

}

0 comments on commit b928ca7

Please sign in to comment.