android studio与ftc,java - FTC Android Studio problems - Stack Overflow

在尝试编译代码并将结果发送到DriverStation时,遇到'Module Not Specified'错误。更新到Android Studio 3.0版本后问题出现。文章探讨了模块的概念,以及如何在Android Studio中添加模块以消除错误。代码示例是一个FTC团队的自动驾驶OpMode。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(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);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值