PROGRAMMING FTC ROBOTS WITH ANDROID STUDIO EAGLE ROBOTICS TEAM 7373 JORDAN MOSS AND BRIAN BAARS.

Slides:



Advertisements
Similar presentations
Robot Code MVRT 2010 – 2011 Season. Robot code controls the robot Robot Main.vi –Calls all the smaller SubVis Rules of programming the robot –Be careful.
Advertisements

Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Chapter 10 Introduction to Arrays
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Program: Little Crab Mr Gano.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
Ruby (on Rails) CSE 190M, Spring 2009 Week 1. The Players Kelly "Everyday I'm Hustlin' " Dunn Kim "Mouse" Todd Ryan "Papa T" Tucker.
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.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Introducing Java.
CS140: Intro to CS An Overview of Programming in C by Erin Chambers.
Coding for the FIRST Tech Challenge: RobotC
The New FTC Platform (Connecting your legacy hardware)
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
FTC New Platform Programming Workshop in Android Studio
RobotC Advanced Concepts SSI Robotics September 7, 2013 Capitol College.
Making your Robot Move Motorbolts. Notes This presentation will be available on the High Tech Kids’ website: hightechkids.orghightechkids.org For more.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Ruby on Rails. What is Ruby? Programming Language Object-oriented Interpreted.
Java Programming The Ponytail Posse - FTC #8808 9/12/15.
6/3/2016 CSI Chapter 02 1 Introduction of Flow of Control There are times when you need to vary the way your program executes based on given input.
Introduction 2 Smart Design. What is smart design? 2 Everything is designed except nature The packaging of a Band-Aid The curve of a bike frame The shape.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Session 11 Intro to FRC API.
While and If-Else Loops ROBOTC Software. While Loops While loop is a structure within ROBOTC Allows a section of code to be repeated as long as a certain.
Programming with LabVIEW Intro to programming and.
Chapter 2 – The Little Crab Program:. Little Crab Scenario Inheritance: The Arrows Denote Hierarchy Crab is an Animal Animal is an Actor Therefore, It.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
Vex Robotics program three: using motors and sensors together.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
Topic 02: Introduction to ActionScript 3.0
OpModes in FTC Eric Golde.
Programming and Debugging with the Dragon and JTAG
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Working with Java.
FTC Driver Station Setup and Operation Mike Zook 20-Sep-2016.
Introduction to Autonomous Programming
Advanced EasyC Jim Cline July 20-21, 2017.
FTC Driver Station Setup and Operation Mike Zook 20-Sep-2016.
Java for Android is specific
Loop Structures.
Programming FTC Robots with Android Studio
CompSci 230 Software Construction
GETTING STARTED ALL YOU NEED TO KNOW TO MAKE YOUR ROBOT MOVE
Movement using Shaft Encoders
T. Jumana Abu Shmais – AOU - Riyadh
Android Topics UI Thread and Limited processing resources
Block Programming Hello my name is Stephanie. I have been apart of FIRST for 6 years and have 3 years of programming experience. I am currently a member.
Android Programming OnBot Java.
Additional Topics in VB.NET
Programming - Buttons Intro to Robotics.
Building Java Programs
if-else Structures Principles of Engineering
Focus of the Course Object-Oriented Software Development
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Chapter 2 Programming Basics.
Java Programming with BlueJ Objectives
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
CMPE419 Mobile Application Development
LEGO Mindstorms Robot and Java
Presentation transcript:

PROGRAMMING FTC ROBOTS WITH ANDROID STUDIO EAGLE ROBOTICS TEAM 7373 JORDAN MOSS AND BRIAN BAARS

DISCLAIMER This is only an overview We cannot cover every aspect of Android Studio If you have questions, contact us using the information provided in your handout or check out our code library: eaglerobotics.net/code

SYSTEM.OUT.PRINTLN(“WELCOME!”); What tools will you need to code in Android Studio? JDK 8 Android Studio 2.1 The latest version of the ftc_app

ANDROID STUDIO INTERFACE Project Window Program Editor Tool Windows

ANDROID STUDIO INTERFACE

NAVIGATING PROJECTS Package Classes

EDITING OPMODES

REGISTERING OPMODES In order to use an opmode, it must be registered under FtcOpModeRegister In order to do this you only need to add one line of code manager.register(“Name to Appear on Phone”, class_name.class); This line tells the opmode manager to register your opmode class as a runnable opmode If you do not include this line, you will not be able to run your code

UPLOADING THE PROJECT Plug in Android Robot Controller Press Play Button in Menu Select Android Device to Deploy to Press OK The App Should Now be on your Android Robot Controller

BASIC JAVA SYNTAX All Statements will end with a ; i.e. System.out.println(“Hello World”); Every method or class will be surrounded by braces i.e. public void main (Strings[ ] args) { … } Java is case sensetive

BASIC JAVA SYNTAX Comments can be written using // These are ignored by the compiler but help to document and organize code i.e. //set drive motor power to 1 driveMotor.setPower(1); These can be quite helpful for testing Comments can span multiple lines if the following from is used /* * put an asterisk on every line * then you can comment * on multiple lines */

JAVA VARIABLE TYPES Float This is the most commonly used number type in programming FTC robots Boolean This is a value that stores TRUE or FALSE This is used for logic statements such as While, For, If, etc. Motor and Servo These variable types are particular to programming robots They each represent a motor or servo on the hardware map

BASIC FORM OF A PROGRAM There are 2 basic forms any robot program will take Teleop init Method Starts when init button is hit in driver station Runs code once then waits for start to move to the loop method loop Method Runs repeatedly until stopped by the driver station Autonomous runOpMode Method Runs through only once until stop button is pressed or timer runs out waitForStart method is used to separate the initialization of the robot from the autonomous program

INITIALIZING THE ROBOT Create variables Servo and Motor i.e. Motor leftdrive; Servo arm; Reference the variable to the hardware map leftdrive = hardwareMap.dcMotor.get(“motor name”); arm = hardwareMap.servo.get(“servo name”); Fill in motor name or servo name for the name used on the robot controller hardware map Keep these names simple yet descriptive

RUNNING THE ROBOT Use either gamepad1 or gamepad2 statements to get input Fill in * for direction Boolean output is best for servos or constant speed motors Float output is best for motors gamepad1.OutputRange *_bumperBooleanTrue or False *_triggerFloat[0,1] *_stick_y or *_stick_xFloat[-1,1] dpad_*BooleanTrue or False a, b, x, yBooleanTrue or False

RUNNING THE ROBOT: MOTORS Running a motor motor.setPower(float); Fill in your motor variable for motor name and drive power value for float This drive power can be from -1 to 1 If a value outside the bounds is sent, a null pointer error will be returned To prevent this clip the range of the input into the motor power = Range.clip(power, -1, 1); Use the gamepad joystick to control your power variable float power = gamepad1.left_joystick_y; power = Range.clip(power, -1, 1); motor.setPower(power);

RUNNING THE ROBOT: SERVOS Running a servo servo.setPosition(float) Fill in servo variable name for servo and position value for float The position can be from 0 to 1 The same range clipping technique can be used for servos position = Range.clip(position, 0, 1); Running a servo… First, let us introduce a basic logic statement

IF-ELSE STATEMENTS If statement checks the value of a Boolean If this value is true it performs an action If this value is false it can perform nothing or a different set of actions An example for running a servo if(gamepad1.dpad_up) { servo.setPosition(1); } else { servo.setPosition(0); } This code will set the servo position to 1 when the up dpad button is pressed and return it to 0 when it is not pressed

IF-ELSE STATEMENTS If else statements can also have multiple if cases if(gamepad1.dpad_up){ servo.setPosition(1); } else if(gamepad1.dpad_down){ servo.setPosition(0); } This code will set the servo to 1 if the dpad up is pressed and it will stay at 1 unless dpad down is pressed which will set the positon to 0 unless dpad up is pressed

A BASIC TELEOP public void init() { Servo arm; Motor leftdrive; arm = hardwareMap.servo.get(“arm”); leftdrive = hardwareMap.motor.get(“leftdrive”); }

A BASIC TELEOP public void loop() { //get boolean values from dpad and change position of servo if(gamepad1.dpad_up) { servo.setPosition(1); } else if(gamepad1.dpad_down){ servo.setPosition(0); } //get power from left joystick and run motor float power = gamepad1.left_joystick_y; power = Range.clip(power, -1, 1); motor.setPower(power); }

QUESTIONS? us at or