Skip to content

Commit

Permalink
fixed robot centric swerve issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh1234587 committed Feb 9, 2024
1 parent 71b8574 commit 071b00d
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 19 deletions.
103 changes: 103 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard0"
},
{
"guid": "Keyboard1"
},
{
"guid": "Keyboard2"
}
]
}
45 changes: 45 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"HALProvider": {
"Other Devices": {
"Talon FX (v6)[0]/Fwd Limit": {
"header": {
"open": true
}
},
"Talon FX (v6)[0]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[1]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[3]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[4]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[5]/Rotor Sensor": {
"header": {
"open": true
}
}
}
},
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo",
"/SmartDashboard/Auto Choices": "String Chooser"
}
},
"NetworkTables Info": {
"visible": true
}
}
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/BuildConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "2024RobotCode";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 5;
public static final String GIT_SHA = "cca181101b68569d0f64c2038b7c5ffb0ceb66fb";
public static final String GIT_DATE = "2024-01-12 17:44:29 EST";
public static final int GIT_REVISION = 8;
public static final String GIT_SHA = "71b8574ac4f6d4c376624c57919d7cfb2822c53e";
public static final String GIT_DATE = "2024-02-03 14:28:25 EST";
public static final String GIT_BRANCH = "swerve";
public static final String BUILD_DATE = "2024-01-27 16:46:30 EST";
public static final long BUILD_UNIX_TIME = 1706391990425L;
public static final String BUILD_DATE = "2024-02-08 19:59:29 EST";
public static final long BUILD_UNIX_TIME = 1707440369951L;
public static final int DIRTY = 1;

private BuildConstants() {}
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/frc/robot/subsystems/drive/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.pathplanner.lib.util.PIDConstants;
import com.pathplanner.lib.util.PathPlannerLogging;
import com.pathplanner.lib.util.ReplanningConfig;

import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
Expand Down Expand Up @@ -69,6 +68,7 @@ public Drive(
modules[2] = new Module(blModuleIO, 2);
modules[3] = new Module(brModuleIO, 3);

lastGyroRotation = gyroInputs.yawPosition;
// Configure AutoBuilder for PathPlanner
AutoBuilder.configureHolonomic(
this::getPose,
Expand All @@ -87,7 +87,7 @@ public Drive(
return false;
},
this);
//MAX_LINEAR_SPEED, DRIVE_BASE_RADIUS, new ReplanningConfig()),
// MAX_LINEAR_SPEED, DRIVE_BASE_RADIUS, new ReplanningConfig()),
// this);
Pathfinding.setPathfinder(new LocalADStarAK());
PathPlannerLogging.setLogActivePathCallback(
Expand All @@ -101,16 +101,16 @@ public Drive(
});

poseEstimator =
new SwerveDrivePoseEstimator(
kinematics,
new Rotation2d(),
new SwerveModulePosition[] {
new SwerveModulePosition(),
new SwerveModulePosition(),
new SwerveModulePosition(),
new SwerveModulePosition()
},
new Pose2d());
new SwerveDrivePoseEstimator(
kinematics,
new Rotation2d(),
new SwerveModulePosition[] {
new SwerveModulePosition(),
new SwerveModulePosition(),
new SwerveModulePosition(),
new SwerveModulePosition()
},
new Pose2d());
}

public void periodic() {
Expand Down Expand Up @@ -142,7 +142,6 @@ public void periodic() {
break;
default:
}

}

public void updateOdometry() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/util/LimelightHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,4 +761,4 @@ public static LimelightResults getLatestResults(String limelightName) {

return results;
}
}
}

0 comments on commit 071b00d

Please sign in to comment.