Skip to content

Commit

Permalink
Merge pull request #4 from hammerhead226/swerve
Browse files Browse the repository at this point in the history
Swerve
  • Loading branch information
davidchen20 authored Feb 19, 2024
2 parents 5eca808 + f4f9e6e commit aa35f22
Show file tree
Hide file tree
Showing 30 changed files with 3,718 additions and 60 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on:
push:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2024-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Grant execute permission
run: chmod +x gradlew
- name: Build robot code
run: ./gradlew build
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"mechanical-advantage.event-deploy-wpilib",
"richardwillis.vscode-spotless-gradle"
]
}
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,14 @@
},
null
],
"java.test.defaultConfig": "WPIlibUnitTests"
"java.test.defaultConfig": "WPIlibUnitTests",
"spotlessGradle.format.enable": true,
"spotlessGradle.diagnostics.enable": false,
"editor.defaultFormatter": "richardwillis.vscode-spotless-gradle",
"[json]": {
"editor.defaultFormatter": "richardwillis.vscode-spotless-gradle"
},
"[java]": {
"editor.defaultFormatter": "richardwillis.vscode-spotless-gradle"
}
}
674 changes: 674 additions & 0 deletions AdvantageKit-License.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion WPILib-License.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2023 FIRST and other WPILib contributors
Copyright (c) 2009-2024 FIRST and other WPILib contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
103 changes: 103 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"keyboardJoysticks": [
{
"axisConfig": [
{
"decKey": 65,
"incKey": 68
},
{
"decKey": 87,
"incKey": 83
},
{
"decKey": 69,
"decayRate": 0.0,
"incKey": 82,
"keyRate": 0.009999999776482582
}
],
"axisCount": 3,
"buttonCount": 4,
"buttonKeys": [
90,
88,
67,
86
],
"povConfig": [
{
"key0": 328,
"key135": 323,
"key180": 322,
"key225": 321,
"key270": 324,
"key315": 327,
"key45": 329,
"key90": 326
}
],
"povCount": 1
},
{
"axisConfig": [
{
"decKey": 74,
"incKey": 76
},
{
"decKey": 73,
"incKey": 75
}
],
"axisCount": 2,
"buttonCount": 4,
"buttonKeys": [
77,
44,
46,
47
],
"povCount": 0
},
{
"axisConfig": [
{
"decKey": 263,
"incKey": 262
},
{
"decKey": 265,
"incKey": 264
}
],
"axisCount": 2,
"buttonCount": 6,
"buttonKeys": [
260,
268,
266,
261,
269,
267
],
"povCount": 0
},
{
"axisCount": 0,
"buttonCount": 0,
"povCount": 0
}
],
"robotJoysticks": [
{
"guid": "Keyboard0"
},
{
"guid": "Keyboard1"
},
{
"guid": "Keyboard2"
}
]
}
45 changes: 45 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"HALProvider": {
"Other Devices": {
"Talon FX (v6)[0]/Fwd Limit": {
"header": {
"open": true
}
},
"Talon FX (v6)[0]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[1]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[3]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[4]/Rotor Sensor": {
"header": {
"open": true
}
},
"Talon FX (v6)[5]/Rotor Sensor": {
"header": {
"open": true
}
}
}
},
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo",
"/SmartDashboard/Auto Choices": "String Chooser"
}
},
"NetworkTables Info": {
"visible": true
}
}
31 changes: 31 additions & 0 deletions src/main/deploy/pathplanner/autos/Example Auto.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"version": 1.0,
"startingPose": {
"position": {
"x": 2.0,
"y": 7.0
},
"rotation": 180.0
},
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "Run Flywheel"
}
},
{
"type": "path",
"data": {
"pathName": "Example Path"
}
}
]
}
},
"folder": null,
"choreoAuto": false
}
65 changes: 65 additions & 0 deletions src/main/deploy/pathplanner/paths/Example Path.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": 1.0,
"waypoints": [
{
"anchor": {
"x": 2.0,
"y": 7.0
},
"prevControl": null,
"nextControl": {
"x": 3.013282910175676,
"y": 6.5274984191074985
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 5.166769560390973,
"y": 5.0964860911203305
},
"prevControl": {
"x": 4.166769560390973,
"y": 6.0964860911203305
},
"nextControl": {
"x": 6.166769560390973,
"y": 4.0964860911203305
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 7.0,
"y": 1.0
},
"prevControl": {
"x": 6.75,
"y": 2.5
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0,
"rotation": 0,
"rotateFast": false
},
"reversed": false,
"folder": null,
"previewStartingState": null,
"useDefaultConstraints": false
}
40 changes: 37 additions & 3 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
// 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.
// Copyright 2021-2024 FRC 6328
// http://github.com/Mechanical-Advantage
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 3 as published by the Free Software Foundation or
// available in the root directory of this project.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

package frc.robot;

import edu.wpi.first.math.util.Units;

/**
* 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
Expand All @@ -13,6 +24,29 @@
* constants are needed, to reduce verbosity.
*/
public final class Constants {

public static class SwerveConstants {
public static final double MAX_LINEAR_SPEED = 5.56;
public static final double TRACK_WIDTH_X = Units.inchesToMeters(26.0);
public static final double TRACK_WIDTH_Y = Units.inchesToMeters(26.0);
public static final double DRIVE_BASE_RADIUS =
Math.hypot(TRACK_WIDTH_X / 2.0, TRACK_WIDTH_Y / 2.0);
public static final double MAX_ANGULAR_SPEED = MAX_LINEAR_SPEED / DRIVE_BASE_RADIUS;
}

public static class ModuleConstants {
public static final double WHEEL_RADIUS = Units.inchesToMeters(2.0);

public static final double DRIVE_STATOR_CURRENT_LIMIT = 40.0;
public static final boolean DRIVE_STATOR_CURRENT_LIMIT_ENABLED = true;
public static final double TURN_STATOR_CURRENT_LIMIT = 30.0;
public static final boolean TURN_STATOR_CURRENT_LIMIT_ENABLED = true;
}

public static final boolean tuningMode = true;

public static final String CANBUS = "CAN Bus 2";

public static enum Mode {
REAL,
SIM,
Expand Down
15 changes: 12 additions & 3 deletions src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
// 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.
// Copyright 2021-2024 FRC 6328
// http://github.com/Mechanical-Advantage
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 3 as published by the Free Software Foundation or
// available in the root directory of this project.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

package frc.robot;

Expand Down
Loading

0 comments on commit aa35f22

Please sign in to comment.