Pushing and Pulling Configuration Files
One of the most amazing operations I learned to perform is how to pull configuration files off of Robot Controller phones and push them onto different robot controllers.
This is helpful for a couple reasons
To be able to access these push and pull commands, its recommend to have the ADB in your computer’s PATH variable. Setting this up is different depending on if you’re on Windows, Mac or Linux.
Note: you can skip to step 3 if you know your Android SDK is in your PATH variable.
This is helpful for a couple reasons
- Super time-saving
- Quickly edit configurations on PC
- Write a script to push multiple configurations
To be able to access these push and pull commands, its recommend to have the ADB in your computer’s PATH variable. Setting this up is different depending on if you’re on Windows, Mac or Linux.
Note: you can skip to step 3 if you know your Android SDK is in your PATH variable.
Step 1: Locate your Android SDK
Android Studio Welcome Screen > Configure > SDK Manager > Android SDK Location
Make note of this file path, as we’ll need it shortly
Make note of this file path, as we’ll need it shortly
Step 2: Add the Android SDK to your path environment
Windows
If you would rather watch a video on this, you can watch for Windows 7 or Windows 10.
Search “Edit the system environment variables” > Environment Variables… > New…
For Variable name: enter “PATH” (yes, all uppercase)
For Variable value: enter “path\to\android\sdk\ platform-tools ”
For example: C:\Users\Public\Documents\Android-SDK\platform-tools
If you would rather watch a video on this, you can watch for Windows 7 or Windows 10.
Search “Edit the system environment variables” > Environment Variables… > New…
For Variable name: enter “PATH” (yes, all uppercase)
For Variable value: enter “path\to\android\sdk\ platform-tools ”
For example: C:\Users\Public\Documents\Android-SDK\platform-tools
Mac
Open the Terminal application (/Applications/Utilities/Terminal.app)
Type in the following command:
Open the Terminal application (/Applications/Utilities/Terminal.app)
Type in the following command:
Close and re-open the Terminal app
Linux
Open your terminal application (way too many distros to list filepaths here, usually Ctrl+Alt+T works (wait, you're using Linux without knowing how to open a terminal?))
Type in the following command:
Open your terminal application (way too many distros to list filepaths here, usually Ctrl+Alt+T works (wait, you're using Linux without knowing how to open a terminal?))
Type in the following command:
Close and re-open the terminal application
Step 3: Actually using it!
Now that our command prompt / terminal knows where the Android SDK is, we can use ADB without typing out the full path name!
Plug in your Robot Controller phone, open Command Prompt or Terminal and type the following command:
Plug in your Robot Controller phone, open Command Prompt or Terminal and type the following command:
If all went well, your device should show up as 'online'. You don't do this everytime you want to push or pull, this is just to make sure ADB is working and your device is connected.
Pulling configuration
To pull a configuration file off the phone, you can use the following command:
Pulling configuration
To pull a configuration file off the phone, you can use the following command:
This works because FIRST stores configurations as .xml files in the directory /sdcard/FIRST on your robot controller.
Pushing configuration
To push a configuration file onto a robot controller, you can use the following command:
Pushing configuration
To push a configuration file onto a robot controller, you can use the following command:
For example:
It's also useful to know that if you push using a different name in the than the filename in the second argument, the name of the configuration file will be changed! So this is completely valid:
Now BrandNewConfig1 will show up on the phone!
Step 4: Write a script! (optional)
Put your configuration files into a folder
Follow this template to push all config files into the phone's configuration directory
Follow this template to push all config files into the phone's configuration directory
Save the script under run.bat on Windows or run.sh on Mac/Linux
If you're on Windows: double click and it should push all your configurations!
If you're on Mac/Linux:
1. Change your working directory to your folder with your configuration files
2. run chmod +x run.sh to make your script executable to the current user
3. run ./run.sh to run your script
Thanks for reading!
If you're on Windows: double click and it should push all your configurations!
If you're on Mac/Linux:
1. Change your working directory to your folder with your configuration files
2. run chmod +x run.sh to make your script executable to the current user
3. run ./run.sh to run your script
Thanks for reading!