This repository has been archived by the owner on Sep 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd7069b
commit c310ea7
Showing
369 changed files
with
103,211 additions
and
0 deletions.
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,41 @@ | ||
License information | ||
|
||
================================================================================ | ||
FtcDriverStation, FtcRobotController, FtcCommon, Hardware, RobotCore | ||
ModernRobotics, Analytics, and WirelessP2p have the following license: | ||
|
||
Copyright (c) 2014-2016 Qualcomm Technologies Inc | ||
|
||
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 Qualcomm Technologies Inc nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
Qualcomm Technologies Inc., will periodically collect anonymous information | ||
about the device this software is installed on such as the make, model, and | ||
software versions, but no information that identifies you. | ||
|
||
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. | ||
|
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,29 @@ | ||
import java.util.regex.Pattern | ||
|
||
// | ||
// build.gradle in FtcRobotController | ||
// | ||
apply plugin: 'com.android.library' | ||
|
||
android { | ||
|
||
defaultConfig { | ||
minSdkVersion 19 | ||
targetSdkVersion 19 | ||
} | ||
|
||
compileSdkVersion 23 | ||
buildToolsVersion '23.0.3' | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dirs '../libs' | ||
} | ||
} | ||
|
||
apply from: 'build.release.gradle' |
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,10 @@ | ||
dependencies { | ||
compile (name:'Inspection-release', ext: 'aar') | ||
compile (name:'Blocks-release', ext: 'aar') | ||
compile (name:'RobotCore-release', ext: 'aar') | ||
compile (name:'Hardware-release', ext: 'aar') | ||
compile (name:'FtcCommon-release', ext: 'aar') | ||
compile (name:'ModernRobotics-release', ext:'aar') | ||
compile (name:'Analytics-release', ext:'aar') | ||
compile (name:'WirelessP2p-release', ext:'aar') | ||
} |
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,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.qualcomm.ftcrobotcontroller" | ||
android:versionCode="12" | ||
android:versionName="2.2"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
|
||
<activity | ||
android:name="org.firstinspires.ftc.robotcontroller.internal.FtcRobotControllerActivity" | ||
android:configChanges="orientation|screenSize" | ||
android:label="@string/app_name" | ||
android:launchMode="singleTask" > | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
|
||
<intent-filter> | ||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" | ||
android:resource="@xml/device_filter" /> | ||
</activity> | ||
|
||
<service | ||
android:name="com.qualcomm.ftccommon.FtcRobotControllerService" | ||
android:enabled="true" /> | ||
|
||
</application> | ||
|
||
</manifest> |
Binary file not shown.
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,9 @@ | ||
<?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="Wheels" size="254.000000 184.154922" /> | ||
<ImageTarget name="Tools" size="254.000000 184.154922" /> | ||
<ImageTarget name="Legos" size="254.000000 184.154922" /> | ||
<ImageTarget name="Gears" size="254.000000 184.154922" /> | ||
</Tracking> | ||
</QCARConfig> |
Binary file not shown.
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,7 @@ | ||
<?xml version="1.0"?> | ||
<QCARConfig xsi:noNamespaceSchemaLocation="qcar_config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<Tracking> | ||
<ImageTarget name="stones" size="247 173"/> | ||
<ImageTarget name="chips" size="247 173"/> | ||
</Tracking> | ||
</QCARConfig> |
128 changes: 128 additions & 0 deletions
128
...ava/org/firstinspires/ftc/robotcontroller/external/samples/ConceptCompassCalibration.java
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,128 @@ | ||
/* | ||
Copyright (c) 2016 Robert Atkinson | ||
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 Robert Atkinson nor the names of his 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 FITNESSFOR 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 com.qualcomm.ftccommon.DbgLog; | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
import com.qualcomm.robotcore.eventloop.opmode.Disabled; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.hardware.CompassSensor; | ||
import com.qualcomm.robotcore.hardware.LightSensor; | ||
import com.qualcomm.robotcore.util.ElapsedTime; | ||
|
||
/** | ||
* This file illustrates the concept of calibrating a MR Compass | ||
* It uses the common Pushbot hardware class to define the drive on the robot. | ||
* The code is structured as a LinearOpMode | ||
* | ||
* This code assumes there is a compass configured with the name "compass" | ||
* | ||
* This code will put the compass into calibration mode, wait three seconds and then attempt | ||
* to rotate two full turns clockwise. This will allow the compass to do a magnetic calibration. | ||
* | ||
* Once compete, the program will put the compass back into measurement mode and check to see if the | ||
* calibration was successful. | ||
* | ||
* Use Android Studio 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 | ||
*/ | ||
|
||
@Autonomous(name="Concept: Compass Calibration", group="Concept") | ||
@Disabled | ||
public class ConceptCompassCalibration extends LinearOpMode { | ||
|
||
/* Declare OpMode members. */ | ||
HardwarePushbot robot = new HardwarePushbot(); // Use a Pushbot's hardware | ||
private ElapsedTime runtime = new ElapsedTime(); | ||
CompassSensor compass; | ||
|
||
final static double MOTOR_POWER = 0.2; // scale from 0 to 1 | ||
static final long HOLD_TIME_MS = 3000; | ||
static final double CAL_TIME_SEC = 20; | ||
|
||
@Override | ||
public void runOpMode() throws InterruptedException { | ||
|
||
/* Initialize the drive system variables. | ||
* The init() method of the hardware class does all the work here | ||
*/ | ||
robot.init(hardwareMap); | ||
|
||
// get a reference to our Compass Sensor object. | ||
compass = hardwareMap.compassSensor.get("compass"); | ||
|
||
// Send telemetry message to signify robot waiting; | ||
telemetry.addData("Status", "Ready to cal"); // | ||
telemetry.update(); | ||
|
||
// Wait for the game to start (driver presses PLAY) | ||
waitForStart(); | ||
|
||
// Set the compass to calibration mode | ||
compass.setMode(CompassSensor.CompassMode.CALIBRATION_MODE); | ||
telemetry.addData("Compass", "Compass in calibration mode"); | ||
telemetry.update(); | ||
|
||
sleep(HOLD_TIME_MS); // Just do a sleep while we switch modes | ||
|
||
// Start the robot rotating clockwise | ||
telemetry.addData("Compass", "Calibration mode. Turning the robot..."); | ||
telemetry.update(); | ||
robot.leftMotor.setPower(MOTOR_POWER); | ||
robot.rightMotor.setPower(-MOTOR_POWER); | ||
|
||
// run until time expires OR the driver presses STOP; | ||
runtime.reset(); | ||
while (opModeIsActive() && (runtime.time() < CAL_TIME_SEC)) { | ||
|
||
idle(); // Always call idle() at the bottom of your while(opModeIsActive()) loop | ||
} | ||
|
||
// Stop all motors and turn off claibration | ||
robot.leftMotor.setPower(0); | ||
robot.rightMotor.setPower(0); | ||
compass.setMode(CompassSensor.CompassMode.MEASUREMENT_MODE); | ||
telemetry.addData("Compass", "Returning to measurement mode"); | ||
telemetry.update(); | ||
|
||
sleep(HOLD_TIME_MS); // Just do a sleep while we switch modes | ||
|
||
// Report whether the Calibration was successful or not. | ||
if (compass.calibrationFailed()) | ||
telemetry.addData("Compass", "Calibrate Failed. Try Again!"); | ||
else | ||
telemetry.addData("Compass", "Calibrate Passed."); | ||
telemetry.update(); | ||
|
||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...in/java/org/firstinspires/ftc/robotcontroller/external/samples/ConceptDIMAsIndicator.java
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,75 @@ | ||
package org.firstinspires.ftc.robotcontroller.external.samples; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
import com.qualcomm.robotcore.eventloop.opmode.Disabled; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; | ||
import com.qualcomm.robotcore.util.ElapsedTime; | ||
|
||
/** | ||
* This OpMode illustrates using the Device Interface Module as a signalling device. | ||
* The code is structured as a LinearOpMode | ||
* | ||
* This code assumes a DIM name "dim". | ||
* | ||
* There are many examples where the robot might like to signal the driver, without requiring them | ||
* to look at the driver station. This might be something like a "ball in hopper" condition or a | ||
* "ready to shoot" condition. | ||
* | ||
* The DIM has two user settable indicator LEDs (one red one blue). These can be controlled | ||
* directly from your program. | ||
* | ||
* 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 | ||
*/ | ||
@Autonomous(name = "Concept: DIM As Indicator", group = "Concept") | ||
@Disabled | ||
public class ConceptDIMAsIndicator extends LinearOpMode { | ||
|
||
static final int BLUE_LED = 0; // Blue LED channel on DIM | ||
static final int RED_LED = 1; // Red LED Channel on DIM | ||
|
||
// Create timer to toggle LEDs | ||
private ElapsedTime runtime = new ElapsedTime(); | ||
|
||
// Define class members | ||
DeviceInterfaceModule dim; | ||
|
||
@Override | ||
public void runOpMode() throws InterruptedException { | ||
|
||
// Connect to motor (Assume standard left wheel) | ||
// Change the text in quotes to match any motor name on your robot. | ||
dim = this.hardwareMap.deviceInterfaceModule.get("dim"); | ||
|
||
// Toggle LEDs while Waiting for the start button | ||
telemetry.addData(">", "Press Play to test LEDs." ); | ||
telemetry.update(); | ||
|
||
while (!isStarted()) { | ||
// Determine if we are on an odd or even second | ||
boolean even = (((int)(runtime.time()) & 0x01) == 0); | ||
dim.setLED(RED_LED, even); // Red for even | ||
dim.setLED(BLUE_LED, !even); // Blue for odd | ||
idle(); | ||
} | ||
|
||
// Running now | ||
telemetry.addData(">", "Press X for Blue, B for Red." ); | ||
telemetry.update(); | ||
|
||
// Now just use red and blue buttons to set red and blue LEDs | ||
while(opModeIsActive()){ | ||
dim.setLED(BLUE_LED, gamepad1.x); | ||
dim.setLED(RED_LED, gamepad1.b); | ||
idle(); | ||
} | ||
|
||
// Turn off LEDs; | ||
dim.setLED(BLUE_LED, false); | ||
dim.setLED(RED_LED, false); | ||
telemetry.addData(">", "Done"); | ||
telemetry.update(); | ||
} | ||
} |
Oops, something went wrong.