Updated to 2024

This commit is contained in:
thenetworkgrinch
2024-01-15 14:37:13 -06:00
parent 3fd8493ccb
commit a71d7a0b4e
185 changed files with 6910 additions and 10987 deletions

View File

@@ -81,4 +81,15 @@ public class SwerveDriveConfiguration
}
return modArr;
}
/**
* Assume the first module is the furthest. Usually front-left.
*
* @return Drive base radius from center of robot to the farthest wheel in meters.
*/
public double getDriveBaseRadiusMeters()
{
Translation2d furthestModule = moduleLocationsMeters[0];
return Math.abs(Math.sqrt(Math.pow(furthestModule.getX(), 2) + Math.pow(furthestModule.getY(), 2)));
}
}

View File

@@ -1,6 +1,6 @@
package swervelib.parser.json;
import com.revrobotics.SparkMaxRelativeEncoder.Type;
import com.revrobotics.SparkRelativeEncoder.Type;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.SPI;
@@ -20,6 +20,7 @@ import swervelib.imu.NavXSwerve;
import swervelib.imu.Pigeon2Swerve;
import swervelib.imu.PigeonSwerve;
import swervelib.imu.SwerveIMU;
import swervelib.motors.SparkFlexSwerve;
import swervelib.motors.SparkMaxBrushedMotorSwerve;
import swervelib.motors.SparkMaxSwerve;
import swervelib.motors.SwerveMotor;
@@ -175,6 +176,8 @@ public class DeviceJson
case "neo":
case "sparkmax":
return new SparkMaxSwerve(id, isDriveMotor);
case "sparkflex":
return new SparkFlexSwerve(id, isDriveMotor);
case "falcon":
case "talonfx":
return new TalonFXSwerve(id, canbus != null ? canbus : "", isDriveMotor);