Skip to content

Commit

Permalink
Merge pull request #12 from modular-ftc/update-to-5.2
Browse files Browse the repository at this point in the history
Update files to 5.2
  • Loading branch information
iamwood authored Sep 26, 2019
2 parents 5edba6e + 481d218 commit 8b04464
Show file tree
Hide file tree
Showing 21 changed files with 1,024 additions and 270 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.ftc_version = '4.3'
ext.ftc_version = '5.2'

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Oct 30 19:28:07 CDT 2017
#Thu Sep 26 15:11:49 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
6 changes: 4 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
targetSdkVersion 19
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

versionCode 30
versionName "$ftc_version.1"
versionCode 31
versionName "$ftc_version.0"

ndk {
abiFilters "armeabi-v7a"
Expand All @@ -37,6 +37,8 @@ dependencies {
implementation "org.first.ftc:analytics:$ftc_version"
implementation "org.first.ftc:wireless-p2p:$ftc_version"
implementation "org.first.ftc:vuforia-incomplete:$ftc_version"
implementation "org.first.ftc:onbotjava:$ftc_version"
implementation "org.first.ftc:robotserver:$ftc_version"

// Repackaged dependencies
implementation "com.github.modular-ftc:robotcore-repackaged:$ftc_version.0"
Expand Down
31 changes: 22 additions & 9 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.qualcomm.ftcrobotcontroller"
android:versionCode="31"
android:versionName="4.3">
android:versionCode="34"
android:versionName="5.2">

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Expand All @@ -14,19 +14,32 @@
android:label="@string/app_name"
android:theme="@style/AppThemeRedRC" >

<!-- Indicates to the ControlHubUpdater what the latest version of the Control Hub is that this app supports -->
<meta-data
android:name="org.firstinspires.latestSupportedControlHubVersion"
android:value="1" />

<!-- The main robot controller activity -->
<activity android:name="org.firstinspires.ftc.robotcontroller.internal.PermissionValidatorWrapper"
android:screenOrientation="fullUser"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTask" >

<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>

</activity>

<activity
android:name="org.firstinspires.ftc.robotcontroller.internal.FtcRobotControllerActivity"
android:screenOrientation="fullUser"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTask" >

<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>

<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
Expand All @@ -35,10 +48,10 @@
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />

<!--org.firstinspires.main.entry indicates that this app is compatible with the Dragonboard Control Hub-->
<meta-data
android:name="org.firstinspires.main.entry"
android:value="true"
/>
android:value="true" />
</activity>

<!-- The robot controller service in which most of the robot functionality is managed -->
Expand Down
Binary file added library/src/main/assets/Skystone.dat
Binary file not shown.
Binary file added library/src/main/assets/Skystone.tflite
Binary file not shown.
18 changes: 18 additions & 0 deletions library/src/main/assets/Skystone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<QCARConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="qcar_config.xsd">
<Tracking>
<ImageTarget name="TargetElement" size="101.599998 95.250000" />
<ImageTarget name="BridgeBlueRear" size="112.000000 47.740002" />
<ImageTarget name="BridgeRedRear" size="112.000000 47.740002" />
<ImageTarget name="BridgeRedFront" size="112.000000 47.740002" />
<ImageTarget name="BridgeBlueFront" size="112.000000 47.740002" />
<ImageTarget name="RedPerimeterTgt1" size="254.000000 168.116257" />
<ImageTarget name="RedPerimeterTgt2" size="254.000000 169.227493" />
<ImageTarget name="FrontPerimeterTgt1" size="254.000000 169.492188" />
<ImageTarget name="FrontPerimeterTgt2" size="254.000000 103.504997" />
<ImageTarget name="BluePerimeterTgt1" size="254.000000 169.386246" />
<ImageTarget name="BluePerimeterTgt2" size="254.000000 106.362503" />
<ImageTarget name="RearPerimeterTgt1" size="254.000000 169.239258" />
<ImageTarget name="RearPerimeterTgt2" size="254.000000 142.875000" />
</Tracking>
</QCARConfig>
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@

/**
*
* This OpMode executes a basic Tank Drive Teleop for a two wheeled robot using two REV SPARK Minis.
* To use this example, connect two REV SPARK Minis into servo ports on the Expansion Hub. On the
* robot configuration, use the drop down list under 'Servos' to select 'REV SPARK Mini Controller'
* This OpMode executes a basic Tank Drive Teleop for a two wheeled robot using two REV SPARKminis.
* To use this example, connect two REV SPARKminis into servo ports on the Expansion Hub. On the
* robot configuration, use the drop down list under 'Servos' to select 'REV SPARKmini Controller'
* and name them 'left_drive' and 'right_drive'.
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*/

@TeleOp(name="REV SPARK Mini Simple Drive Example", group="Concept")
@TeleOp(name="REV SPARKmini Simple Drive Example", group="Concept")
@Disabled
public class ConceptRevSPARKMini extends LinearOpMode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* INCREMENT sets how much to increase/decrease the servo position each cycle
* CYCLE_MS sets the update period.
*
* This code assumes a Servo configured with the name "left claw" as is found on a pushbot.
* This code assumes a Servo configured with the name "left_hand" as is found on a pushbot.
*
* NOTE: When any servo position is set, ALL attached servos are activated, so ensure that any other
* connected servos are able to move freely before running this test.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/* Copyright (c) 2018 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.firstinspires.ftc.robotcontroller.external.samples;

import android.content.Context;

import com.qualcomm.ftccommon.SoundPlayer;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;

/**
* This file demonstrates how to play one of the several SKYSTONE/Star Wars sounds loaded into the SDK.
* It does this by creating a simple "chooser" controlled by the gamepad Up Down buttons.
* This code also prevents sounds from stacking up by setting a "playing" flag, which is cleared when the sound finishes playing.
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*
* Operation:
* Use the DPAD to change the selected sound, and the Right Bumper to play it.
*/

@TeleOp(name="SKYSTONE Sounds", group="Concept")
@Disabled
public class ConceptSoundsSKYSTONE extends LinearOpMode {

// List of available sound resources
String sounds[] = {"ss_alarm", "ss_bb8_down", "ss_bb8_up", "ss_darth_vader", "ss_fly_by",
"ss_mf_fail", "ss_laser", "ss_laser_burst", "ss_light_saber", "ss_light_saber_long", "ss_light_saber_short",
"ss_light_speed", "ss_mine", "ss_power_up", "ss_r2d2_up", "ss_roger_roger", "ss_siren", "ss_wookie" };
boolean soundPlaying = false;

@Override
public void runOpMode() {

// Variables for choosing from the available sounds
int soundIndex = 0;
int soundID = -1;
boolean was_dpad_up = false;
boolean was_dpad_down = false;

Context myApp = hardwareMap.appContext;

// create a sound parameter that holds the desired player parameters.
SoundPlayer.PlaySoundParams params = new SoundPlayer.PlaySoundParams();
params.loopControl = 0;
params.waitForNonLoopingSoundsToFinish = true;

// In this sample, we will skip waiting for the user to press play, and start displaying sound choices right away
while (!isStopRequested()) {

// Look for DPAD presses to change the selection
if (gamepad1.dpad_down && !was_dpad_down) {
// Go to next sound (with list wrap) and display it
soundIndex = (soundIndex + 1) % sounds.length;
}

if (gamepad1.dpad_up && !was_dpad_up) {
// Go to previous sound (with list wrap) and display it
soundIndex = (soundIndex + sounds.length - 1) % sounds.length;
}

// Look for trigger to see if we should play sound
// Only start a new sound if we are currently not playing one.
if (gamepad1.right_bumper && !soundPlaying) {

// Determine Resource IDs for the sounds you want to play, and make sure it's valid.
if ((soundID = myApp.getResources().getIdentifier(sounds[soundIndex], "raw", myApp.getPackageName())) != 0){

// Signal that the sound is now playing.
soundPlaying = true;

// Start playing, and also Create a callback that will clear the playing flag when the sound is complete.
SoundPlayer.getInstance().startPlaying(myApp, soundID, params, null,
new Runnable() {
public void run() {
soundPlaying = false;
}} );
}
}

// Remember the last state of the dpad to detect changes.
was_dpad_up = gamepad1.dpad_up;
was_dpad_down = gamepad1.dpad_down;

// Display the current sound choice, and the playing status.
telemetry.addData("", "Use DPAD up/down to choose sound.");
telemetry.addData("", "Press Right Bumper to play sound.");
telemetry.addData("", "");
telemetry.addData("Sound >", sounds[soundIndex]);
telemetry.addData("Status >", soundPlaying ? "Playing" : "Stopped");
telemetry.update();
}
}
}
Loading

0 comments on commit 8b04464

Please sign in to comment.