This workspace is a full FTC SDK Android Studio project plus local helper scripts for working with the Control Hub.
This tutorial assumes you switch Wi-Fi by hand. Do not use ftc-net-run for
these steps.
Open this directory itself in Android Studio. Gradle should import two Android modules:
FtcRobotControllerTeamCode
The local OpMode source is:
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DanceBotAuto.java
Build the Robot Controller APK from Android Studio with Build > Make Project, or from the Android Studio Terminal:
./gradlew :TeamCode:assembleDebugThe debug APK is written to:
TeamCode/build/outputs/apk/debug/TeamCode-debug.apk
On macOS, manually join the Control Hub Wi-Fi:
SSID: FTC-L3OE
Password: password
Wait a few seconds, then confirm the Control Hub is reachable from the Android Studio Terminal:
ping -c 2 192.168.43.1Deploy over Control Hub Wi-Fi ADB and start the Robot Controller app:
./deploy-ftc-apkIf Android Studio prompts for a deploy target, use the Control Hub device at
192.168.43.1:5555.
For the underlying ADB commands used for FTC deployment and debugging, see
doc/ADB_TUTORIAL.md.
Keep the Mac connected to FTC-L3OE, lift the robot or make sure it has room to
move, then launch the autonomous OpMode from the Android Studio Terminal:
./run-ftc-opmode-robocol run-bounded 'DanceBot Auto' --duration 22 --allow-motionFor a one-motor-at-a-time diagnostic:
./run-ftc-opmode-robocol run-bounded 'DanceBot Motor Test' --duration 22 --allow-motionTo list the OpModes the Robot Controller sees:
./run-ftc-opmode-robocol listTail the OpMode logs in another Android Studio Terminal tab if needed:
./logcat-ftcIf the launcher times out and Logcat says Incompatible robocol versions, make
sure the script is using the same FTC SDK generation as the installed Robot
Controller app. This repo defaults to FTC SDK 11.1.0 / Robocol 124.
After manually connecting to the Control Hub Wi-Fi, you can use the shorter launcher on macOS or Linux:
./launch-dancebotOn Windows, use the batch launcher from Command Prompt or PowerShell:
.\launch-dancebot.batThe same launcher is available as Android Studio Gradle tasks:
./gradlew launchDanceBot
./gradlew launchDanceBotMotorTest
./gradlew listDanceBotOpModesUse DANCEBOT_DURATION=10 ./launch-dancebot to change the bounded run
duration on macOS or Linux. On Windows Command Prompt, run
set DANCEBOT_DURATION=10 before the .bat command. In PowerShell, run
$env:DANCEBOT_DURATION=10 first.
On Windows, the equivalent Gradle commands use gradlew.bat:
.\gradlew.bat launchDanceBot
.\gradlew.bat launchDanceBotMotorTest
.\gradlew.bat listDanceBotOpModesWhen you are done, manually switch the Mac back to your normal Wi-Fi.
If the app deploys but the robot does not move, run DanceBot Motor Test first.
It spins front_right, back_right, back_left, and front_left one at a time in both
directions and logs under the DanceBotMotorTest tag. Lift the robot or remove
the wheels before running this diagnostic.
This project is based on FTC SDK v11.1. The Driver Station app should be on
the same FTC SDK major/minor release as the Robot Controller app you deploy.
For a simple explanation of what the demo does and the FTC concepts it uses,
see doc/DANCEBOT_DEMO.md.
The old OnBot Java source mirror is still present at:
onbot/DanceBotAuto.java
The source-deploy helper still uses that mirror:
./deploy-ftc-dance-opmode
./build-ftc-onbotFor local Android Studio builds, edit the TeamCode copy first. Keep the
onbot mirror synchronized only if you still need the OnBot Java workflow.
This workspace contains ftc-net-run, a local macOS helper for commands that
must run while connected to the FTC Control Hub access point.
The helper:
- Records the current Wi-Fi SSID.
- Optionally disconnects VPN.
- Connects to
FTC-L3OE. - Waits for
http://192.168.43.1:8080/. - Runs the command you provide.
- Attempts to restore the previous Wi-Fi and reconnect VPN.
./ftc-net-run -- curl -I http://192.168.43.1:8080/If the FTC Wi-Fi password is not saved in Keychain:
FTC_WIFI_PASSWORD='your-password' ./ftc-net-run -- curl -I http://192.168.43.1:8080/For Cisco Secure Client, use:
CISCO_SECURE_CLIENT=1 ./ftc-net-run -- curl -I http://192.168.43.1:8080/The helper will try to detect the currently connected Cisco VPN host before it disconnects. You can also pin a VPN host explicitly:
CISCO_SECURE_CLIENT=1 \
CISCO_VPN_HOST='your-vpn-host.example.com' \
./ftc-net-run -- curl -I http://192.168.43.1:8080/If your VPN is managed by a macOS Network service:
VPN_SERVICE='Your VPN Name' ./ftc-net-run -- curl -I http://192.168.43.1:8080/If your VPN needs custom commands:
VPN_DISCONNECT_CMD='your disconnect command' \
VPN_RECONNECT_CMD='your reconnect command' \
./ftc-net-run -- curl -I http://192.168.43.1:8080/Run ./ftc-net-run --help for all supported environment variables.
To collect a read-only hardware/configuration report from the robot and then restore Cisco VPN:
./start-ftc-report-handoffIf macOS redacts the current SSID from command-line tools, provide the Wi-Fi network to restore:
RESTORE_SSID='Your Wi-Fi' ./start-ftc-report-handoffThat launcher starts a detached background job. Codex may disconnect while the job switches networks. After VPN reconnects, the report should be available at:
reports/latest-ftc-report.md
Each run also writes a full raw collection directory:
reports/ftc-robot-YYYYMMDD-HHMMSS/
The collector performs GET requests against the Robot Controller console and, if
ADB is available on 192.168.43.1:5555, pulls FTC configuration XML/JSON files
from /sdcard/FIRST. It does not start OpModes or send movement commands.
If you do not have a Driver Station available, install-ftc-controlhub-config
can install a minimal FTC hardware configuration over ADB. It assumes this Mac is
already connected to the Control Hub Wi-Fi and does not actuate motors.
./install-ftc-controlhub-configBy default it creates and activates dancebot.xml with four DC motors named
front_right, back_right, back_left, and front_left on the embedded
Control Hub motor ports 0, 1, 2, and 3, plus an intake motor on Expansion
Hub 2 motor port 0.
For the 312 rpm motors, the default XML tag is the generic FTC SDK motor type:
MOTOR_XML_TAG=Motor
If you want the closest built-in motor profile instead, use:
MOTOR_XML_TAG=NeveRest20Gearmotor ./install-ftc-controlhub-configThe script writes the XML file to /sdcard/FIRST, then uses Android run-as to
update the Robot Controller app's active hardware configuration preference. If
run-as is unavailable for the installed Robot Controller app, the XML can be
pushed but the script cannot make it active automatically.