xdytfchbjn m

This commit is contained in:
samuel desharnais 2023-10-24 19:47:28 -04:00
parent dfbedc1b46
commit 2834bb691b
9 changed files with 182 additions and 1 deletions

View File

@ -0,0 +1,8 @@
{
"angleJoystickRadiusDeadband": 0.5,
"heading": {
"p": 0.4,
"i": 0,
"d": 0.01
}
}

View File

@ -0,0 +1,26 @@
{
"location": {
"front": -12.375,
"left": 12.375
},
"absoluteEncoderOffset": 0,
"drive": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 0,
"canbus": null
},
"inverted": {
"drive": false,
"angle": false
}
}

View File

@ -0,0 +1,26 @@
{
"location": {
"front": -12.375,
"left": -12.375
},
"absoluteEncoderOffset": 0,
"drive": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 0,
"canbus": null
},
"inverted": {
"drive": false,
"angle": false
}
}

View File

@ -0,0 +1,26 @@
{
"location": {
"front": 12.375,
"left": 12.375
},
"absoluteEncoderOffset": 0,
"drive": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 0,
"canbus": null
},
"inverted": {
"drive": false,
"angle": false
}
}

View File

@ -0,0 +1,26 @@
{
"location": {
"front": 12.375,
"left": -12.375
},
"absoluteEncoderOffset": 0,
"drive": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"angle": {
"type": "sparkmax",
"id": 0,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 0,
"canbus": null
},
"inverted": {
"drive": false,
"angle": false
}
}

View File

@ -0,0 +1,20 @@
{
"wheelDiameter": 4,
"wheelGripCoefficientOfFriction": 1.19,
"gearRatio": {
"drive": 8.14,
"angle": 21.43
},
"currentLimit": {
"drive": 40,
"angle": 20
},
"rampRate": {
"drive": 0.25,
"angle": 0.25
},
"encoderPulsePerRotation": {
"drive": 1,
"angle": 1
}
}

View File

@ -0,0 +1,16 @@
{
"drive": {
"p": 0.0020645,
"i": 0,
"d": 0,
"f": 0,
"iz": 0
},
"angle": {
"p": 0.0020645,
"i": 0,
"d": 0,
"f": 0,
"iz": 0
}
}

View File

@ -0,0 +1,16 @@
{
"maxSpeed": 12,
"optimalVoltage": 12,
"imu": {
"type": "navx",
"id": 0,
"canbus": null
},
"invertedIMU": false,
"modules": [
"frontleft.json",
"frontright.json",
"backleft.json",
"backright.json"
]
}

View File

@ -5,14 +5,31 @@
package frc.robot.subsystems;
import java.io.File;
import java.io.IOException;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import swervelib.SwerveDrive;
import swervelib.parser.SwerveParser;
public class Drive extends SubsystemBase {
SwerveDrive swerveDrive;
File swerveJsonDirectory = new File(Filesystem.getDeployDirectory(),"swerve");
public void drive(double x, double y, double zRotation){
swerveDrive.drive(new Translation2d(x, y), zRotation, true, true);
}
/** Creates a new Drive. */
public Drive() {}
public Drive() {
try {
this.swerveDrive = new SwerveParser(swerveJsonDirectory).createSwerveDrive();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void periodic() {