1 / 14

FRC Java for Robotics Introduction

FRC Java for Robotics Introduction. Team 1279 ColdFusion January 8, 2011. NetBeans IDE. Full featured development environment Edit Build Debug Deploy Bundled with the latest Java SE JDK FRC plug-ins for WPILibJ. Advantages. Widely Used AP Test means school support Many Resources

Download Presentation

FRC Java for Robotics Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FRC Java for RoboticsIntroduction Team 1279 ColdFusion January 8, 2011

  2. NetBeans IDE • Full featured development environment • Edit • Build • Debug • Deploy • Bundled with the latest Java SE JDK • FRC plug-ins for WPILibJ

  3. Advantages • Widely Used • AP Test means school support • Many Resources • Books • Websites • Mentors • Economical • Free and can run on older hardware under Linux • Early in its life

  4. Disadvantages • New to FIRST • Still Bugs & Rough Edges • Teams have, at most ,1 season of experience • Fewer Robotics resources • Not much existing code • CAN not up to C++ • Not 100% standard Java • Based in Java ME • No formatted output (yet)

  5. Sample CodeWalk-through • Example from SimpleRobotTemplate • Check IterativeRobot too • Good Sample code • Described in the Getting Started Guide • Still a typo or two • Suggest everyone new try it

  6. Sample Code IThe File Environment • Package groups related classes together package edu.wpi.first.wpilibj.templates; • Import pulls in other classes import edu.wpi.first.wpilibj.RobotDrive; import edu.wpi.first.wpilibj.SimpleRobot; import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.Joystick;

  7. Sample Code IIYour Robot Class • Derived from the sample • Don’t change the name! public class Team1279Robot extends SimpleRobot { private RobotDrive drivetrain; private Joystick leftStick; private Joystick rightStick;

  8. Sample Code IIIThe Constructor • Called Once when Class object is Instantiated • Create and Initialize Instance Objects and Variables public Team1279Robot() { // create RobotDrive drivetrain = new RobotDrive(1, 2); // and joysticks leftStick = new Joystick(1); rightStick = new Joystick(2); }

  9. Sample Code IVMethods Called by FMS • Don’t Change These! • Called by the Field Management System public void autonomous() { public void OperatorControl() {

  10. Sample Code Vautonomous() for (int i = 0; i < 4; i++) { //note turning rate and size of square is different //for every robot, adj delay, speed,turn for yours drivetrain.drive(0.5, 0.0); //50% fwd 0% turn Timer.delay(2.0); // wait 2 seconds drivetrain.drive(0.25, 0.75); //25% fwd 75% turn Timer.delay(1.0); // wait 1 second } drivetrain.drive(0.0, 0.0); //0% fwd 0% turn (stop)

  11. Sample Code VIoperatorControl() while (isOperatorControl() && isEnabled()) { // drive w/joysticks drivetrain.tankDrive(leftStick,rightStick); Timer.delay(0.05); }

  12. Javadocs

  13. Debugging • println Output • Console • Debugger • Files • NetBeans Debugger • Main Project only • Set at least 1 breakpoint • Download debug code • Debugger now attaches automatically

  14. Resources • The reference guide for this presentation on the NJ/NY FIRST website • www.coldfusion1279.com • WPI website • FIRST website

More Related