Software Guide

From Team 449 Wiki

(Redirected from Software-guide)

This will guide you through installing all the software you need to write (and deploy) robot code from your home computer. A note on notation: option a -> option b means to click on option a in a menu, then click on option b in the dropdown menu that emerges out of option a.

Before we start

Here are the things you'll need:

  • Something running Windows 7 or newer, or Ubuntu (other Linux distros work, but I'm only providing examples using apt with the default Ubuntu repositories), or macOS, and admin access
  • An Internet connection

Also, update Windows to the newest version through Windows Update (scary, I know).

If you're running on macOS, please check out Homebrew and install it. These commands must be run as admin, and not as root (you can try - there are no negative effects).

Java

Robot code is written in Java, so you'll need to install the JDK.

Windows

Download the most recent version of the Java SE Development Kit here, and run it to install the JDK. All the default settings are fine. Find where the JDK was installed (normally C:\Program Files\Java\jdk[version] or C:\Program Files (x86)\Java\jdk[version]) and copy the file path. Then, pull up the "Edit system environment variables" window (easiest way to do this is to just type it "system environment" into the home menu) and click the "Environment Variables..." button in the bottom right. On the window that pops up, select the "New" button at the bottom. Put in the variable name as "JAVA_HOME" and the file path you just copied as the variable value. Click "okay" to confirm. Then, select the "Path" system variable, and click "Edit." Click "New" in the resulting pop-up, and put in %JAVA_HOME%\bin. Press enter to actually finalize that entry.

Ubuntu

Run sudo apt install default-jdk, then sudo nano /etc/environment and add the line JAVA_HOME="/usr/lib/jvm/default-java". Then, still in that file, add :$JAVA_HOME/bin to the end of the existing PATH variable. (don't put in the colon if there's one there already.)

macOS

Run brew tap caskroom/cask, then brew cask install java to install the JDK. Now, run echo 'export JAVA_HOME="/Library/Java/Home"' >> ~/.bash_profile, then run echo 'export PATH="$JAVA_HOME/bin:$PATH"' >> ~/.bash_profile.

Gradle

Gradle is a build tool we use. You can read more about it here.

Windows

Follow the instructions provided here under the "Install manually" section. Then, add a GRADLE_HOME environment variable, pointing to C:\Gradle\gradle-4.2 (people reading this in the future, replace 4.2 with your version number). You may also want to add %GRADLE_HOME%\bin to your Path instead of C:\Gradle\gradle-4.2\bin (as the instructions suggest) so that you only have to change your GRADLE_HOME when you update Gradle. Reboot your computer.

Ubuntu

Enter into a terminal:

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install gradle

Then, run sudo nano /etc/environment again, and add GRADLE_HOME="/home/USERNAME/.sdkman/candidates/gradle/current", of course replacing USERNAME with your name. Add :$GRADLE_HOME/bin to the end of the existing PATH variable and reboot.

macOS

Run brew install gradle. Then, run gradle -version. Take note of the version number at the top. Then, run echo 'export GRADLE_HOME="/usr/local/Cellar/gradle/<version_num>"' >> ~/.bash_profile, replacing <version_num> with the version number noted previously. Finally, add echo 'export PATH="$GRADLE_HOME/bin:$PATH"' >> ~/.bash_profile to finish up, and reboot.

Git

Version control is managed through GitHub. You need both Git and a GitHub account. You can make a GitHub account here.

Windows

Download git bash from here. Installing with all the default options is fine, although enabling symbolic links is recommended.

Ubuntu

Install the latest versions of git and gpg with

sudo apt update
sudo apt install git gpg

macOS

Install the latest version of gpg with brew install gpg.

Common Directions

In either terminal or git bash, type gpg --gen-key. Select "RSA and RSA" as the key type, 4096 bits as the keysize, and have it not expire. You can put what you want for real name and description, but use the same email you used when you signed up for GitHub. Make sure to choose a secure password (actually), because this key is used to cryptographically prove your identity. After the key finishes generating, type gpg --list-keys to make sure it generated properly. Then, copy the code of letters and numbers next to "pub" and after the slash (not 4096R, that's just info about the type of key). Type gpg --export -a [code you just copied], then copy the whole giant chunk of text it spits out. Go to GitHub, click on your profile in the top-right corner, select settings, and then on the left-hand side select "SSH and GPG keys." If you can't find it, just click here for now and you'll get helped later. Click "New GPG key" and paste in that giant block of text.

IntelliJ

IntelliJ is a Java IDE (like Eclipse) that's better than Eclipse in every way.

Installation

Until the sysops fix BILL, we have to use the free Community edition, but if you have a .edu email from somewhere, make a student account to get the professional version for free. Otherwise, make a regular account. Next download and install Jetbrains Toolbox. After it installs, open Toolbox (either from the Windows tray or the right side of the top bar in Ubuntu) press the button to install IntelliJ Community Edition.

Setup

After IntelliJ installs, click "Do not import settings." Next, select Darcula as the theme. This is not a personal preference thing, Darcula is strictly the best, as proven by Science. For the rest of the settings, defaults work fine. In the bottom right of the window that pops up after you finish the initial settings, click "Configure," then in that dropdow, "preferences." Go to Version Control -> GitHub, switch auth type from token to password, and put your login and password there. Then, go to Editor -> Code Style, and then for every language, check the boxes that say "Use tab character" and "Smart tabs" (if that's too much, you can just do it on Java, Groovy, YAML, and "Other File Types"). If you're on windows, go to Tools -> Terminal, and set the Shell Path to C:\Program Files\Git\bin\bash.exe. Click OK to apply the changes and go back to the home screen. Then, go to Configure -> Project Defaults -> Project Structure. In that window, for "Project SDK," if it says "<No SDK>," if there's another option in the dropdown menu, select that. Otherwise, press "New..." and select JDK. Pick the directory that your JAVA_HOME was set to. After that, press "OK." You should be all set up to use IntelliJ!

Project Setup

Once you're back on the home screen, click Check out from Version Control -> GitHub. For Git repository URL, enter https://github.com/blair-robot-project/robot[year].git (e.g. 2017 code would be https://github.com/blair-robot-project/robot2017.git). When a windows pops up saying "Am IntelliJ project file has been opened," click "okay." On the next window, "Import Gradle Project," just press "OK." When the next window pops up, with a small box in the bottom-right that says "Unindexed remote maven repositories found," click on it. In the windows that opens, named "Preferences," for all things listed there, click on them and then click "Update." Press okay after you do that (everything should still have the little "buffering" circle next to it, that's fine and it'll work in the background.) Next, use the shortcut on the screen to open Project View (Alt-1 for windows) and you should see the file tree show up on the left. Congratulations, you're ready to start writing code!

Driver Station (optional)

NI Driver station is the software we must use to drive the robot. Unfortunately, it's Windows-only (like if u cri everytim). Linux and mac users can try QDriverStation, which I've heard good things about but never tried. The driver station can be installed by downloading the update suite from NI. The 2017 Update Suite is located at the NI website. This will probably take an hour to install.

Once it installs, open it up and click on the gear tab on the left. Change the team number to 449 and the dashboard type to Java.