Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android Programming OnBot Java.

Similar presentations


Presentation on theme: "Android Programming OnBot Java."— Presentation transcript:

1 Android Programming OnBot Java

2 Getting Started My recommendation is that “novice” teams use OnBot Java Programming is via a web browser No large download Program is on the Robot Controller so if programmer is absent, another computer can be used Via WiFi – Phone can stay on the robot and you don’t have to connect a cable to laptop Why Android Studio Much nicer development environment Can build the code without the robot Better Coding Help Linking to external libraries like OpenCV

3 Getting Started On Line Assistance

4 Setup The Phones Make sure the phones are configured such that the Drive Station is named XXXX-DS and Robot Controller is XXXX-RC Phones should be in Airplane Mode but WiFi on (Bluetooth Off) From the Google Play Store install the Driver Station on your Driver Station phone and Robot Controller on the Robot Controller Phone DO NOT INSTALL BOTH APPS ON THE SAME PHONE

5 Setup the Phones Pair the Robot Controller and Driver Station
Start the Robot Controller app on the Robot Controller Start the Driver Station app on the Driver Station On the Driver Station – Click on the “three dots” in upper right and click on Setting Select Connect With Robot Controller Find the Robot Controller and Select it. Note, the filter will cause it to only show Robot Controllers with the same team number as the Driver Station On The Robot Controller, accept the connection The circle in the middle should show Network:XXXX-RC

6 Setup the Phones Set up a “null” configuration on the Robot Controller
A “null” configuration allows for some early exploring without having to have motors and/or sensors connected On either phone, click on the three dots in right hand corner and select Configure Robot Click on New Click on Ok Click on Save and call it null (or any name) Activate it (The top red bar should say Active Configuration: null) Click the back button

7 Your First OpMode On either phone, click the three dots and then Program and Manage This screen will show what information is needed to connect to the Robot Controller.

8 Your First OpMode Connect a laptop to the Robot Controller via WiFi (no cables). Open a web browser and enter the HTTP address provided by the phone

9 Your First OpMode Create the first program by clicking on “+”
Go your first OpMode GoTeam and select TeleOp Type in the code (Next Page)

10 Your First OpMode package org.firstinspires.ftc.teamcode;
Import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; @TeleOp(name="GoTeam", group="Aluminati") public class GoTeam extends LinearOpMode { private ElapsedTime runtime = new ElapsedTime(); @Override public void runOpMode() { double leftStick; double rightStick; telemetry.addData("Status", "Initialized"); telemetry.update(); // Wait for the game to start (driver presses PLAY) waitForStart(); runtime.reset(); // run until the end of the match (driver presses STOP) while (opModeIsActive()) { leftStick = gamepad1.left_stick_y; rightStick = gamepad1.right_stick_y; telemetry.addData("Joystick", "left (%.2f), right (%.2f)", leftStick, rightStick); telemetry.addData("Status", "Run Time: " + runtime.toString()); }

11 Your First OpMode After typing in the code, click on the Wrench
If you did not get “Build succeeded!”, then you will have to fix the typos in the code.

12 Your First OpMode Connect a Joystick to the Driver Station
Only one joystick is needed so a hub is not required Enable the joystick by pushing Start and A. This should light a joystick above User 1 In the middle of the Driver Station is two upside down triangles. The left is for Autonomous OpModes and the right is for TeleOp OpModes Click the right upside down triangle and select the OpMode GoTeam Press the center Init Press Run (Play) Button The status should show time increasing and moving the joysticks should show the joystick values.

13 Your First OpMode Note – Forward on the joysticks are negative numbers. Generally, you will want to put a “-” sign in from of gamepad1 when reading the y joystick value for the driving functions.

14 Getting Started with OnBot Java
Take advantage of the Sample Programs – Start with one and then modify for your use ALWAYS DISCONNECT your laptop when you compete. It can slow down your robot processing if you don’t disconnect.


Download ppt "Android Programming OnBot Java."

Similar presentations


Ads by Google