Programming Sub-Team

Runnymede Robotics uses Java to program the robot.  During the pre-season, the team focuses on basic Java skills.  For skills development, we use problems from the Canadian Computing Competition, and other exercises.  

Java Resources - Install this Software!

Java Development Kit - install the latest Java 8 release
eclipse Development Environment - use the Eclipse Installer to install the Java IDE (J2EE is not required for robotics)
WPI Lib Update Site - http://first.wpi.edu/FRC/roborio/release/eclipse/
In order to connect to a robot, install the Robot Toolkit (not required to write code, but required to download code to the robot).
Practice writing Java methods on Coding Bat.

Detailed installation instructions for the above can be found on ScreenStepsLive from FIRST.

FRC Java Rules
Lessons and Homework

Oct 29, 2016 - Learning Java Basics 1

The basic elements of a Class, including:
  • variables
  • if statements and boolean expressions
  • methods
Homework problems

Nov 5, 2016 - Learning Java Basics 2

Classes:
  • creating instances of classes
  • classes as containers for data and methods
  • the BirthDay class example
  • challenge: AdventOfCode Day 2

Java Code Examples from the lesson

Homework problems
  • AdventOfCode Day 16 - The Aunt Sues
  • This problem is very similar to the Day 2 problem.  You should use a Sue class.
    • the Sue class should contain all of the possible properties
    • think about using minus one (-1) to indicate an unknown number.
    • write something like public boolean equalsAunt(auntSue) so that in your main program you can write "if (clueSue.equalsAunt(auntSue) {".
  • Aunt Sue helpful hints when parsing the input:
    • Split a string at the space: String [] strings = myString.split(" ");
    • Get the last character in a string: char c = myString.charAt(myString.length()-1);
    • Remove the last character from a string (because it is a : or ,):
      myString = myString.substring(0, myString.length()-1);
      myString.substring(start, end) returns a new substring starting at the starting index and running until the end index minus 1.  It does not include the character at the end index.
    • A switch statement can be used on strings:
      switch (myString) {
      case "cats:"     cats = Integer.valueOf(myIntString);      break;
      }
  • Day 16 Solutions

Nov 12, 2016 - Learning Java Basics 3

Robot Framework:
  • init runs once, execute runs every 20ms
  • OI, Controller, Subsystem Layers
Classes:
Homework
  • write the java class for your game controller by extending this base class
  • GameController Class

Meeting Schedule

FRC Java Rules!
Pre-Season Java Lessons

Basic Java
Oct 29
Nov 5

FRC Robot Code
Nov 12
Nov 19
Nov 26

All sessions run from 9:00am to 3:00pm.

Bring your lunch or get fast food close by the school.