Skip to content

Commit 439a5bf

Browse files
committed
FtcRobotController v7.1
1 parent 704b694 commit 439a5bf

File tree

5 files changed

+200
-21
lines changed

5 files changed

+200
-21
lines changed

FtcRobotController/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.qualcomm.ftcrobotcontroller"
5-
android:versionCode="42"
6-
android:versionName="7.0">
5+
android:versionCode="44"
6+
android:versionName="7.1">
77

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

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/* Copyright (c) 2021 FIRST. All rights reserved.
2+
*
3+
* Redistribution and use in source and binary forms, with or without modification,
4+
* are permitted (subject to the limitations in the disclaimer below) provided that
5+
* the following conditions are met:
6+
*
7+
* Redistributions of source code must retain the above copyright notice, this list
8+
* of conditions and the following disclaimer.
9+
*
10+
* Redistributions in binary form must reproduce the above copyright notice, this
11+
* list of conditions and the following disclaimer in the documentation and/or
12+
* other materials provided with the distribution.
13+
*
14+
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
15+
* promote products derived from this software without specific prior written permission.
16+
*
17+
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
18+
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
package org.firstinspires.ftc.robotcontroller.external.samples;
31+
32+
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
33+
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
34+
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
35+
import com.qualcomm.robotcore.hardware.DcMotor;
36+
import com.qualcomm.robotcore.util.ElapsedTime;
37+
38+
/**
39+
* This file contains an example of a Linear "OpMode".
40+
* An OpMode is a 'program' that runs in either the autonomous or the teleop period of an FTC match.
41+
* The names of OpModes appear on the menu of the FTC Driver Station.
42+
* When a selection is made from the menu, the corresponding OpMode is executed.
43+
*
44+
* This particular OpMode illustrates driving a 4-motor Omni-Directional (or Holonomic) robot.
45+
* This code will work with either a Mecanum-Drive or an X-Drive train.
46+
* Both of these drives are illustrated at https://gm0.org/en/latest/docs/robot-design/drivetrains/holonomic.html
47+
* Note that a Mecanum drive must display an X roller-pattern when viewed from above.
48+
*
49+
* Holonomic drives provide the ability for the robot to move in three axes (directions) simultaneously.
50+
* Each motion axis is controlled by one Joystick axis.
51+
*
52+
* 1) Axial: Driving forward and backwards Left-joystick Forward/Backwards
53+
* 2) Lateral: Strafing right and left Left-joystick Right and Left
54+
* 3) Yaw: Rotating Clockwise and counter clockwise Right-joystick Right and Left
55+
*
56+
* This code is written assuming that the right-side motors need to be reversed for the robot to drive forward.
57+
* When you first test your robot, if it moves backwards when you push the left stick forward, then you must flip
58+
* the direction of all 4 motors (see code below).
59+
*
60+
* Use Android Studio to Copy this Class, and Paste it into your team's code folder with a new name.
61+
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
62+
*/
63+
64+
@TeleOp(name="Basic: Omni Linear OpMode", group="Linear Opmode")
65+
@Disabled
66+
public class BasicOmniOpMode_Linear extends LinearOpMode {
67+
68+
// Declare OpMode members for each of the 4 motors.
69+
private ElapsedTime runtime = new ElapsedTime();
70+
private DcMotor leftFrontDrive = null;
71+
private DcMotor leftBackDrive = null;
72+
private DcMotor rightFrontDrive = null;
73+
private DcMotor rightBackDrive = null;
74+
75+
@Override
76+
public void runOpMode() {
77+
78+
// Initialize the hardware variables. Note that the strings used here must correspond
79+
// to the names assigned during the robot configuration step on the DS or RC devices.
80+
leftFrontDrive = hardwareMap.get(DcMotor.class, "left_front_drive");
81+
leftBackDrive = hardwareMap.get(DcMotor.class, "left_back_drive");
82+
rightFrontDrive = hardwareMap.get(DcMotor.class, "right_front_drive");
83+
rightBackDrive = hardwareMap.get(DcMotor.class, "right_back_drive");
84+
85+
// Most robots need the motors on one side to be reversed to drive forward.
86+
// When you first test your robot, push the left joystick forward
87+
// and flip the direction ( FORWARD <-> REVERSE ) of any wheel that runs backwards
88+
leftFrontDrive.setDirection(DcMotor.Direction.REVERSE);
89+
leftBackDrive.setDirection(DcMotor.Direction.REVERSE);
90+
rightFrontDrive.setDirection(DcMotor.Direction.FORWARD);
91+
rightBackDrive.setDirection(DcMotor.Direction.FORWARD);
92+
93+
// Wait for the game to start (driver presses PLAY)
94+
telemetry.addData("Status", "Initialized");
95+
telemetry.update();
96+
97+
waitForStart();
98+
runtime.reset();
99+
100+
// run until the end of the match (driver presses STOP)
101+
while (opModeIsActive()) {
102+
double max;
103+
104+
// POV Mode uses left joystick to go forward & strafe, and right joystick to rotate.
105+
double axial = -gamepad1.left_stick_y; // Note: pushing stick forward gives negative value
106+
double lateral = gamepad1.left_stick_x;
107+
double yaw = gamepad1.right_stick_x;
108+
109+
// Combine the joystick requests for each axis-motion to determine each wheel's power.
110+
// Set up a variable for each drive wheel to save the power level for telemetry.
111+
double leftFrontPower = axial + lateral + yaw;
112+
double rightFrontPower = axial - lateral - yaw;
113+
double leftBackPower = axial - lateral + yaw;
114+
double rightBackPower = axial + lateral - yaw;
115+
116+
// Normalize the values so no wheel power exceeds 100%
117+
// This ensures that the robot maintains the desired motion.
118+
max = Math.max(Math.abs(leftFrontPower), Math.abs(rightFrontPower));
119+
max = Math.max(max, Math.abs(leftBackPower));
120+
max = Math.max(max, Math.abs(rightBackPower));
121+
122+
if (max > 1.0) {
123+
leftFrontPower /= max;
124+
rightFrontPower /= max;
125+
leftBackPower /= max;
126+
rightBackPower /= max;
127+
}
128+
129+
// This is test code:
130+
//
131+
// Uncomment the following code to test your motor directions.
132+
// Each button should make the corresponding motor run FORWARD.
133+
// 1) First get all the motors to take to correct positions on the robot
134+
// by adjusting your Robot Configuration if necessary.
135+
// 2) Then make sure they run in the correct direction by modifying the
136+
// the setDirection() calls above.
137+
// Once the correct motors move in the correct direction re-comment this code.
138+
139+
/*
140+
leftFrontPower = gamepad1.x ? 1.0 : 0.0; // X gamepad
141+
leftBackPower = gamepad1.a ? 1.0 : 0.0; // A gamepad
142+
rightFrontPower = gamepad1.y ? 1.0 : 0.0; // Y gamepad
143+
rightBackPower = gamepad1.b ? 1.0 : 0.0; // B gamepad
144+
*/
145+
146+
// Send calculated power to wheels
147+
leftFrontDrive.setPower(leftFrontPower);
148+
rightFrontDrive.setPower(rightFrontPower);
149+
leftBackDrive.setPower(leftBackPower);
150+
rightBackDrive.setPower(rightBackPower);
151+
152+
// Show the elapsed game time and wheel power.
153+
telemetry.addData("Status", "Run Time: " + runtime.toString());
154+
telemetry.addData("Front left/Right", "%4.2f, %4.2f", leftFrontPower, rightFrontPower);
155+
telemetry.addData("Back left/Right", "%4.2f, %4.2f", leftBackPower, rightBackPower);
156+
telemetry.update();
157+
}
158+
}}

FtcRobotController/src/main/res/menu/ftc_robot_controller.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,37 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3131
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232
-->
3333

34-
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
34+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
35+
xmlns:app="http://schemas.android.com/apk/res-auto">
3536

3637
<item
3738
android:id="@+id/action_settings"
3839
android:orderInCategory="100"
39-
android:showAsAction="never"
40+
app:showAsAction="never"
4041
android:title="@string/settings_menu_item"/>
4142
<item
4243
android:id="@+id/action_restart_robot"
4344
android:orderInCategory="200"
44-
android:showAsAction="never"
45+
app:showAsAction="never"
4546
android:title="@string/restart_robot_menu_item"/>
4647

4748
<item
4849
android:id="@+id/action_configure_robot"
4950
android:orderInCategory="300"
50-
android:showAsAction="never"
51+
app:showAsAction="never"
5152
android:title="@string/configure_robot_menu_item"/>
5253

5354
<item
5455
android:id="@+id/action_program_and_manage"
5556
android:orderInCategory="550"
56-
android:showAsAction="never"
57+
app:showAsAction="never"
5758
android:title="@string/program_and_manage_menu_item"/>
5859

5960
<item
60-
android:id="@+id/action_inspection_mode"
61-
android:orderInCategory="600"
62-
android:showAsAction="never"
63-
android:title="@string/inspection_mode_menu_item"/>
61+
android:id="@+id/action_inspection_mode"
62+
android:orderInCategory="600"
63+
app:showAsAction="never"
64+
android:title="@string/inspection_mode_menu_item"/>
6465

6566
<item
6667
android:id="@+id/action_about"

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Note that the online documentation is an "evergreen" document that is constantly
3838
### Javadoc Reference Material
3939
The Javadoc reference documentation for the FTC SDK is now available online. Click on the following link to view the FTC SDK Javadoc documentation as a live website:
4040

41-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[FTC Javadoc Documentation](https://javadoc.io/org.firstinspires.ftc)
41+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[FTC Javadoc Documentation](https://javadoc.io/doc/org.firstinspires.ftc)
4242

4343
### Online User Forum
4444
For technical questions regarding the Control System or the FTC SDK, please visit the FTC Technology forum:
@@ -54,6 +54,26 @@ The readme.md file located in the [/TeamCode/src/main/java/org/firstinspires/ftc
5454

5555
# Release Information
5656

57+
## Version 7.1 (20211223-120805)
58+
59+
* Fixes crash when calling `isPwmEnabled()` ([issue #223](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/233))
60+
* Fixes lint error ([issue #4](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/4))
61+
* Fixes Driver Station crash when attempting to use DualShock4 v1 gamepad with Advanced Gamepad Features enabled ([issue #173](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/173))
62+
* Fixes possible (but unlikely) Driver Station crash when connecting gamepads of any type
63+
* Fixes bug where Driver Station would use generic 20% deadzone for Xbox360 and Logitech F310 gamepads when Advanced Gamepad Features was disabled
64+
* Added SimpleOmniDrive sample OpMode
65+
* Adds UVC white balance control API
66+
* Fixes [issue 259](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/259) Most blocks samples for TensorFlow can't be used for a different model
67+
* The blocks previously labeled TensorFlowObjectDetectionFreightFrenzy (from the subcategory named "Optimized for Freight Frenzy") and TensorFlowObjectDetectionCustomModel (from the subcategory named "Custom Model") have been replaced with blocks labeled TensorFlowObjectDetection. Blocks in existing opmodes will be automatically updated to the new blocks when opened in the blocks editor.
68+
* Fixes [issue 260](https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/260) Blocks can't call java method that has a VuforiaLocalizer parameter
69+
* Blocks now has a block labeled VuforiaFreightFrenzy.getVuforiaLocalizer for this.
70+
* Added a page to manage the TensorFlow Lite models in /sdcard/FIRST/tflitemodels. To get to the TFLite Models page:
71+
* You can click on the link at the bottom of the the Manage page.
72+
* You can click on the link at the upper-right the Blocks project page.
73+
* Fixes logspam when `isBusy()` is called on a motor not in RTP mode
74+
* Hides the "RC Password" item on the inspection screen for phone-based Robot Controllers. (It is only applicable for Control Hubs)
75+
* Adds channel 165 to Wi-Fi Direct channel selection menu in the settings screen. (165 was previously available through the web UI, but not locally in the app)
76+
5777
## Version 7.0 (20210915-141025)
5878

5979
### Enhancements and New Features
@@ -96,7 +116,7 @@ The readme.md file located in the [/TeamCode/src/main/java/org/firstinspires/ftc
96116
* To see the full improvement, you must update both the Robot Controller and Driver Station apps
97117
* Updates samples located at [/FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples](FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples)
98118
* Added ConceptGamepadRumble and ConceptGamepadTouchpad samples to illustrtate the use of these new gampad capabilities.
99-
* Condensed existing Vuforia samples into just 2 samples (ConceptVuforiaFieldNavigation & ConceptVuforiaFieldNavigationWebcam) showing how to determine the robot's location on the field using Vuforia. These both use the current season's Target images.
119+
* Condensed existing Vuforia samples into just 2 samples (ConceptVuforiaFieldNavigation & ConceptVuforiaFieldNavigationWebcam) showing how to determine the robot's location on the field using Vuforia. These both use the current season's Target images.
100120
* Added ConceptVuforiaDriveToTargetWebcam to illustrate an easy way to drive directly to any visible Vuforia target.
101121
* Makes many improvements to the warning system and individual warnings
102122
* Warnings are now much more spaced out, so that they are easier to read

build.dependencies.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ repositories {
88
}
99

1010
dependencies {
11-
implementation 'org.firstinspires.ftc:Inspection:7.0.0'
12-
implementation 'org.firstinspires.ftc:Blocks:7.0.0'
13-
implementation 'org.firstinspires.ftc:Tfod:7.0.0'
14-
implementation 'org.firstinspires.ftc:RobotCore:7.0.0'
15-
implementation 'org.firstinspires.ftc:RobotServer:7.0.0'
16-
implementation 'org.firstinspires.ftc:OnBotJava:7.0.0'
17-
implementation 'org.firstinspires.ftc:Hardware:7.0.0'
18-
implementation 'org.firstinspires.ftc:FtcCommon:7.0.0'
11+
implementation 'org.firstinspires.ftc:Inspection:7.1.0'
12+
implementation 'org.firstinspires.ftc:Blocks:7.1.0'
13+
implementation 'org.firstinspires.ftc:Tfod:7.1.0'
14+
implementation 'org.firstinspires.ftc:RobotCore:7.1.0'
15+
implementation 'org.firstinspires.ftc:RobotServer:7.1.0'
16+
implementation 'org.firstinspires.ftc:OnBotJava:7.1.0'
17+
implementation 'org.firstinspires.ftc:Hardware:7.1.0'
18+
implementation 'org.firstinspires.ftc:FtcCommon:7.1.0'
1919
implementation 'org.tensorflow:tensorflow-lite-task-vision:0.2.0'
2020
implementation 'androidx.appcompat:appcompat:1.2.0'
2121
implementation 'org.firstinspires.ftc:gameAssets-FreightFrenzy:1.0.0'

0 commit comments

Comments
 (0)