Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
Merge branch 'frc_2019'
Browse files Browse the repository at this point in the history
  • Loading branch information
jhh committed Jan 7, 2019
2 parents bd6d909 + 6993b6c commit eece1fa
Show file tree
Hide file tree
Showing 13 changed files with 221 additions and 53 deletions.
4 changes: 3 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
".gitignore",
"gradlew",
"gradlew.bat",
"gradle/wrapper/gradle-wrapper.jar"
"gradle/wrapper/gradle-wrapper.jar",
"vendordeps/phoenix.json",
"vendordeps/navx.json"
]
}
7 changes: 7 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def rm_tree(top):
rm_tree(os.path.join(MAIN_DIR, "resources"))
rm_src_file("command", "LogCommand")

# vendor deps
if (
"{{ cookiecutter.use_thirdcoast_swerve }}" != "y"
and "{{ cookiecutter.use_thirdcoast_telemetry }}" != "y"
):
rm_tree(os.path.join(PROJECT_DIR, "vendordeps"))

# swerve
if "{{ cookiecutter.use_thirdcoast_swerve }}" != "y":
rm_src_file("command", "TeleOpDriveCommand")
Expand Down
6 changes: 6 additions & 0 deletions {{cookiecutter.project_slug}}/.wpilib/wpilib_preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"enableCppIntellisense": false,
"currentLanguage": "java",
"projectYear": "2019",
"teamNumber": {{ cookiecutter.frc_team }}
}
79 changes: 40 additions & 39 deletions {{cookiecutter.project_slug}}/build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
import edu.wpi.first.gradlerio.GradleRIOPlugin
import edu.wpi.first.gradlerio.frc.FRCJavaArtifact
import edu.wpi.first.gradlerio.frc.RoboRIO

plugins {
{% if cookiecutter.use_kotlin == 'y' %}
id "org.jetbrains.kotlin.jvm" version "1.3.11"
{% else %}
id "java"
{% endif %}
id "edu.wpi.first.GradleRIO" version "2019.0.0-alpha-3"
id "edu.wpi.first.GradleRIO" version "2019.1.1"
id "idea"
{% if cookiecutter.use_spotless == 'y' %}
id "com.diffplug.gradle.spotless" version "3.16.0"
id "com.diffplug.gradle.spotless" version "3.16.0"
{% endif %}
}

def TEAM = {{ cookiecutter.frc_team }}
def ROBOT_CLASS = "{{ cookiecutter.package_name }}.Robot"
{% if cookiecutter.use_kotlin == 'y' %}
def ROBOT_MAIN_CLASS = "{{ cookiecutter.package_name }}.MainKt"
{% else %}
def ROBOT_MAIN_CLASS = "{{ cookiecutter.package_name }}.Main"
{% endif %}

repositories {
jcenter()
deploy {
targets {
roboRIO("roborio") {
team = frc.getTeamNumber() // loaded from .wpilib/wpilib_preferences.json
}
}
artifacts {
frcJavaArtifact("frcJava") {
targets << "roborio"
debug = frc.getDebugOrDefault(false)
}
// Built in artifact to deploy arbitrary files to the roboRIO.
fileTreeArtifact("frcStaticFileDeploy") {
// The directory below is the local directory to deploy
files = fileTree(dir: "src/main/deploy")
// Deploy to RoboRIO target, into /home/lvuser/deploy
targets << "roborio"
directory = "/home/lvuser/deploy"
}
}
}

wpi {
ctreVersion = "5.7.1.0"
repositories {
jcenter()
maven { url = "https://raw.githubusercontent.com/Open-RIO/Maven-Mirror/master/m2" } // FIXME
}

dependencies {
{% if cookiecutter.use_kotlin == 'y' %}
{% if cookiecutter.use_kotlin == 'y' %}
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}"
{% endif %}
compile wpilib()
{% if cookiecutter.use_thirdcoast_swerve == 'y' or cookiecutter.use_thirdcoast_telemetry == 'y' %}
compile ctre()
compile navx()
{% endif %}
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)

{% if cookiecutter.use_thirdcoast_swerve == 'y' %}
compile "org.strykeforce.thirdcoast:swerve:${thirdcoastVersion}"
{% endif %}
Expand All @@ -53,31 +71,14 @@ dependencies {
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs = ['-progressive']
}
}
{% endif %}

def robotManifest = {
attributes "Main-Class": "edu.wpi.first.wpilibj.RobotBase"
attributes "Robot-Class": frc.robotClass
}

jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
manifest GradleRIOPlugin.javaManifest(ROBOT_CLASS)
}

deploy {
targets {
target("roborio", RoboRIO) {
team = TEAM
}
}
artifacts {
artifact("frcJava", FRCJavaArtifact) {
targets << "roborio"
}
}
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
}

idea {
Expand All @@ -93,4 +94,4 @@ spotless {
googleJavaFormat()
}
}
{% endif %}
{% endif %}
Binary file modified {{cookiecutter.project_slug}}/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Aug 23 17:37:51 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
zipStorePath=permwrapper/dists
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package {{ cookiecutter.package_name }};

import edu.wpi.first.wpilibj.RobotBase;

/**
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
* you are doing, do not modify this file except to change the parameter class to the startRobot
* call.
*/
public final class Main {
private Main() {}

/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
public static void main(String... args) {
RobotBase.startRobot(Robot::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ private Wheel[] getWheels() {
azimuthConfig.continuousCurrentLimit = 10;
azimuthConfig.peakCurrentDuration = 0;
azimuthConfig.peakCurrentLimit = 0;
azimuthConfig.slot_0.kP = 10.0;
azimuthConfig.slot_0.kI = 0.0;
azimuthConfig.slot_0.kD = 100.0;
azimuthConfig.slot_0.kF = 0.0;
azimuthConfig.slot_0.integralZone = 0;
azimuthConfig.slot_0.allowableClosedloopError = 0;
azimuthConfig.slot0.kP = 10.0;
azimuthConfig.slot0.kI = 0.0;
azimuthConfig.slot0.kD = 100.0;
azimuthConfig.slot0.kF = 0.0;
azimuthConfig.slot0.integralZone = 0;
azimuthConfig.slot0.allowableClosedloopError = 0;
azimuthConfig.motionAcceleration = 10_000;
azimuthConfig.motionCruiseVelocity = 800;

Expand All @@ -109,7 +109,7 @@ private Wheel[] getWheels() {
TalonSRX driveTalon = new TalonSRX(i + 10);
driveTalon.configAllSettings(driveConfig);
driveTalon.setNeutralMode(NeutralMode.Brake);

{% if cookiecutter.use_thirdcoast_telemetry == 'y' -%}
telemetryService.register(azimuthTalon);
telemetryService.register(driveTalon);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package {{ cookiecutter.package_name }}

import edu.wpi.first.wpilibj.RobotBase

/**
* Main initialization function. Do not perform any initialization here.
*
* <p>If you change your main robot class, change the parameter type.
*/
fun main(args : Array<String>) {
RobotBase.startRobot(::Robot)
}
33 changes: 33 additions & 0 deletions {{cookiecutter.project_slug}}/vendordeps/navx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"fileName": "navx_frc.json",
"name": "KauaiLabs_navX_FRC",
"version": "3.1.344",
"uuid": "cb311d09-36e9-4143-a032-55bb2b94443b",
"mavenUrls": [
"https://repo1.maven.org/maven2/"
],
"jsonUrl": "https://www.kauailabs.com/dist/frc/2019/navx_frc.json",
"javaDependencies": [
{
"groupId": "com.kauailabs.navx.frc",
"artifactId": "navx-java",
"version": "3.1.344"
}
],
"jniDependencies": [],
"cppDependencies": [
{
"groupId": "com.kauailabs.navx.frc",
"artifactId": "navx-cpp",
"version": "3.1.344",
"headerClassifier": "headers",
"sourcesClassifier": "sources",
"sharedLibrary": false,
"libName": "navx_frc",
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"linuxathena"
]
}
]
}
87 changes: 87 additions & 0 deletions {{cookiecutter.project_slug}}/vendordeps/phoenix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"fileName": "Phoenix.json",
"name": "CTRE-Phoenix",
"version": "5.12.0",
"uuid": "ab676553-b602-441f-a38d-f1296eff6537",
"mavenUrls": [
"http://devsite.ctr-electronics.com/maven/release/"
],
"jsonUrl": "http://devsite.ctr-electronics.com/maven/release/com/ctre/phoenix/Phoenix-latest.json",
"javaDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "api-java",
"version": "5.12.0"
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-java",
"version": "5.12.0"
}
],
"jniDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "cci",
"version": "5.12.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"linuxathena",
"windowsx86-64",
"linuxx86-64"
]
}
],
"cppDependencies": [
{
"groupId": "com.ctre.phoenix",
"artifactId": "wpiapi-cpp",
"version": "5.12.0",
"libName": "CTRE_Phoenix_WPI",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"linuxathena",
"windowsx86-64",
"linuxx86-64"
]
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "api-cpp",
"version": "5.12.0",
"libName": "CTRE_Phoenix",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"linuxathena",
"windowsx86-64",
"linuxx86-64"
]
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "cci",
"version": "5.12.0",
"libName": "CTRE_PhoenixCCI",
"headerClassifier": "headers",
"sharedLibrary": false,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"linuxathena",
"windowsx86-64",
"linuxx86-64"
]
},
{
"groupId": "com.ctre.phoenix",
"artifactId": "core",
"version": "5.12.0",
"libName": "CTRE_PhoenixCore",
"headerClassifier": "headers"
}
]
}

0 comments on commit eece1fa

Please sign in to comment.