Skip to content

Commit

Permalink
some tunings of the drivetrain
Browse files Browse the repository at this point in the history
  • Loading branch information
catr1xLiu committed Dec 27, 2024
1 parent 6dca03f commit f2855d2
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/pathplanner/paths/rush first pp.path
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/pathplanner/paths/rush second pp.path
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/pathplanner/paths/rush third pp.path
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
"pointTowardsZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 4.5,
"maxAcceleration": 12.0,
"maxVelocity": 4.0,
"maxAcceleration": 10.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0,
"nominalVoltage": 12.0,
Expand Down
19 changes: 15 additions & 4 deletions src/main/deploy/pathplanner/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@
"opponent robots"
],
"autoFolders": [],
"defaultMaxVel": 4.5,
"defaultMaxAccel": 12.0,
"defaultMaxVel": 4.0,
"defaultMaxAccel": 10.0,
"defaultMaxAngVel": 540.0,
"defaultMaxAngAccel": 720.0,
"defaultNominalVoltage": 12.0,
"robotMass": 45.0,
"robotMOI": 6.883,
"robotWheelbase": 0.546,
"robotTrackwidth": 0.546,
"driveWheelRadius": 0.048,
"driveGearing": 5.9,
"maxDriveSpeed": 5.45,
"driveMotorType": "krakenX60",
"driveCurrentLimit": 56.0,
"wheelCOF": 1.2
"wheelCOF": 1.2,
"flModuleX": 0.273,
"flModuleY": 0.273,
"frModuleX": 0.273,
"frModuleY": -0.273,
"blModuleX": -0.273,
"blModuleY": 0.273,
"brModuleX": -0.273,
"brModuleY": -0.273,
"bumperOffsetX": 0.0,
"bumperOffsetY": 0.0,
"robotFeatures": []
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/constants/DriveControlLoops.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class DriveControlLoops {
public static final MaplePIDController.MaplePIDConfig CHASSIS_TRANSLATION_CLOSE_LOOP =
new MaplePIDController.MaplePIDConfig(2, 1.2, 0, 0.03, 0, false, 0);

public static final double ROTATIONAL_LOOKAHEAD_TIME = 0, TRANSLATIONAL_LOOKAHEAD_TIME = 0;
public static final double ROTATIONAL_LOOKAHEAD_TIME = 0.05, TRANSLATIONAL_LOOKAHEAD_TIME = 0.05;
}
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/constants/TunerConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public class TunerConstants {
public static final double kSteerInertia = 0.01;
public static final double kDriveInertia = 0.01;
// Simulated voltage necessary to overcome friction
public static final Voltage kSteerFrictionVoltage = Volts.of(0.25);
public static final Voltage kDriveFrictionVoltage = Volts.of(0.25);
public static final Voltage kSteerFrictionVoltage = Volts.of(0.05);
public static final Voltage kDriveFrictionVoltage = Volts.of(0.05);

public static final SwerveDrivetrainConstants DrivetrainConstants = new SwerveDrivetrainConstants()
.withCANBusName(kCANBus.getName())
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/frc/robot/constants/VisionConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class VisionConstants {
720,
new Translation2d(
0.330, -0.127), // the outing position of the camera in relative to the robot center
0.15, // the mounting height, in meters
0.25, // the mounting height, in meters
Rotation2d.fromDegrees(0), // the camera facing, 0 is front, positive is counter-clockwise
32, // camera pitch angle, in degrees
24, // camera pitch angle, in degrees
180 // camera roll angle, 0 for up-right and 180 for upside-down
),
new PhotonCameraProperties(
Expand All @@ -49,9 +49,9 @@ public class VisionConstants {
1280,
720,
new Translation2d(0.229, 0.348),
0.15,
0.2,
Rotation2d.fromDegrees(30),
35,
30,
180 // upside-down
),
new PhotonCameraProperties(
Expand All @@ -65,9 +65,9 @@ public class VisionConstants {
1280,
720,
new Translation2d(0.229, -0.348),
0.15,
0.2,
Rotation2d.fromDegrees(-30),
35,
30,
180 // upside-down
),
new PhotonCameraProperties(
Expand All @@ -81,7 +81,7 @@ public class VisionConstants {
1280,
720,
new Translation2d(-0.229, 0.330),
0.15,
0.2,
Rotation2d.fromDegrees(150),
35,
180 // upside-down
Expand All @@ -97,7 +97,7 @@ public class VisionConstants {
1280,
720,
new Translation2d(-0.229, -0.330),
0.15,
0.2,
Rotation2d.fromDegrees(-150),
35,
180 // upside-down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* The flywheel sims are not physically accurate, but provide a decent approximation for the behavior of the module.
*/
public class ModuleIOSim implements ModuleIO {
private static final double DRIVE_KS = 0.03;
private static final double DRIVE_KS = 0.04;
private static final double DRIVE_KP = 0.05;
private static final double STEER_KP = 8.0;
private static final double STEER_KD = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import edu.wpi.first.math.geometry.Pose3d;

public class CameraHeightAndPitchRollAngleFilter implements VisionResultsFilter {
private static final double ROBOT_HEIGHT_TOLERANCE = 0.3,
private static final double ROBOT_HEIGHT_TOLERANCE = 0.5,
ROBOT_PITCH_TOLERANCE_RADIANS = Math.toRadians(12),
ROBOT_ROLL_TOLERANCE_RADIANS = Math.toRadians(12);

Expand Down

0 comments on commit f2855d2

Please sign in to comment.