FtcRobotController v6.0

This commit is contained in:
Cal Kestis
2020-09-21 09:09:43 -07:00
parent 8b8b0988d4
commit 00cbf34452
108 changed files with 11204 additions and 0 deletions

23
TeamCode/build.gradle Normal file
View File

@ -0,0 +1,23 @@
//
// build.gradle in TeamCode
//
// Most of the definitions for building your module reside in a common, shared
// file 'build.common.gradle'. Being factored in this way makes it easier to
// integrate updates to the FTC into your code. If you really need to customize
// 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'
repositories {
maven { url = "https://dl.bintray.com/first-tech-challenge/ftcsdk/" }
}
dependencies {
annotationProcessor files('lib/OpModeAnnotationProcessor.jar')
}

View File

@ -0,0 +1,8 @@
dependencies {
implementation project(':FtcRobotController')
implementation 'org.firstinspires.ftc:RobotCore:6.0.1'
implementation 'org.firstinspires.ftc:Hardware:6.0.1'
implementation 'org.firstinspires.ftc:FtcCommon:6.0.1'
implementation (name: 'tfod-release', ext:'aar')
implementation (name: 'tensorflow-lite-0.0.0-nightly', ext:'aar')
}

Binary file not shown.

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Note: the actual manifest file used in your APK merges this file with contributions
from the modules on which your app depends (such as FtcRobotController, etc).
So it won't ultimately be as empty as it might here appear to be :-) -->
<!-- The package name here determines the package for your R class and your BuildConfig class -->
<manifest
package="org.firstinspires.ftc.teamcode"
xmlns:android="http://schemas.android.com/apk/res/android">
<application/>
</manifest>

View File

@ -0,0 +1,121 @@
## TeamCode Module
Welcome!
This module, TeamCode, is the place where you will write/paste the code for your team's
robot controller App. This module is currently empty (a clean slate) but the
process for adding OpModes is straightforward.
## Creating your own OpModes
The easiest way to create your own OpMode is to copy a Sample OpMode and make it your own.
Sample opmodes exist in the FtcRobotController module.
To locate these samples, find the FtcRobotController module in the "Project/Android" tab.
Expand the following tree elements:
FtcRobotController / java / org.firstinspires.ftc.robotcontroller / external / samples
A range of different samples classes can be seen in this folder.
The class names follow a naming convention which indicates the purpose of each class.
The full description of this convention is found in the samples/sample_convention.md file.
A brief synopsis of the naming convention is given here:
The prefix of the name will be one of the following:
* Basic: This is a minimally functional OpMode used to illustrate the skeleton/structure
of a particular style of OpMode. These are bare bones examples.
* Sensor: This is a Sample OpMode that shows how to use a specific sensor.
It is not intended as a functioning robot, it is simply showing the minimal code
required to read and display the sensor values.
* Hardware: This is not an actual OpMode, but a helper class that is used to describe
one particular robot's hardware devices: eg: for a Pushbot. Look at any
Pushbot sample to see how this can be used in an OpMode.
Teams can copy one of these to create their own robot definition.
* Pushbot: This is a Sample OpMode that uses the Pushbot robot structure as a base.
* Concept: This is a sample OpMode that illustrates performing a specific function or concept.
These may be complex, but their operation should be explained clearly in the comments,
or the header should reference an external doc, guide or tutorial.
* Library: This is a class, or set of classes used to implement some strategy.
These will typically NOT implement a full OpMode. Instead they will be included
by an OpMode to provide some stand-alone capability.
Once you are familiar with the range of samples available, you can choose one to be the
basis for your own robot. In all cases, the desired sample(s) needs to be copied into
your TeamCode module to be used.
This is done inside Android Studio directly, using the following steps:
1) Locate the desired sample class in the Project/Android tree.
2) Right click on the sample class and select "Copy"
3) Expand the TeamCode / java folder
4) Right click on the org.firstinspires.ftc.teamcode folder and select "Paste"
5) You will be prompted for a class name for the copy.
Choose something meaningful based on the purpose of this class.
Start with a capital letter, and remember that there may be more similar classes later.
Once your copy has been created, you should prepare it for use on your robot.
This is done by adjusting the OpMode's name, and enabling it to be displayed on the
Driver Station's OpMode list.
Each OpMode sample class begins with several lines of code like the ones shown below:
```
@TeleOp(name="Template: Linear OpMode", group="Linear Opmode")
@Disabled
```
The name that will appear on the driver station's "opmode list" is defined by the code:
``name="Template: Linear OpMode"``
You can change what appears between the quotes to better describe your opmode.
The "group=" portion of the code can be used to help organize your list of OpModes.
As shown, the current OpMode will NOT appear on the driver station's OpMode list because of the
``@Disabled`` annotation which has been included.
This line can simply be deleted , or commented out, to make the OpMode visible.
## ADVANCED Multi-Team App management: Cloning the TeamCode Module
In some situations, you have multiple teams in your club and you want them to all share
a common code organization, with each being able to *see* the others code but each having
their own team module with their own code that they maintain themselves.
In this situation, you might wish to clone the TeamCode module, once for each of these teams.
Each of the clones would then appear along side each other in the Android Studio module list,
together with the FtcRobotController module (and the original TeamCode module).
Selective Team phones can then be programmed by selecting the desired Module from the pulldown list
prior to clicking to the green Run arrow.
Warning: This is not for the inexperienced Software developer.
You will need to be comfortable with File manipulations and managing Android Studio Modules.
These changes are performed OUTSIDE of Android Studios, so close Android Studios before you do this.
Also.. Make a full project backup before you start this :)
To clone TeamCode, do the following:
Note: Some names start with "Team" and others start with "team". This is intentional.
1) Using your operating system file management tools, copy the whole "TeamCode"
folder to a sibling folder with a corresponding new name, eg: "Team0417".
2) In the new Team0417 folder, delete the TeamCode.iml file.
3) the new Team0417 folder, rename the "src/main/java/org/firstinspires/ftc/teamcode" folder
to a matching name with a lowercase 'team' eg: "team0417".
4) In the new Team0417/src/main folder, edit the "AndroidManifest.xml" file, change the line that contains
package="org.firstinspires.ftc.teamcode"
to be
package="org.firstinspires.ftc.team0417"
5) Add: include ':Team0417' to the "/settings.gradle" file.
6) Open up Android Studios and clean out any old files by using the menu to "Build/Clean Project""

View File

@ -0,0 +1 @@
Place your sound files in this folder to use them as project resources.

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>

View File

@ -0,0 +1,161 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<!--
This file can provide additional camera calibration settings beyond those built into the SDK itself.
Each calibration is for a particular camera (indicated by USB vid & pid pair) and a particular
capture resolution for the camera. Note: it is very important when capturing images used to calibrate
a camera that the image acquisition tool can actually control this capture resolution within the camera
itself and that you use this setting correctly. Many image acquistion tools do not in fact provide
this level of control.
Beyond simply providing additional, new camera calibrations, calibrations provided herein can
*replace/update* those that are builtin to the SDK. This matching is keyed, of course, by the
(vid, pid, size) triple. Further, if such a calibration has the 'remove' attribute with value 'true',
any existing calibration with that key is removed (and the calibration itself not added).
Calibrations are internally processed according to aspect ratio. If a format is requested in a size
that is not calibrated, but a calibration does exist for the same aspect ratio on the same camera,
then the latter will be scaled to accommodate the request. For example, if a 640x480 calibration
is requested but only a 800x600 calibration exists for that camera, then the 800x600 is scaled
down to service the 640x480 request.
Further, it is important to note that if *no* calibrations exist for a given camera, then Vuforia
is offered the entire range of capture resolutions that the hardware can support (and it does its
best to deal with the lack of calibration). However, if *any* calibrations are provided for a camera,
then capture resolutions in those aspect ratios supported by the camera for which any calibrations
are *not* provided are *not* offered. Thus, if you calibrate a camera but fail to calibrate all
the camera's supported aspect ratios, you limit the choices of capture resolutions that Vuforia can
select from.
One image acquisition program that supports control of camera capture resolution is YouCam 7:
https://www.cyberlink.com/products/youcam/features_en_US.html
Programs that can process acquired images to determine camera calibration settings include:
https://www.3dflow.net/3df-zephyr-free/ (see "Utilities/Images/Launch Camera Calibration" therein)
http://graphics.cs.msu.ru/en/node/909
Note that the type of images that must be acquired in order to calibrate is specific to the
calibration software used.
The required contents are illustrated here by example. Note that for the attribute names, both the
camelCase or the underscore_variations are supported; they are equivalent. The attributes for
each Calibration are as follows:
size (int pair): space separated camera resolution (width, height).
focalLength (float pair): space separated focal length value.
principalPoint (float pair): space separated principal point values (width, height).
distortionCoefficients (an 8-element float array): distortion coefficients in the following form
(r:radial, t:tangential): [r0, r1, t0, t1, r2, r3, r4, r5]
see https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
The examples here are commented out as the values are built-in to the FTC SDK. They serve instead
here as examples on how make your own.
-->
<Calibrations>
<!-- ======================================================================================= -->
<!-- Microsoft Lifecam HD 3000 v1, Calibrated by PTC using unknown tooling -->
<!-- <Camera vid="Microsoft" pid="0x0779">
<Calibration
size="640 480"
focalLength="678.154f, 678.17f"
principalPoint="318.135f, 228.374f"
distortionCoefficients="0.154576f, -1.19143f, 0f, 0f, 2.06105f, 0f, 0f, 0f"
/>
</Camera> -->
<!-- ======================================================================================= -->
<!-- Microsoft Lifecam HD 3000 v2, Calibrated by PTC using unknown tooling -->
<!-- <Camera vid="Microsoft" pid="0x0810">
<Calibration
size="640 480"
focalLength="678.154f, 678.17f"
principalPoint="318.135f, 228.374f"
distortionCoefficients="0.154576f, -1.19143f, 0f, 0f, 2.06105f, 0f, 0f, 0f"
/>
</Camera> -->
<!-- ======================================================================================= -->
<!-- Logitech HD Webcam C310, Calibrated by by Robert Atkinson, 2018.05.30 using 3DF Zephyr -->
<!-- <Camera vid="Logitech" pid="0x081B">
<Calibration
size="640 480"
focalLength="821.993f, 821.993f"
principalPoint="330.489f, 248.997f"
distortionCoefficients="-0.018522, 1.03979, 0, 0, -3.3171, 0, 0, 0"
/>
<Calibration
size="640 360"
focalLength="715.307f, 715.307f"
principalPoint="319.759f, 188.917f"
distortionCoefficients="-0.0258948, 1.06258, 0, 0, -3.40245, 0, 0, 0"
/>
</Camera> -->
<!-- ======================================================================================= -->
<!-- Logitech HD Pro Webcam C920, Calibrated by Robert Atkinson, 2018.05.30 using 3DF Zephyr -->
<!-- <Camera vid="Logitech" pid="0x082D">
<Calibration
size="640 480"
focalLength="622.001f, 622.001f"
principalPoint="319.803f, 241.251f"
distortionCoefficients="0.1208, -0.261599, 0, 0, 0.10308, 0, 0, 0"
/>
<Calibration
size="800 600"
focalLength="775.79f, 775.79f"
principalPoint="400.898f, 300.79f"
distortionCoefficients="0.112507, -0.272067, 0, 0, 0.15775, 0, 0, 0"
/>
<Calibration
size="640 360"
focalLength="463.566f, 463.566f"
principalPoint="316.402f, 176.412f"
distortionCoefficients="0.111626 , -0.255626, 0, 0, 0.107992, 0, 0, 0"
/>
<Calibration
size="1920, 1080"
focalLength="1385.92f , 1385.92f"
principalPoint="951.982f , 534.084f"
distortionCoefficients="0.117627, -0.248549, 0, 0, 0.107441, 0, 0, 0"
/>
<Calibration
size="800, 448"
focalLength="578.272f , 578.272f"
principalPoint="402.145f , 221.506f"
distortionCoefficients="0.12175, -0.251652 , 0, 0, 0.112142, 0, 0, 0"
/>
<Calibration
size="864, 480"
focalLength="626.909f , 626.909f"
principalPoint="426.007f , 236.834f"
distortionCoefficients="0.120988, -0.253336 , 0, 0, 0.102445, 0, 0, 0"
/>
</Camera> -->
<!-- ======================================================================================= -->
<!-- Logitech HD Webcam C270, Calibrated by Noah Andrews, 2019.03.13 using 3DF Zephyr -->
<!--<Camera vid="Logitech" pid="0x0825">
<Calibration
size="640 480"
focalLength="822.317f, 822.317f"
principalPoint="319.495f, 242.502f"
distortionCoefficients="-0.0449369, 1.17277, 0, 0, -3.63244, 0, 0, 0"
/>
</Camera> -->
<!-- ======================================================================================= -->
</Calibrations>