资讯详情

java - FTC Android Studio problems - Stack Overflow

(This is for my FIRST team)

When attempting to compile my code, and to put the result on the Driver Station, after hitting the Play button there is a "Module Not Specified" error and the resulting code is not compiled and the Op Mode is subsequently not on the Driver Station. We are now using version 3.0 of Android Studio (previously an outdated version). In previous times, we did not have this error with a module. Is anyone capable of explaining the concept of a module and how to add one so this error stops? I myself am fairly new to software development using Android Studio. Though I do not believe the code is the error, I will provide it for the sake of context. Any help is appreciated :D

package org.firstinspires.ftc.teamcode;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;

import com.qualcomm.robotcore.eventloop.opmode.TeleOp;

import com.qualcomm.robotcore.hardware.DcMotor;

import org.firstinspires.ftc.robotcore.external.Telemetry;

@TeleOp(name="AutoDrive", group="TankDrive")

public class AutoDrive extends OpMode

{

private DcMotor leftFrontMotor = null;

private DcMotor leftBackMotor = null;

private DcMotor rightFrontMotor = null;

private DcMotor rightBackMotor = null;

boolean sent;

private int driveTime;

public void init()

{

leftFrontMotor = hardwareMap.dcMotor.get("leftFront"); //Get motor objects, store them in corresponding reference variables

rightFrontMotor = hardwareMap.dcMotor.get("rightFront");

leftFrontMotor.setPower(0);

rightFrontMotor.setPower(0);

driveTime = 3000 // Robot will take 3 seconds with current weight to drive to safe zone

Telemetry.addLine("Hardware variables successfully instantiated");

sent = Telemetry.update();

}

public void start()

{

long limit = System.currentTimeMillis() driveTime;

while(System.currentTimeMillis() < limit) //drive in straight line for limit seconds

drive();

Telemetry.addLine("Stopping..");

sent = Telemetry.update();

}

public void loop() {}

public void stop()

{

leftFrontMotor.setPower(0);

rightFrontMotor.setPower(0);

Telemetry.addLine("Robot successfully stopped.");

sent = Telemetry.update();

}

private void drive()

{

leftFrontMotor.setPower(1);

rightFrontMotor.setPower(1);

}

}

标签: ftc334c电容式触摸ic

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台