Skip to content

Commit

Permalink
[#536] Improved drive
Browse files Browse the repository at this point in the history
  • Loading branch information
MattD8957 committed Apr 13, 2024
1 parent 3bb2d08 commit a03918b
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 70 deletions.
3 changes: 2 additions & 1 deletion .pathplanner/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"Top side paths"
],
"autoFolders": [
"Hide"
"Hide",
"New Folder"
],
"defaultMaxVel": 5.0,
"defaultMaxAccel": 4.0,
Expand Down
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/2-SB-[C3]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@
]
}
},
"folder": null,
"folder": "New Folder",
"choreoAuto": false
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/2-SF-[C2]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@
]
}
},
"folder": null,
"folder": "New Folder",
"choreoAuto": false
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/2-ST-[C1]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@
]
}
},
"folder": null,
"folder": "New Folder",
"choreoAuto": false
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/3-SB-[F4-C3]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@
]
}
},
"folder": null,
"folder": "Hide",
"choreoAuto": false
}
14 changes: 7 additions & 7 deletions src/main/deploy/pathplanner/autos/3-SB-[F5-F4]-EF.auto
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@
{
"type": "wait",
"data": {
"waitTime": 6.0
"waitTime": 4.0
}
}
]
}
},
{
"type": "named",
"data": {
"name": "Bias-Down"
}
},
{
"type": "path",
"data": {
Expand Down Expand Up @@ -269,6 +263,12 @@
"data": {
"pathName": "BS-F4"
}
},
{
"type": "deadline",
"data": {
"commands": []
}
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/autos/3-SF-[C2-C3]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@
]
}
},
"folder": null,
"folder": "Hide",
"choreoAuto": false
}
44 changes: 0 additions & 44 deletions src/main/deploy/pathplanner/autos/3-SF-[C2-F3]-EC.auto
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
]
}
},
{
"type": "named",
"data": {
"name": "Bias-Down"
}
},
{
"type": "deadline",
"data": {
Expand All @@ -49,44 +43,6 @@
]
}
},
{
"type": "race",
"data": {
"commands": [
{
"type": "deadline",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "Point-At-Speaker"
}
},
{
"type": "named",
"data": {
"name": "Smart-Collect"
}
},
{
"type": "named",
"data": {
"name": "preAim"
}
}
]
}
},
{
"type": "wait",
"data": {
"waitTime": 2.0
}
}
]
}
},
{
"type": "wait",
"data": {
Expand Down
12 changes: 6 additions & 6 deletions src/main/deploy/pathplanner/paths/F5-BS.path
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"y": 4.141627021992783
},
"prevControl": {
"x": 2.3428906525172715,
"y": 3.4016063111821313
"x": 2.034348684081985,
"y": 2.5358043023778354
},
"nextControl": null,
"isLocked": false,
Expand All @@ -32,18 +32,18 @@
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxVelocity": 5.0,
"maxAcceleration": 4.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0.0,
"rotation": -42.0,
"rotateFast": false
"rotateFast": true
},
"reversed": false,
"folder": "Return Paths",
"previewStartingState": null,
"useDefaultConstraints": false
"useDefaultConstraints": true
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DrivetrainConstants {

public static final double ROT_MULT = 0.04; // TODO Tune for Driver

public static final double SLOW_ROT_MULT = 0.3;
public static final double SLOW_ROT_MULT = 0.7;
public static final double SLOW_SPEED_MULT = 0.4;

public static final double SYS_TEST_SPEED_DRIVE = 0.5;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ protected void configureDefaultCommands() {
/* driver */
drivetrain.registerTelemetry(logger::telemeterize);

drivetrain.setDefaultCommand(drivetrain.applyPercentRequestField(() -> -driver.getLeftY(),
() -> -driver.getLeftX(), () -> -driver.getRightX()));
drivetrain.setDefaultCommand(drivetrain.applyPercentRequestField(() -> -(driver.getLeftY() * drivetrain.getSpeedMult()),
() -> -(driver.getLeftX() * drivetrain.getSpeedMult()), () -> -(driver.getRightX() * drivetrain.getRotMult())));
// .alongWith(new CollisionDetection(drivetrain, CollisionType.TELEOP)));

/* copilot */
Expand Down
18 changes: 14 additions & 4 deletions src/main/java/frc/robot/subsystems/Swerve.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public class Swerve extends SwerveDrivetrain implements Subsystem {
private boolean disableVision = false;
private boolean robotCentricControl = false;
private double maxSpeed = DrivetrainConstants.MaxSpeed;
private double speedMult = 1;
private double maxAngularRate = DrivetrainConstants.MaxAngularRate * DrivetrainConstants.ROT_MULT;
private double angularMult = 1;
private LinearFilter xFilter = LinearFilter.singlePoleIIR(2, 0.01);
private LinearFilter yFilter = LinearFilter.singlePoleIIR(2, 0.01);
private LinearFilter rotFilter = LinearFilter.singlePoleIIR(2, 0.01);
Expand Down Expand Up @@ -327,14 +329,22 @@ public boolean inSlowMode() {
*/
public void setSlowMode(boolean slow) {
if (slow) {
maxSpeed = DrivetrainConstants.MaxSpeed * DrivetrainConstants.SLOW_SPEED_MULT;
maxAngularRate = DrivetrainConstants.MaxAngularRate * DrivetrainConstants.ROT_MULT * DrivetrainConstants.SLOW_ROT_MULT;
speedMult = DrivetrainConstants.SLOW_SPEED_MULT;
angularMult = DrivetrainConstants.SLOW_ROT_MULT;
} else {
maxSpeed = DrivetrainConstants.MaxSpeed;
maxAngularRate = DrivetrainConstants.MaxAngularRate * DrivetrainConstants.ROT_MULT;
speedMult = 1;
angularMult = 1;
}
}

public double getSpeedMult() {
return speedMult;
}

public double getRotMult() {
return angularMult;
}

public boolean isInField() {
return field.isPoseInRegion(getPose());
}
Expand Down

0 comments on commit a03918b

Please sign in to comment.