Android Programming On Bot Java Getting Started My
Android Programming On. Bot Java
Getting Started My recommendation is that “novice” teams use On. Bot 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 Wi. Fi – 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 Open. CV
Getting Started On Line Assistance https: //www. firstinspires. org/sites/default/files/up loads/resource_library/ftc-onbot-javatutorial. pdf https: //github. com/ftctechnh/ftc_app/wiki/On. Bot. Java-Tutorial
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 Wi. Fi 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
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
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
Your First Op. Mode 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.
Your First Op. Mode Connect a laptop to the Robot Controller via Wi. Fi (no cables). Open a web browser and enter the HTTP address provided by the phone
Your First Op. Mode Create the first program by clicking on “+” Go your first Op. Mode Go. Team and select Tele. Op Type in the code (Next Page)
Your First Op. Mode package org. firstinspires. ftc. teamcode; Import com. qualcomm. robotcore. eventloop. opmode. Tele. Op; import com. qualcomm. robotcore. util. Elapsed. Time; import com. qualcomm. robotcore. eventloop. opmode. Linear. Op. Mode; @Tele. Op(name="Go. Team", group="Aluminati") public class Go. Team extends Linear. Op. Mode { private Elapsed. Time runtime = new Elapsed. Time(); @Override public void run. Op. Mode() { double left. Stick; double right. Stick; telemetry. add. Data("Status", "Initialized"); telemetry. update(); // Wait for the game to start (driver presses PLAY) wait. For. Start(); runtime. reset(); // run until the end of the match (driver presses STOP) while (op. Mode. Is. Active()) { left. Stick = gamepad 1. left_stick_y; right. Stick = gamepad 1. right_stick_y; telemetry. add. Data("Joystick", "left (%. 2 f), right (%. 2 f)", left. Stick, right. Stick); telemetry. add. Data("Status", "Run Time: " + runtime. to. String()); telemetry. update(); } } }
Your First Op. Mode 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.
Your First Op. Mode 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 Op. Modes and the right is for Tele. Op Op. Modes Click the right upside down triangle and select the Op. Mode Go. Team Press the center Init Press Run (Play) Button The status should show time increasing and moving the joysticks should show the joystick values.
Your First Op. Mode Note – Forward on the joysticks are negative numbers. Generally, you will want to put a “-” sign in from of gamepad 1 when reading the y joystick value for the driving functions.
Getting Started with On. Bot 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.
- Slides: 14