Updated Creating and Running an Op Mode (OnBot Java) (markdown)

FTC Engineering
2019-07-09 12:32:56 -04:00
parent 586f8d6846
commit 179c262a94

@ -1,7 +1,7 @@
### The Java Programming Language
This tutorial assumes that you have a sound understanding of the Java programming language. If you do not know Java, then you should consider using the FTC Blocks Programming Tool, which is a visual development tool. Information about the FTC Blocks Programming Tool can be found at the following address:
This tutorial assumes that you have a sound understanding of the Java programming language. If you do not know Java, then you should consider using the FTC Blocks Programming Tool, which is a visual development tool. Information about the FTC Blocks Programming Tool can be found at the following link:
https://github.com/ftctechnh/ftc_app/wiki/Writing-an-Op-Mode-with-FTC-Blocks
[FTC Blocks Tutorial](Writing-an-Op-Mode-with-FTC-Blocks)
Or, you can learn the Java programming language by completing the Oracle Java Tutorial, which is available at the following address:
@ -22,6 +22,10 @@ The examples in this document use a Windows laptop computer to connect to the Ro
<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/OnBotDoc002_WiFiConnection.jpg" width="500"><p>
Note that the process used to create and edit an op mode is identical if you are using a Control Hub as your Robot Controller.
<p align="center">[[/images/Writing-an-Op-Mode-with-FTC-Blocks/BlocksPicture2b.jpg]]<p>
Note that if you prefer, you can use an alternate device, such as an Apple Mac laptop, Chromebook, or an iPad instead of a Windows computer to access the OnBot Java Programming Tool. The instructions included in this document, however, assume that you are using a Windows laptop.
Note that this section of the wiki assumes that you have already setup and configured your Android devices and robot hardware. It also assumes that you have successfully connected your laptop to the Progam & Manage server on the Robot Controller device.
@ -31,8 +35,8 @@ If you connected your laptop successfully to the Program & Manage wireless netwo
| Creating Your First Op Mode |
| ---- |
| 1. Find the web address that is displayed on the Program & Manage screen of the Robot Controller Android device. In our example, the web address is 192.168.49.1:8080.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/ProgramAndManageWebAddress.jpg" width="250"></p>Launch the web browser on your laptop (FIRST recommends using Google Chrome). Type this web address into the address field of your browser to navigate to the Program & Manage web server.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/ChromeWebAddress.jpg" width="300"></p> |
| 2. Verify that your web browser is connected to the Program & Manage server. If it connected to the Program & Manage server successfully, then you should see the main Robot Controller Connection screen.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/OnBotDoc_Step2_MainProgramAndManage.jpg" width="550"></p> |
| 1. Launch the web browser on your laptop (FIRST recommends using Google Chrome) and find the web address that is displayed on the Program & Manage screen of the Robot Controller. <br/><br/>**Important Note:** If your Robot Controller is an Android smartphone, then the address to access the Program & Manage server is "192.168.49.1:8080".<br/><br/><p align="center">[[/images/Writing-an-Op-Mode-with-FTC-Blocks/WritingFirstOpModeStep1a.jpg]] </p>**Important Note:** If your Robot Controller is a Control Hub, then the address to access the Program & Manage server is "192.168.43.1:8080". Notice the difference in the third octet of the IP addresses (the Control Hub has a "43" instead of a "49"). <br/><br/><p align="center">[[/images/Writing-an-Op-Mode-with-FTC-Blocks/WritingFirstOpModeStep1aControlHub.jpg]] </p>Type this web address into the address field of your browser and press RETURN to navigate to the Program & Manage web server.<br/><br/><p align="center">[[/images/Writing-an-Op-Mode-with-FTC-Blocks/WritingFirstOpModeStep1bControlHub.jpg]] </p>|
| 2. Verify that your web browser is connected to the programming mode server. If it is connected to the programming mode server successfully, the Robot Controller Console should be displayed.<br/><br/><p align="center">[[/images/Writing-an-Op-Mode-with-FTC-Blocks/WritingFirstOpModeStep2ControlHub.jpg]] |
| 3. Click on the word “OnBotJava” towards the top of the screen. This will switch the browser to OnBot Java Programming mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/OnBotDoc_Step3_OnBotJavaButton.jpg" width="250"></p> |
| 4. Take a look at the OnBot Java user interface. On the left hand side, there is the project browser pane. In the upper right hand corner, there is the source code editing pane. In the lower right hand corner, there is the message pane.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/OnBotDoc_Step4_OnBotScreen.jpg" width="650"></p> |
| 5. In the project browser pane, press the “+” symbol to create a new file. Pushing this button will launch the New File dialog box. This dialog box has several parameters that you can configure to customize your new file.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/OnBotJava/OnBotDoc_Step5_NewFile.jpg" width="350"></p><br/>For this example, specify “MyFIRSTJavaOpMode” as the File Name in the New File dialog box.<br/><br/>Using the Sample dropdown list control, select “BlankLinearOpMode” from the list of available sample op modes (see image above). By selecting “BlankLinearOpMode” the OnBot Java editor will automatically generate a basic LinearOpMode framework for you.<br/><br/>Check the option labeled “TeleOp” to ensure that this new file will be configured as a tele-operated (i.e., driver controlled) op mode.<br/><br/>Also, make sure you check the “Setup Code for Configured Hardware” option. If this option is enabled, the OnBot Java editor will look at the hardware configuration file for your Robot Controller and automatically generate the code that you will need to access the configured devices in your op mode.<br/><br/>Press the “OK” button to create your new op mode. |