This is The Metal Jackets robot code for the 2020 FIRST Robotics Competition, Inifinite Recharge.
- FIRST Robotics Competition Docs
- SPARK MAX and Status Lights/Codes
- REV Robotics Analog Pressure Sensor
- LimeLight
- REV Robotics Color Sensor
Until we define our own coding style, we'll use Google's and record any deviations here.
Follow the WPILib Installation Guide to set up your environment.
You'll need the following extensions:
- TBD
- TBD
You should've already set the location of your JDK installation in the above tutorial. If you need to set it again, here are the instructions.
- Navigate to
File -> Preferences -> Settings - Search for "jdk" in the search bar
- Click
Java Configurationon the left-hand sidebar. The only setting visible should beJava: Home - Click on
Edit in settings.json - The right-hand side stores any settings made by the user. Add a line like this at the end of the file:
"java.home": "/Path/To/JDK/Installation"- If you don't know where your JDK installation is, it's probably in
C:\Users\<Your Username>\frc2020\jdk.
- If you don't know where your JDK installation is, it's probably in
- You're done! Wait a bit for the Java Language Server to start up and recognize your project (you should see a little spinning icon at the bottom left of your screen), then test it out by clicking on a variable type (like
ModuleorDriveorDouble) and pressing F12. If all goes well, you should be taken to the definition of that class.
It's pretty easy. File -> Open Folder..., then navigate to the repository you have cloned (The folder named 2020CommandCode this year).
- Run these commands from Git Bash (or through the VS Code interface)
- To build, run
./gradlew build - To deploy to the robot, run
./gradlew deploy- Remember to build before you deploy
- To do both at once, run
./gradlew build deploy
Here's how to get your code into the main robot repository:
- Make an account on GitHub.
- Ask one of the robot programming leads to add your account to the Team2068 robot programming team.
- Clone the repo to your computer -
git clone https://github.com/Team2068/2020CommandCode.git
We use a feature branch workflow. You can read more about that here.
- Create and checkout a new branch.
git checkout -b <your_branch_name>, where <your_branch_name> is a descriptive name for your branch. For examplefix-shooter-wheel,two-ball-auto, orclimbing. Use dashes in the branch name, not underscores.
- Make whatever code changes you want/need/ to make. Be sure to write tests for your changes!
- Commit your work locally.
- If you're on a shared laptop set the author of the commit message by:
git commit --author="Author Name <[email protected]>" - Try to make your commits as atomic (small) as possible. For example, moving functions around should be different from adding features, and changes to one subsystem should be in a different commit than changes to another subsystem.
- Follow these conventions for commit messages. Or else.
- If your change is anything more than a few lines or small fixes, don't skip the extended description. If you are always using
git commitwith the-moption, stop doing that.
- Push to your branch.
git push origin <your_branch_name>.
- Submit a pull request.
- Log into Github.
- Go to our repo.
- Select the branch that you just pushed from the "Branch" dropdown menu.
- Click "New Pull Request".
- Review the changes that you made.
- Explain what and why you did the things you're trying to commit. Make the reviewer's life easier.
- If you are happy with your changes, click "Create Pull Request".
- Wait
- People must review (and approve of) your changes before they are merged - master is locked to any pull requests that don't have at least 2 reviews.
- Specifically, the rules are that one of the following two conditions must be true for it to get merged:
- 1 mentor and 1 other person have approved
- 2 experienced students and one other person have approved
- Specifically, the rules are that one of the following two conditions must be true for it to get merged:
- If there are any concerns about your pull request, fix them. Depending on how severe the concerns are, the pull request may be merged without it, but everyone will be happier if you fix your code. To update your PR, just push to the branch you made before.
- Don't dismiss someone's review when you make changes - instead, ask them to re-review it.
- Merge your changes into master
- If there are no conflicts, push the "merge" button.
- If there are conflicts, fix them locally on your branch, push them, wait for Travis CI to pass, and then merge.
- ???
- Profit
Code reviews are one of the hardest things to get right. There's a lot of discussion about this online, just ddg it.
You're putting yourself out there and asking your peers if your code is ready to be merged into master. It feels like you're asking your peers to tell you if you're good enough or smart enough. Trust that everyone feels this way, even your mentors with decades of programming experience. Remember this when you're reviewing someone elses CODE.
There will be zero tolerance for attacking anyone in a code review.
I think this list from ProgrammerFriend sums it up nicely:
- Improve code quality
- Consistency in your projects
- Finding bugs when they're fresh
- Learning (by getting code reviewed) and Teaching (by reviewing other’s code)
- Creating a sense of mutual responsibility
- Being aware of changes to the code
- Keeping everyone honest to maintain the highest quality of code
- In general finding way better solutions to problems
- Correctness - Does the code do what the commit message suggest it does?
- Readability - Prefer clarity over cleverness, on variable and method names that are unambiguous and convey intent.
- Maintainability - Is code written, or commented, in such a way that someone else (or yourself a week or two later) understands why you did things the way you did?
Again, this list from ProgrammerFriend sums it up nicely:
- Be friendly
- Review the code not the coder
- Give short and precise comments about your findings. Make suggestions, link to documentation, generally be helpful.
Prefer:
"WDYT about reverse instead of blah here? It might make it easier to remember"
Over:
"blah sucks, let's make this reverse"
- ILITE robotics, we took their
.travis.ymldirectly to set up CI. - ILITE robotics and by extension FRC Team 1678: Citrus Circuits for their efforts in writing outstanding contributing guidelines