Skip to content

TitanRobotics/2022-FRC-2013

Repository files navigation

Introduction

Well, build season is finally here, so it is time to get fired up! Once season starts, it will be a firestorm: the lab will be open every day during Intersession and every night for the next 5 weeks from 7 to 10. Anytime you are available, stop by! There is always something to work on.

This year, we will be switching to Java from C++ and from SVN to Git, so if you know any Java programmers, tell them to stop by when they can. The more programmers, the merrier!

Remember: The only people touching this code directly are sophomores and juniors. It is your time to shine! Keep your eyes on the Wiki for updates and documentation.

Final Comment: Remember to comment your code!

Here's to a good season. Good Luck!

Installation Steps

You should use Eclipse to do the actual code editing, compiling, and deploying to the Robot.

Installing Eclipse

Windows and Mac users can download the latest Eclipse binary from the project website: http://www.eclipse.org/downloads/

Linux users can download from their repositories

sudo apt-get install openjdk-7-jdk eclipse

Here are instructions provided by FIRST to using Eclipse for FRC. FRC Eclipse Plugin

If you need Oracle's official JDK 7, it can be found here.

Once you have Eclipse set up, point it to our team number, but otherwise there is no need to create a new project. The project you will be working on is right here!

Code sharing will be handled by git through github, which you see here.

Git Setup Instructions

Windows

You have Two Options!

One is to try out Github for Windows. I haven't used it myself, but you can try it! Don't forget to install Git Flow too!

Otherwise, start out by installing the latest version of Git for Windows. This is a bit harder to set up, but I have it running on my machine and it works like a charm. When the installation starts, you want to choose all the default options, please make no modifications. So, you should use Git Bash only, Checkout Windows-Style Commit Unix-Style line endings, etc.

####Now to install Git Flow!

Specific install instructions for GitHub for Windows can be found here.

Otherwise, try the instructions below:

Download and install getopt.exe from the util-linux package binaries and libintl3.dll from the dependencies package into C:\Program Files (x86)\Git\bin. (Only getopt.exe and libintl3.dll, the others util-linux files are not used).

In the Git Bash Program, clone the git-flow sources from GitHub:

$ cd /c
$ git clone --recursive git://github.com/nvie/gitflow.git
$ cd gitflow

Run the msysgit-install script from a Windows command line prompt (search for cmd and run it as an administrator):

C:\Windows\system32> cd C:\gitflow
C:\gitflow> contrib\msysgit-install.cmd "C:\Program Files (x86)\Git"

To validate the installation, go back into Git Bash make sure that you can call for help:

$ git flow help

Note: Whenever you use Git, you should be working from inside the Git Bash program!

Continue to Git Usage Instructions.

Mac OS X

Start out by downloading and installing Homebrew, a Mac-specific package manager.

Then, run the following command:

brew install git git-flow

Continue to the Git Usage Instructions.

Linux (Ubuntu and Derivatives)

It's easy! Just run:

sudo apt-get install git git-flow

Continue to the Git Usage Instructions.

Git Usage Instructions (Git for Windows)

If you use GitHub for Windows, you will not need to follow most of these instructions, but you MUST use git flow features if you want to make changes, so see if you can get it working!

Identify Yourself!

Start by running the following commands with your GitHub username and email:

git config --global user.name "User name"
git config --global user.email [email protected]

Note: This email will be visible to everybody else working on GitHub.

Checking Out a Repo

The first step to coding is to check out the repository. Start out by browsing to your Eclipse Workspace using the cd command.

Here is an example if your Eclipse workspace is located in ~/Documents/workspace.

cd ~/Documents/workspace
git clone https://github.com/egordon/2022-FRC-2013.git

For editing, you can then go into Eclipse and import the project (File -> Import -> Existing Projects into Workspace).

IMPORTANT: To check status of you repo: run

git status

from inside of the 2022-FRC-2013 folder you just created.

Staging, Commiting, and Pushing (Also: What NOT to do!)

Git has three steps for sharing code: staging changes, commiting changes locally, and pushing those changes to GitHub.

For this example, lets say that you made a change that solved issue #100 by creating a new subsystem.

Step 1: Stage the changed files to be shared:

cd ~/Documents/workspace/2022-FRC-2013
git add src/org/usfirst/frc2022/subsystems/EXAMPLE.java

Step 2: Commit the change locally with a comment referencing the issue number. This will commit ALL local changes that were staged with the add command, but not share them to the server.

git commit -m "Issue #100: Brief comment about the new code"

There is no need to add your name to the comment, but you should have the issue number (with the # sign) included!

Step 3: Push ALL local changes to GitHub:

git push

Ok, now for what you should not do: the above. By default, you are working on the master branch of the program, and you should not be pushing your code to that branch since it represents the final code. Instead, when fixing issues and making changes, you should follow the guidelines for Git Flow.

Using Git Flow for Branching

Start by going into the program directory and initializing Git Flow with all the defaults:

cd ~/Documents/workspace/2022-FRC-2013
git flow init

Next is to create a feature branch. This is a piece of code that is a copy of the master branch that you can make changes to without fear of screwing anything up. You want to name the feature branch to reflect what you are trying to do, including the Issue Number!

Lets use Issue 100 as an example:

git flow feature start 100-new-drivebase-subsystem

To put the feature on GitHub:

git flow feature publish 100-new-drivebase-subsystem

To check which feature you are on, run one of these two commands:

git branch
git flow feature

After you set up your feature, you can use 'git add', 'git commit', and 'git push' normally. After you push, you can review the changes you made on GitHub.

Once you finish pushing your feature changes, you can go onto GitHub and review your changes and discuss them with others. When you finish your feature and tested to make sure that it works, find i t on GitHub and issue a Pull Request from the button on the top of the screen. From there, while you can merge it into the master branch yourself, I will ask that you let either Vimig, Andrew, or Ethan review it first.

A Side Note on GitHub for Windows...

If you would like to try using GitHub for Windows, please follow the information on GitHub's site. Note that you might have to do so quick searching through the file system to get it set up!

That's It! Any Questions?

[email protected]

The following people have successfully completed their tutorial issue!

Ethan Gordon Emma Sloan Nick Magerko Dennis Rich Malachi Loviska Andrew Kazenas Michael Hrcek Vimig Socrates Arthur Li Andrew Kuznetsov