Skip to content

Commit

Permalink
Initial quickstart commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrott committed Aug 1, 2018
1 parent 4396aa8 commit 625bb8b
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 137 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "FtcDashboard"]
path = FtcDashboard
url = https://github.com/acmerobotics/ftc-dashboard
1 change: 1 addition & 0 deletions FtcDashboard
Submodule FtcDashboard added at e52004
7 changes: 4 additions & 3 deletions FtcRobotController/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// build.gradle in FtcRobotController
//
apply plugin: 'com.android.library'

android {

defaultConfig {
Expand All @@ -18,11 +17,13 @@ android {
targetCompatibility JavaVersion.VERSION_1_7
}
}

repositories {
flatDir {
dirs '../libs'
}
}

apply from: 'build.release.gradle'

dependencies {
implementation project(':FtcDashboard')
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import android.widget.LinearLayout;
import android.widget.TextView;

import com.acmerobotics.dashboard.RobotDashboard;
import com.google.blocks.ftcrobotcontroller.BlocksActivity;
import com.google.blocks.ftcrobotcontroller.ProgrammingModeActivity;
import com.google.blocks.ftcrobotcontroller.ProgrammingModeControllerImpl;
Expand Down Expand Up @@ -305,6 +306,8 @@ public void onClick(View v) {
ServiceController.startService(FtcRobotControllerWatchdogService.class);
bindToService();
logPackageVersions();

RobotDashboard.start();
}

protected UpdateUI createUpdateUI() {
Expand Down Expand Up @@ -384,6 +387,8 @@ protected void onDestroy() {

preferencesHelper.getSharedPreferences().unregisterOnSharedPreferenceChangeListener(sharedPreferencesListener);
RobotLog.cancelWriteLogcatToDisk();

RobotDashboard.stop();
}

protected void bindToService() {
Expand Down Expand Up @@ -582,6 +587,8 @@ private void requestRobotSetup() {
controllerService.setupRobot(eventLoop, idleLoop);

passReceivedUsbAttachmentsToEventLoop();

RobotDashboard.attachEventLoop(eventLoop);
}

protected OpModeRegister createOpModeRegister() {
Expand Down
6 changes: 3 additions & 3 deletions TeamCode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
// the build definitions, you can place those customizations in this file, but
// please think carefully as to whether such customizations are really necessary
// before doing so.


// Custom definitions may go here

// Include common definitions from above.
apply from: '../build.common.gradle'
dependencies {
implementation project(':FtcDashboard')
}
9 changes: 8 additions & 1 deletion TeamCode/build.release.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
repositories {
jcenter()
mavenLocal()
}

dependencies {
compile project(':FtcRobotController')
compile (name: 'RobotCore-release', ext: 'aar')
compile (name: 'Hardware-release', ext: 'aar')
compile (name: 'FtcCommon-release', ext: 'aar')
compile (name:'Analytics-release', ext:'aar')
compile (name:'WirelessP2p-release', ext:'aar')
}

compile 'com.acmerobotics.splinelib:core:0.1-SNAPSHOT'
}
13 changes: 13 additions & 0 deletions TeamCode/src/main/assets/trajectory/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
poses:
- x: 0.0
y: 0.0
heading: 0.0
- x: 20.0
y: 40.0
heading: 0.0
constraints:
maximumVelocity: 25.0
maximumAcceleration: 40.0
maximumAngularVelocity: 3.141592653589793
maximumAngularAcceleration: 6.283185307179586
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.acmerobotics.splinelib;

import com.acmerobotics.splinelib.trajectory.Trajectory;
import com.acmerobotics.splinelib.trajectory.TrajectoryConfig;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.module.kotlin.KotlinModule;

import org.firstinspires.ftc.robotcore.internal.system.AppUtil;

import java.io.IOException;
import java.io.InputStream;

public class AssetsTrajectoryLoader {
private static final ObjectMapper MAPPER = new ObjectMapper(new YAMLFactory());

static {
MAPPER.registerModule(new KotlinModule((512)));
}

public static TrajectoryConfig loadConfig(String name) throws IOException {
InputStream inputStream = AppUtil.getDefContext().getAssets().open("trajectory/" + name + ".yaml");
return MAPPER.readValue(inputStream, TrajectoryConfig.class);
}

public static Trajectory load(String name) throws IOException {
return loadConfig(name).toTrajectory();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.firstinspires.ftc.teamcode;

import com.acmerobotics.splinelib.AssetsTrajectoryLoader;
import com.acmerobotics.splinelib.trajectory.Trajectory;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;

import java.io.IOException;

@Autonomous
public class TestOpMode extends LinearOpMode {

@Override
public void runOpMode() throws InterruptedException {
try {
Trajectory trajectory = AssetsTrajectoryLoader.load("test");
System.out.println(trajectory.duration());
} catch (IOException e) {
e.printStackTrace();
}
}
}
121 changes: 0 additions & 121 deletions TeamCode/src/main/java/org/firstinspires/ftc/teamcode/readme.md

This file was deleted.

10 changes: 5 additions & 5 deletions build.common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'com.android.application'

android {

compileSdkVersion 23
compileSdkVersion 27
buildToolsVersion '25.0.3'

signingConfigs {
Expand All @@ -35,8 +35,8 @@ android {

defaultConfig {
applicationId 'com.qualcomm.ftcrobotcontroller'
minSdkVersion 19
targetSdkVersion 19
minSdkVersion 21
targetSdkVersion 27

/**
* We keep the versionCode and versionName of robot controller applications in sync with
Expand Down Expand Up @@ -85,8 +85,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

sourceSets.main {
Expand Down
19 changes: 18 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.android.tools.build:gradle:3.1.3'
}
}



repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}

allprojects {
repositories {
jcenter()
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx2048m
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Thu Jun 01 08:33:11 PDT 2017
#Sun Jul 29 18:03:48 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include ':FtcRobotController'
include ':TeamCode'
include ':FtcDashboard'

0 comments on commit 625bb8b

Please sign in to comment.