-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from frc937/swerve-base
Ported swerve code from swerve box repo
- Loading branch information
Showing
18 changed files
with
980 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"angleJoystickRadiusDeadband": 0.5, | ||
"heading": { | ||
"p": 0.4, | ||
"i": 0, | ||
"d": 0.01 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"location": { | ||
"front": -12, | ||
"left": 9 | ||
}, | ||
"absoluteEncoderOffset": 211.0, | ||
"drive": { | ||
"type": "sparkmax", | ||
"id": 5, | ||
"canbus": null | ||
}, | ||
"angle": { | ||
"type": "sparkmax", | ||
"id": 6, | ||
"canbus": null | ||
}, | ||
"conversionFactor": { | ||
"angle": 0, | ||
"drive": 0 | ||
}, | ||
"encoder": { | ||
"type": "thrifty", | ||
"id": 2, | ||
"canbus": null | ||
}, | ||
"inverted": { | ||
"drive": false, | ||
"angle": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"location": { | ||
"front": -12, | ||
"left": -9 | ||
}, | ||
"absoluteEncoderOffset": 31.9, | ||
"drive": { | ||
"type": "sparkmax", | ||
"id": 7, | ||
"canbus": null | ||
}, | ||
"angle": { | ||
"type": "sparkmax", | ||
"id": 8, | ||
"canbus": null | ||
}, | ||
"conversionFactor": { | ||
"angle": 0, | ||
"drive": 0 | ||
}, | ||
"encoder": { | ||
"type": "thrifty", | ||
"id": 3, | ||
"canbus": null | ||
}, | ||
"inverted": { | ||
"drive": false, | ||
"angle": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"location": { | ||
"front": 12, | ||
"left": 9 | ||
}, | ||
"absoluteEncoderOffset": 140.6, | ||
"drive": { | ||
"type": "sparkmax", | ||
"id": 3, | ||
"canbus": null | ||
}, | ||
"angle": { | ||
"type": "sparkmax", | ||
"id": 4, | ||
"canbus": null | ||
}, | ||
"conversionFactor": { | ||
"angle": 0, | ||
"drive": 0 | ||
}, | ||
"encoder": { | ||
"type": "thrifty", | ||
"id": 0, | ||
"canbus": null | ||
}, | ||
"inverted": { | ||
"drive": false, | ||
"angle": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"location": { | ||
"front": 12, | ||
"left": -9 | ||
}, | ||
"absoluteEncoderOffset": 5.5, | ||
"drive": { | ||
"type": "sparkmax", | ||
"id": 1, | ||
"canbus": null | ||
}, | ||
"angle": { | ||
"type": "sparkmax", | ||
"id": 2, | ||
"canbus": null | ||
}, | ||
"conversionFactor": { | ||
"angle": 0, | ||
"drive": 0 | ||
}, | ||
"encoder": { | ||
"type": "thrifty", | ||
"id": 1, | ||
"canbus": null | ||
}, | ||
"inverted": { | ||
"drive": false, | ||
"angle": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"optimalVoltage": 12, | ||
"wheelGripCoefficientOfFriction": 1.19, | ||
"currentLimit": { | ||
"drive": 40, | ||
"angle": 20 | ||
}, | ||
"conversionFactor": { | ||
"angle": 0.006866455, | ||
"drive": 0.000011545 | ||
}, | ||
"rampRate": { | ||
"drive": 0.25, | ||
"angle": 0.25 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"imu": { | ||
"type": "navx", | ||
"id": 0, | ||
"canbus": null | ||
}, | ||
"invertedIMU": true, | ||
"modules": [ | ||
"frontleft.json", | ||
"frontright.json", | ||
"backleft.json", | ||
"backright.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
/* | ||
* Asimov's Laws: | ||
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm. | ||
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. | ||
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. | ||
*/ | ||
package frc.robot; | ||
|
||
/** | ||
* The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean | ||
* constants. This class should not be used for any other purpose. All constants should be declared | ||
* globally (i.e. public static). Do not put anything functional in this class. | ||
* | ||
* <p>It is advised to statically import this class (or one of its inner classes) wherever the | ||
* constants are needed, to reduce verbosity. | ||
*/ | ||
public final class Constants { | ||
public static class OperatorConstants { | ||
public static final int kDriverControllerPort = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
/* | ||
* Asimov's Laws: | ||
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm. | ||
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law. | ||
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. | ||
*/ | ||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.RobotContainer; | ||
import frc.robot.subsystems.Drive; | ||
|
||
public class DriveFieldOriented extends Command { | ||
private final Drive drive; | ||
|
||
/** Creates a new DriveFieldOriented. */ | ||
public DriveFieldOriented(Drive drive) { | ||
this.drive = drive; | ||
addRequirements(drive); | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() {} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
drive.driveFieldOriented( | ||
RobotContainer.getScaledControllerLeftYAxis(), | ||
RobotContainer.getScaledControllerLeftXAxis(), | ||
RobotContainer.getControllerRightXAxis()); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
drive.stop(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.