Announcement

Collapse
No announcement yet.

Some basic questions on the Android Studio code

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some basic questions on the Android Studio code

    Hello, How do I download the Driver Station code to a phone? I am using Android Studio. When I download the ftc_app-master project to a phone it is always the Robot Controller. Or is there any need for me to use custom Driver Station code?

    Also, we have several autonomous mode code files from last year--AutoBlue.java, AutoRed.java, etc--in TeamCode > src > main > java > org > firstinspires > ftc > teamcode (in Android Studio). These will be selected from the Robot Controller phone, right? I don't see them in the phone, only one of them. How do I get them all included? FYI, in each file there is a line like: @Autonomous (name = "AutoBlue").

    If there is any documentation explaining these topics, please let me know. I haven't found anything.
    Thanks
    Ron

  • #2
    You can download DS from Google play store directly or check release tab on github which tells exactly where DS apk file is. For Android studio check this page
    https://github.com/ftctechnh/ftc_app...tudio-Tutorial

    Comment


    • #3
      Thanks FTC12676. I have read that and didn't find that it answered those questions.

      Comment


      • #4
        The Driver Station is only available as an .apk. You download from Google Store or there are other methods that are similar to each other to manually install from other locations. You don't compile, modify, or use Android Studio to install the Driver Station.

        What I do is -
        Put the phone to receive Driver Station software in media mode, instead of charge only mode.
        Connect to a computer with a cable. (Macs need Android File Transfer app to see the phone as a drive.)
        Open the phone's folder. (Top level, root, says phone, whatever, no need to drill down.)
        Open another folder on your computer at ftc_app-master\doc\apk .
        Drag the FtcDriverStation...apk from the computer to the phone's top level folder.
        Open file manager on the phone.
        Open applications.
        Double click to install.
        Return everything back the way it was.



        The line after @Autonomous or @TeleOp is usually@Disabled.
        Remove or comment out @Disabled to make the opmode appear in the opmode selection menu.

        Comment


        • #5
          Thank you 3805Mentor. There is no @Disabled. Here is one of my files. Any ideas why "AutoRed" would not appear in the list? The list would be on the Driver Station phone right?
          Thanks
          Ron

          package org.firstinspires.ftc.teamcode;

          import com.qualcomm.robotcore.eventloop.opmode.Autonomous ;
          import com.qualcomm.robotcore.eventloop.opmode.LinearOpMo de;
          import com.qualcomm.robotcore.hardware.DcMotor;
          import com.qualcomm.robotcore.hardware.DcMotorSimple;
          import com.qualcomm.robotcore.hardware.HardwareMap;
          import com.qualcomm.robotcore.util.ElapsedTime;

          @Autonomous (name = "AutoRed")

          public class AutoRed extends LinearOpMode

          {
          //*Declare Motors
          DcMotor motorLeft = null;
          DcMotor motorRight = null;

          @Override
          public void runOpMode() throws InterruptedException

          {
          //*Initialize motors
          motorLeft = hardwareMap.dcMotor.get("motorLeft");
          motorRight = hardwareMap.dcMotor.get("motorRight");

          motorLeft.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCO DER);
          motorRight.setMode(DcMotor.RunMode.RUN_WITHOUT_ENC ODER);

          motorLeft.setDirection(DcMotor.Direction.REVERSE);

          waitForStart();

          //*Drive Forward
          motorLeft.setPower(1);
          motorRight.setPower(1);
          Thread.sleep(5000);

          //*Turn Right
          //*motorLeft.setPower(1);
          //*motorRight.setPower(-1);
          //*Thread.sleep(1675);

          //*Drive Forward
          //*motorLeft.setPower(1);
          //*motorRight.setPower(1);
          //*Thread.sleep(4000);

          //*Stop
          motorLeft.setPower(0);
          motorRight.setPower(0);

          //* It takes 3 seconds to bump the ball, then turn 45 degrees, then 4 seconds to get to the ramp.

          }
          }

          Comment


          • #6
            I copied your code and put it on my phone (hardware commented out since I only have phones here). AutoRed shows on my list.

            Are you clicking on the left triangle that is pointed to by the word autonomous about mid screen on the driver station phone, to bring up the list of opmodes?

            Comment


            • #7
              When you need to download something to your phone through android studio just get a usb to mini usb cable that connects to the phone. On the top right row in AS there is a green play button. When your phone is connected to your computer just click that button and it will download.

              Comment

              Working...
              X