Difference between revisions of "Java"

From FRC11 - Mentor Wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
* [https://java.com/en/download/ Get Java]
 
* [https://java.com/en/download/ Get Java]
 
* [https://plugins.jetbrains.com/plugin/9405-frc WPILib/FRC Plug-in for IntelliJ] if using IntelliJ you may need this?? (TBD)
 
* [https://plugins.jetbrains.com/plugin/9405-frc WPILib/FRC Plug-in for IntelliJ] if using IntelliJ you may need this?? (TBD)
 +
 +
Also see:
 +
* [[2019 Programming Build Season Installs]]
  
 
== Documents, Guides, and References ==
 
== Documents, Guides, and References ==
Line 19: Line 22:
 
* [https://wpilib.screenstepslive.com/s/4485/m/13809 FRC/WPI Java Programming]  Full fledged menu of resources from the WPIlib folks.
 
* [https://wpilib.screenstepslive.com/s/4485/m/13809 FRC/WPI Java Programming]  Full fledged menu of resources from the WPIlib folks.
 
* [https://phoenix-documentation.readthedocs.io/en/latest/index.html CTR-Electronics Phoenix Software Framework documentation] Class library for Talon SRX, Victor SPX, CANifier and Pigeon-IMU (plus tuning and diagnostic tools). Motion control software for the motors - see [https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html Motor Controller Closed Loop].
 
* [https://phoenix-documentation.readthedocs.io/en/latest/index.html CTR-Electronics Phoenix Software Framework documentation] Class library for Talon SRX, Victor SPX, CANifier and Pigeon-IMU (plus tuning and diagnostic tools). Motion control software for the motors - see [https://phoenix-documentation.readthedocs.io/en/latest/ch16_ClosedLoop.html Motor Controller Closed Loop].
−
 
+
:*[https://www.systemvision.com/blog/controlling-motors-talon-srx-february-1-2017 Controlling Motors With The Talon SRX]
  
 
* [https://mort11.com/downloads/mentor.wiki/Programming/Head_First_JAVA_2ed.pdf Head First Java, 2nd Ed] A book on Java (pdf)
 
* [https://mort11.com/downloads/mentor.wiki/Programming/Head_First_JAVA_2ed.pdf Head First Java, 2nd Ed] A book on Java (pdf)
 
* [https://resources.oreilly.com/examples/9780596009205.git Code for the ''Head First Java'' book, above]
 
* [https://resources.oreilly.com/examples/9780596009205.git Code for the ''Head First Java'' book, above]
−
 
  
 
* [http://wpilib.screenstepslive.com/s/currentCS/m/java/l/272787-frc-java-wpilib-api-documentation FRC/WPI About local javadocs]
 
* [http://wpilib.screenstepslive.com/s/currentCS/m/java/l/272787-frc-java-wpilib-api-documentation FRC/WPI About local javadocs]
 
* [http://wpilib.screenstepslive.com/s/currentCS/m/java/l/837061-c-java-plugin-changelog FRC Java Plugin Changelog]  Useful to see what has changed in WPI lib since last year.
 
* [http://wpilib.screenstepslive.com/s/currentCS/m/java/l/837061-c-java-plugin-changelog FRC Java Plugin Changelog]  Useful to see what has changed in WPI lib since last year.
 +
* [https://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#styleguide JavaDoc Documentation Style Guide]
  
 
== Tutorial Videos ==
 
== Tutorial Videos ==

Latest revision as of 10:34, 23 March 2019

About

Java is the language we use primarily to program the FRC robots. It is a general purpose, object oriented programming language that can do almost any variety of tasks. It works hand-in-hand with WPI Lib to control the robot.

WPI Lib is the set of libraries - low level software designed to control the hardware - that interfaces with sensors and outputs, and interfaces with elements of the FRC Field such as start and stop signals. Our Java programs need to include the WPI libraries and make calls to the Apllication Programming Interface (API) WPI Lib provides.

Installing

Or manually with another IDE:

Also see:

Documents, Guides, and References

Tutorial Videos

FRC Java Command-based Programming Tutorial Playlist (1.5 hrs)

  • FRC Java Programming Tutorial Part 1: Project Setup
  • FRC Java Programming Tutorial Part 2: Basic Drivebase
  • FRC Java Programming Tutorial Part 3: Setting up Tank Drive Controls
  • FRC Java Programming Tutorial Part 4: How to use TalonSRXs
  • FRC Java Programming Tutorial Part 5: Version Control
  • FRC Java Programming Tutorial Part 6: WPILIB PID

Note: when watching the videos, you should stop and look through the code that is discussed. Some minor items (such as imports) are glossed over. For example, if you have unreferenced calls in your code, compare the code on screen with what you have - you may have to import an additional library. Hover over unresolved items. Usually, you want to import the correct library.

Dude, Where's my JAR (Included Libraries)

JAR files are included as 'external libraries' in the code. This is managed through gradle. These files are all included with the build and managed in the build.gradle file. Check it out.

Currently MORT code manages all libraries using this technique.

In build.gradle, this is managed by this block:

// Defining my dependencies. In this case, WPILib (+ friends), CTRE Phoenix (Talon SRX)
// and NavX.
dependencies {
   compile wpilib()
   compile ctre()
   compile navx()
   compile openrio.powerup.matchData()
}