Presentation is loading. Please wait.

Presentation is loading. Please wait.

FTC New Platform Programming Workshop in Android Studio

Similar presentations


Presentation on theme: "FTC New Platform Programming Workshop in Android Studio"— Presentation transcript:

1 FTC New Platform Programming Workshop in Android Studio
A Presentation by FTC Team 6022 Rockwell Automation Kickoff September 12th, 2015

2 What’s New? Android-Based Control Platform with Cell Phones
Replaces NXT/Samantha Control System Robot Controller Phone is Mounted to Robot and Connected to Core Module Driver Station Phone Connects to Two Joysticks Utilizes Wi-Fi Direct Technology Replaces Central FCS Utilizes “Sports Start” to Begin Match Play Controllers are USB-Based Replaces I2C Protocol for Sensors and Controllers

3 What’s New? Robot is Programmed through Android App Development in Java Uses Android Studio, a Full Android IDE (Integrated Development Environment) MIT App Inventor is Available as a “Scratch-Like” and “Drag-and-Drop” Interface Java Information Object-Oriented Language Programmed through Editing Instances of the OpMode() Class Will Be Discussed In-Detail Later…

4 Android Studio Setup (Should Be Completed)
Android Studio IDE FTC Robot App Template (GitHub) Project Configuration Requires SDK Version 19 (KitKat)

5 Types of Operation Modes
Looping Op Mode Linear Op Mode Defined as a Class Motors, Sensors, Etc. are Referenced as Attributes in the Class The “init()” Method Runs One Time The “loop()” Method Runs Continuously Until Stop Defined as a Class Motors, Sensors, Etc. are Referenced as Attributes in the Class The “runOpMode()” Method Runs One Time

6 Defining and Using Motors
Description of Process Code Syntax as an Example Op Class First, we must create a variable to reference an instance of a motor object. Second, we must reference the robot hardware map. Third, we can set the power of the motor. Powers are a value between 0 and 1. public DcMotor public void init() { testMotor = hardwareMap.dcMotor.get(“nameHere”); } public void loop() { testMotor.setPower(0.75);

7 Defining and Using The Joystick
Description of Process Code Syntax as an Example Op Class This code assumes that we have already defined a motor as described in the previous slide. The joysticks are already inherited into the op mode classes as gampad1 and gamepad2. In the code to the right, the loop reads the y-axis of the leftmost analog stick on joystick 1 to allow a user to drive the motor. public DcMotor public void init() { testMotor = hardwareMap.dcMotor.get(“nameHere”); } public void loop() { testMotor.setPower(gamepad1.left_stick_y);

8 Other Useful Things Telemetry Data Sensors
Allows for Robot Data to be Displayed on Driver Station Example: telemetry.addData(“Title”, “Detail/Value”); Sensors SDK Includes Many ModernRobotics and Lego Sensor Classes and Objects Example: public TouchSensor button; button = hardwareMap.touchSensor.get(”sensorName”); telemetry.addData(“Button/Touch”, button.isPressed());

9 Where to Find More Information
The SDK provides Javadocs that outlines how to interact with different methods, classes, and objects. Javadocs can be found in the “doc” folder of the SDK. Read through example op mode classes in order to get a feel for the code flow and see different uses of programming techniques.

10 Challenge #1 Read Axis Values from a Joystick
Set Motor to Joystick Values to Create a Basic Teleop Mode

11 Challenge #2 Drive Forwards for 2.5 Seconds Wait 1 Second
Drive Backwards for 2.5 Seconds

12 Challenge #3 Drive Forwards until Touch Sensor Pressed
Drive Backwards for 2 Seconds


Download ppt "FTC New Platform Programming Workshop in Android Studio"

Similar presentations


Ads by Google