Skip to content

Commit

Permalink
Merge branch 'beta' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
democat3457 committed Jan 29, 2024
2 parents c219213 + 555c630 commit 8063f61
Show file tree
Hide file tree
Showing 30 changed files with 623 additions and 502 deletions.
7 changes: 4 additions & 3 deletions SdsSwerveLib.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"fileName": "SdsSwerveLib.json",
"name": "swerve-lib",
"version": "2023.1.3.0",
"version": "2024.0.3.1",
"frcYear": "2024",
"uuid": "9619F7EA-7F96-4236-9D94-02338DFED592",
"mavenUrls": [
"https://jitpack.io"
],
"jsonUrl": "https://raw.githubusercontent.com/democat3457/swerve-lib/prod/SdsSwerveLib.json",
"jsonUrl": "https://raw.githubusercontent.com/democat3457/swerve-lib/beta/SdsSwerveLib.json",
"javaDependencies": [
{
"groupId": "com.github.democat3457",
"artifactId": "swerve-lib",
"version": "2023.1.3.0"
"version": "2024.0.3.1"
}
],
"jniDependencies": [],
Expand Down
13 changes: 8 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ plugins {
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

allprojects {
group 'com.swervedrivespecialties'
version '2023.1.3.0'
version '2024.0.3.1'

repositories {
mavenCentral()
Expand All @@ -27,10 +29,11 @@ dependencies {
implementation "edu.wpi.first.wpilibj:wpilibj-java:${wpilib_version}"
implementation "edu.wpi.first.wpiutil:wpiutil-java:${wpilib_version}"
implementation "edu.wpi.first.wpimath:wpimath-java:${wpilib_version}"
implementation "edu.wpi.first.wpiunits:wpiunits-java:${wpilib_version}"

// CTRE is implementation because it is not a hard requirement
implementation "com.ctre.phoenix:api-java:${ctre_phoenix_version}"
implementation "com.ctre.phoenix:wpiapi-java:${ctre_phoenix_version}"
// implementation "com.ctre.phoenix6:api-java:${ctre_phoenix_version}"
implementation "com.ctre.phoenix6:wpiapi-java:${ctre_phoenix_version}"

// REV is implementation because it is not a hard requirement
implementation "com.revrobotics.frc:REVLib-java:${revlib_version}"
Expand Down
8 changes: 5 additions & 3 deletions examples/mk3-minibot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
plugins {
id 'application'
id 'com.github.johnrengelman.shadow'
id 'edu.wpi.first.GradleRIO' version "2023.2.1"
id 'edu.wpi.first.GradleRIO' version "2024.2.1"
}

application {
mainClass.set('com.swervedrivespecialties.examples.mk3minibot.Main')
}

targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_11
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

deploy {
targets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.swervedrivespecialties.examples.mk3minibot.subsystems.DrivetrainSubsystem;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.Command;

import java.util.function.DoubleSupplier;

public class DriveCommand extends CommandBase {
public class DriveCommand extends Command {
private final DrivetrainSubsystem drivetrain;
private final DoubleSupplier translationXSupplier;
private final DoubleSupplier translationYSupplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.swervedrivespecialties.examples.mk3minibot.subsystems;

import com.ctre.phoenix.sensors.PigeonIMU;
import com.ctre.phoenix6.hardware.Pigeon2;
import com.swervedrivespecialties.examples.mk3minibot.Constants;
import com.swervedrivespecialties.swervelib.MkSwerveModuleBuilder;
import com.swervedrivespecialties.swervelib.MotorType;
Expand Down Expand Up @@ -30,7 +30,7 @@ public class DrivetrainSubsystem extends SubsystemBase {
private final SwerveModule backLeftModule;
private final SwerveModule backRightModule;

private final PigeonIMU gyroscope = new PigeonIMU(Constants.DRIVETRAIN_PIGEON_ID);
private final Pigeon2 gyroscope = new Pigeon2(Constants.DRIVETRAIN_PIGEON_ID);

private final SwerveDriveKinematics kinematics = new SwerveDriveKinematics(
new Translation2d(Constants.DRIVETRAIN_TRACKWIDTH_METERS / 2.0, Constants.DRIVETRAIN_WHEELBASE_METERS / 2.0),
Expand Down Expand Up @@ -91,7 +91,7 @@ public DrivetrainSubsystem() {

odometry = new SwerveDriveOdometry(
kinematics,
Rotation2d.fromDegrees(gyroscope.getFusedHeading()),
Rotation2d.fromDegrees(gyroscope.getAngle()),
new SwerveModulePosition[]{ frontLeftModule.getPosition(), frontRightModule.getPosition(), backLeftModule.getPosition(), backRightModule.getPosition() }
);

Expand All @@ -102,7 +102,7 @@ public DrivetrainSubsystem() {

public void zeroGyroscope() {
odometry.resetPosition(
Rotation2d.fromDegrees(gyroscope.getFusedHeading()),
Rotation2d.fromDegrees(gyroscope.getAngle()),
new SwerveModulePosition[]{ frontLeftModule.getPosition(), frontRightModule.getPosition(), backLeftModule.getPosition(), backRightModule.getPosition() },
new Pose2d(odometry.getPoseMeters().getTranslation(), Rotation2d.fromDegrees(0.0))
);
Expand All @@ -119,7 +119,7 @@ public void drive(ChassisSpeeds chassisSpeeds) {
@Override
public void periodic() {
odometry.update(
Rotation2d.fromDegrees(gyroscope.getFusedHeading()),
Rotation2d.fromDegrees(gyroscope.getAngle()),
new SwerveModulePosition[]{ frontLeftModule.getPosition(), frontRightModule.getPosition(), backLeftModule.getPosition(), backRightModule.getPosition() }
);

Expand Down
Loading

0 comments on commit 8063f61

Please sign in to comment.