INTRODUCTION TO JAVA PROGRAMMING FOR THE FIRST ROBOTICS COMPETITION JONATHAN DANIEL HEAD PROGRAMMER FERNBANK LINKS.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Alpha Control System TheRobettes.com.
US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Jeff Beltramo NHTI-Concord’s Community College FRC Team 1922.
1. 2 LabVIEW for FRC Doug Norman National Instruments January 6, 2012.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
Part 1: Introduction FRC Introduction  FRC 2907 since 2008  Each area of the robot has a team assigned  The Electronics team is headed this year.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Overview of New System Beta Team from Wilsonville 1425 Wilsonville Robotics – Code Xero 2550 Oregon City Robotics.
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
RobotC Programming for LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
OOP Languages: Java vs C++
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
3.1 Documentation & Java Language Elements Purpose of documentation Assist the programmer with developing the program Assist other programers who.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Common Rookie Blunders Kelvin Lin Team 4001 Programmer Yoan Holder Team 4001 Electrician.
Programming Languages and Paradigms Object-Oriented Programming.
CIS Computer Programming Logic
Mentors Workshop Control System Sub-System Mark McLeod Team 358 Festo/Hauppauge H.S. F For I Inspiration and R Recognition of S Science and T Technology.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
LabVIEW Workshop September 26, 2009 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
The New FTC Platform (Connecting your legacy hardware)
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Programming Progamz pls. Importance VERY IMPORTANT.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
Beginner Programming Workshop Simona Doboli Assistant Professor Computer Science Department Hosftra University November.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Understanding The 2008 FRC Robot Controller Chris Gregory FRC1089 – Team Mercury
Session 11 Intro to FRC API.
Electronics and Controls
By Mr. Muhammad Pervez Akhtar
CPS120: Introduction to Computer Science Variables and Constants.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.
Programming Applied Sensors in FIRST Robots Chris Elston – Team Download sample code:
FIRST ROBOTICS COMPETETION Introduction to Electrical & Control System Power and Signal Distribution/Interconnection Sensors, Motors, Speed Controllers,
FRC Robot Electronics.
INTRODUCTION TO ROBOTICS Part 5: Programming
PLC Terminology and Application
Objects as a programming concept
Java Primer 1: Types, Classes and Operators
Introduction to Gobbit Programming
Chapter 3: Using Methods, Classes, and Objects
What is Java?.
Java programming lecture one
Electrical Trainings MVRT
Trainings 10/28 Woooooo!!.
Lesson 4: Overall Review and Assessment
Training 11/11/16 Robot Code (WPILib).
Introduction to Primitive Data types
Field Management System
Introducing Java.
RobotC Programming for LEGO Mindstorms NXT
Introduction to Arduinos
Introduction to Primitive Data types
Presentation transcript:

INTRODUCTION TO JAVA PROGRAMMING FOR THE FIRST ROBOTICS COMPETITION JONATHAN DANIEL HEAD PROGRAMMER FERNBANK LINKS

DISCLAIMERS This session WILL NOT teach you all of Java. This session WILL teach you how to use your knowledge of Java with the FRC Java Libraries.

WHAT IS PROGRAMMING?

PROGRAMMING IS… Computer programming is the craft of writing useful, maintainable, and extensible source code which can be interpreted or compiled by a computing system to perform a meaningful task. FRC Programming Languages C++ Java Python LabVIEW

REVIEW OF JAVA Java is an object-oriented programming language. Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. A Java program can be separated into different classes, which are templates for creating objects with different behaviors.

WHAT’S IN A CLASS? Java classes contain methods and variables. A method is a function that can be executed by a class. Sometimes, you will have a method that returns some form of data to the robot. One method could be to ask the robot how much battery power it has. A variable is a container for data. Variable X = 9 Variable Y = “These three words” All Java class files end with the extension.java. In order for a class to read another class, you have to use an import statement. When you use an import statement, all of the public methods in that class will be absorbed into your new class. For example, you might import class1 into class2, so you can use class1’s methods!

IMPORTANT JAVA KEYWORDS A keyword is a special word/phrase that is used to define some aspect of a class, method or variable. Public All other classes can see this method/variable. Private This method/variable will only be seen in its current class. Protected This method/variable can only be seen by subclasses of the current class. Extends This is when the class becomes a subclass of another class. Public class Dog extends Animal Import When you load all of another class’s public methods/variables into your own class. New Creates a new object of a certain class.

TYPES OF OBJECTS Objects are digital items that can be referenced by computers. There are many types of objects, but these are the most common ones. Integer Any number that doesn’t contain a decimal point. Double Any number that does contain a decimal point. Boolean A binary variable that can be interpreted as true or false. String Any text that is surrounded by double quotation marks. Void This will only be used with methods, and it means that the method returns nothing. Static No matter how many objects of this type are created, there will only be one of this method OR variable.

LET’S DO A QUICK QUIZ!

WHAT TYPE OF OBJECT IS 9.0 ? A. Integer B. String C. Double D. Boolean

WHAT TYPE OF OBJECT IS “TRUE”? A. Double B. String C. Boolean D. Integer

THE MOST IMPORTANT ASPECT OF JAVA! Semicolons are one of the most important symbols in Java! Unless you are creating a method or loop, you have to use a semicolon to end the a line of code. This lets the program know that it has reached the end of a line and it needs to move to the next one. ;

WHAT DO I USE TO PROGRAM MY ROBOT?

INTRODUCE THE ECLIPSE IDE

PACKAGE EXPLORER The package explorer is a file explorer for all of your Eclipse Projects. Eclipse Project = Java Program Packages are folders that can be used to contain java classes When you create a robot project using the iterative template, Eclipse will create a default package and a default class. Org.usfirst.frc.team0000.robot Robot.java. Depending on your robot’s functions, you may want to create different packages for each function.

CONSOLE Will document the deployment of your code to the robot, so you will know if it was successful.

THE PROGRAMMABLE ELECTRONICS

ROBORIO Main Robot Controller RIO to PC Communication Ethernet USB Cable Wireless (if Radio is configured) 10 Pulse Width Modulation Ports (0-9) Controls the Motors 10 Digital Ports (0-9) Communicates with digital sensors 4 Analog Ports (0-3) Communicates with analog sensors Digital Analog PWM

JOYSTICKS

MOTOR CONTROLLERS

MOTOR CONTROLLER PWM - Pulse Width Modulation To control the speed of the motor, the speed controller switches the full input voltage on and off very quickly. There are ten PWM ports on the RoboRIO, and each port controls one motor. Most PWM classes use set(speed) methods to determine the speed of the motor. The parameter is a double value that ranges from -1.0 to +1.0, with 1.0 being full forward and -1.0 being full reverse. Inversion of Motors Typically, you will need to set one of your motors to interpret +1.0 as -1.0 by using setInverted(). CAN – Controller Area Network More advanced form of control that allows for feedback.

LET’S PROGRAM A ROBOT TO DRIVE AROUND!

CONTROLLING PNEUMATICS

THE MAIN ELECTRONICS

OVERVIEW OF PNEUMATICS Outside Environment CompressorAir TanksSolenoidsActuators

PNEUMATICS OVERVIEW – PNEUMATICS CONTROL MODULE The Pneumatics Control Module is the mechanism that is responsible for the management of the compressors and solenoids on the robot. 8 Solenoid Ports 8 Single Solenoids 4 Double Solenoids 1 Compressor Port Pressure Relief Valve Port

WHY USE PNEUMATICS?

LET’S PROGRAM A SHIFTING DRIVETRAIN!

SENSORS

WHY USE A SENSOR?

SYSTEM.OUT.PRINTLN(‘MESSAGE’) SYSTEM.OUT.PRINT(‘MESSAGE’)

THE SENSOR FAMILY TREE Sensors Analog GyroAccelerometer Encoder Digital EncoderLimit Switch

ANALOG VS. DIGITAL These sensors can return any value based on whatever they are measuring. Encoders act like Analog Sensors, but are technically digital sensors. Analog Sensors Digital Sensors return one of two values, either a 1 or a 0. Encoders are the odd member of the family. Digital Sensors

LET’S HAVE OUR ROBOT TELL US ABOUT OUR GYRO!

CAMERAS IN FRC!

CAMERAS

LET’S PROGRAM OUR ROBOT TO STREAM VIDEO!

NETWORKING If you are using an IP Camera, you will have to assign it an IP Address. 10.TE.AM.11 A good static address should be safe from other internet devices for Team 800 Subnet The FMS allows each team to use a bandwidth of 7 megabits/second. 6 Mbps after driver station packets. If you plan on streaming your camera to the driver station, you will probably need to use compression.

RESOURCES – FRC STACK WPILib ScreenSteps Tutorials API Documentation Chief Delphi GitHub GitHub Student Developer Pack: Fernbank LINKS GitHub: Team GitHub List

RESOURCES – LEARNING JAVA Codecademy Start:Code Classes in the Decatur Area AP Computer Science Teaches CS with Java

QUESTIONS?