Skip to content

Commit

Permalink
migrated simulation dependencies to Gradle file
Browse files Browse the repository at this point in the history
  • Loading branch information
catr1xLiu committed Sep 18, 2024
1 parent 1b8c93e commit 0b8d91f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
4 changes: 0 additions & 4 deletions example/5516-2024-OffSeason/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ dependencies {
implementation wpi.java.deps.wpilib()
implementation wpi.java.vendor.java()

// for 2d Physics Simulation
implementation group: 'junit', name: 'junit', version: '4.13.1'
implementation group: 'org.dyn4j', name: 'dyn4j', version: '5.0.2'

roborioDebug wpi.java.deps.wpilibJniDebug(wpi.platforms.roborio)
roborioDebug wpi.java.vendor.jniDebug(wpi.platforms.roborio)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DriveTrainConstants {
* */
public static final double
WHEEL_COEFFICIENT_OF_FRICTION = 1.05, // yeah, I know this is against the law of physics, but it feels realistic
ROBOT_MASS_KG = 37.35; // with bumpers
ROBOT_MASS_KG = 32; // with bumpers

private static final DCMotor KRAKEN_X60 = new DCMotor(
12, 7.09, 366, 2, Units.rotationsPerMinuteToRadiansPerSecond(4800), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public double getSimulationTorque() {
driveAppliedVolts = driveDesiredVolts;
if (Math.abs(currentAtDesiredVolts) > 1.5 * DRIVE_CURRENT_LIMIT
&& driveDesiredVolts * physicsSimulationResults.driveWheelFinalVelocityRadPerSec > 0) {
final double limitedCurrent = Math.copySign(DRIVE_CURRENT_LIMIT, currentAtDesiredVolts);
final double limitedCurrent = Math.copySign(DRIVE_CURRENT_LIMIT * 1.2, currentAtDesiredVolts);
driveAppliedVolts = DRIVE_MOTOR.getVoltage(
DRIVE_MOTOR.getTorque(limitedCurrent),
driveMotorRotterSpeedRadPerSec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.*;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.commands.drive.OpponentRobotFollowPath;
import frc.robot.constants.DriveTrainConstants;
import frc.robot.constants.FieldConstants;
Expand Down Expand Up @@ -183,9 +184,7 @@ public void teleOpInit() {

@Override
public String getTypeName() {
final boolean isOpponent = robotID < 3,
isRed = DriverStation.getAlliance().orElse(DriverStation.Alliance.Blue).equals(DriverStation.Alliance.Red)
!= isOpponent;
return "Robot" + (isRed ? "Red" : "Blue");
final boolean isOpponent = robotID < 3;
return (isOpponent ? "Opponent" : "AlliancePartner") + "Robot";
}
}
23 changes: 23 additions & 0 deletions example/5516-2024-OffSeason/vendordeps/MapleSim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"fileName": "MapleSim.json",
"name": "MapleSim",
"version": "0.0.1",
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"frcYear": "2024",
"mavenUrls": [],
"jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json",
"javaDependencies": [
{
"groupId": "junit",
"artifactId": "junit",
"version": "4.13.1"
},
{
"groupId": "org.dyn4j",
"artifactId": "dyn4j",
"version": "5.0.2"
}
],
"jniDependencies": [],
"cppDependencies": []
}

0 comments on commit 0b8d91f

Please sign in to comment.