FRC Java

concepcionsockΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 3 μήνες)

336 εμφανίσεις

FRC Java

About Us

From Team 1977 (
http://robotics.lovelandhs.org/
)

Our team has used Java since it was first supported by
FIRST in 2010
Why use Java?

Organizational system

Threads easy to implement

Officially supported by FIRST

Little to no low level memory management
Structure of the Presentation
1.
Installing Java for FRC
o
JDK, Netbeans, and plugins
1.
Using Java
o

Example code and 2012 changes
1.
Resources
Part 1: Installing Java for FRC
1.1.1: Get a JDK

Available
at
http://www.oracle.com/technetwork/java/javase/download
s/
index.html
(short version:
http://goo.gl/TFD33
)

Required version: JDK 6 (not JRE!)
o
Latest version: update 30

JDK 7 may work as well
1.1.2: Get a JDK
Non-Windows users:

Linux users: OpenJDK 6 works fine and is probably
available in your package repositories

Mac users: You may need to install Java/the JDK from
Software Update

You can only run the FRC tools in Windows, but you can
program, upload, debug, etc from any OS.
1.2.1: Installing NetBeans

Get NetBeans 7.0.1:
http://netbeans.org/
1.2.2: Installing NetBeans

Required component: Java SE
o
This is included in the "Java SE", "Java EE", and "All"
downloads
1.2.3

Netbeans also comes bundled with the JDK

From
http://www.oracle.com/technetwork/java/javase/downlo
a
ds/index.html
(short version:
http://goo.gl/TFD33
)
1.3.1: Install the FRC Java Plugin

Go to Tools->Plugins

On the window that pops up, select "Settings"
1.3.2: Install the FRC Java Plugin

Select "Add"
o
Name the provider "FRC Java"
o
2012 plugins should be on the WPI FIRST Forge page

http://firstforge.wpi.edu/sf/projects/wpilib
1.3.3: Install the FRC Java Plugin

Go to the "Available Plugins" tab

Select to sort by provider

Download and install the plugins provided by FRC Java
Any questions?

Part 2: Using Java

Quick Definitions

singleton- a class with only a single member; a unique
object

class- a template for objects; a cookie cutter for an object,
telling it what it can and can't do

method- a function, subroutine, etc. It is a piece of code
which can be repeated without writing out all of the code
every time; it is always part of a specific class

API (Application Programming Interface)- The library of
code, in our case created by WPI (Worcester Polytechnic
Institution), which provides already-made classes for use
Useful Shortcuts:

control+space- bring up the list of available
variables/methods

alt+enter- show "hints" for fixing errors
2.1.1: Subsystems

Stand in for a physical mechanism
o
Arm, Drivetrain, etc.

Can have a default command

Singleton class

Extend Subsystem
2.1.2: Subsystems
https://github.com/prog694/Beta2012/bl
o
b/master/DESdroidCommand2/src/edu/
s
tuy/subsystems/Arm.java
2.2.1: Commands

Control robot behavior

Use subsystems
o
require();

Can be linked together to run in parallel or in sequence

Extends Command
2.2.2: Commands
https://github.com/prog694/Beta2012/blob/master
/
DESdroidCommand2/src/edu/stuy/commands/Ar
mControlWithGamepad.java
2.3.1: OI

O
perator
I
nput

Contains information on controls for the robot
o
Used to get joystick axes
o
Maps buttons to commands
2.3.2: OI
https://github.com/prog694/Beta2012/blob/maste
r/
DESdroidCommand2/src/edu/stuy/OI.java
2.3.3: OI
https://github.com/prog694/Beta2012/blob/maste
r/
DESdroidCommand2/src/edu/stuy/OI.java
Any questions?

Part 3: Resources

3.1 Resources

http://docs.oracle.com/javase/tutorial/java/
- learn java

https://github.com/prog694/Beta2012
- 694's source code for
the 2012 java language


https://github.com/prog694/frc
- 694's source code from
2009 to 2011


http://www.chiefdelphi.com/forums/forumdisplay.php?
f=184
- ChiefDelphi's java programming forum

http://robotics.lovelandhs.org/
- Our site, where this
powerpoint and the code used will be posted

http://www.oracle.com/technetwork/java/javase/downloads/
index.html
- download a JDK

http://firstforge.wpi.edu/sf/projects/wpilib
- Find the URL for
the Netbeans plugins