[IntelliJ IDEA CE for和FTC机器人模拟器中的导入问题

问题描述 投票:-1回答:1

我正在尝试使用Beta#8397团队设计的虚拟机器人模拟器,并使该模拟器正常工作。现在,我正在尝试将团队代码放入代码中,以便我们对其进行测试。我收到很多错误,我可以肯定所有错误都源于某些导入未导入的错误。另外,如果不与模拟器结合使用,我的团队代码会很好地构建。我对Java并不感到惊讶,但确实知道我大多数团队的代码是如何工作的。这是导入的代码

package org.firstinspires.ftc.teamcode.Robovines;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.robot.Robot;
import com.qualcomm.robotcore.util.Hardware;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.Range;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DigitalChannel;

错误出现在第4,5和13行,包为第一行。在第4行,错误是com.qualcomm.robotcore.robot.Robot不存在。在第5行和第13行,错误是分别找不到符号“硬件”和“ DigitalChannel”。Here is the whole project

intellij-idea import compiler-errors robotics
1个回答
0
投票

@@ BookNinja S:您提供的链接不会将我带到您的代码。

虚拟机器人模拟器提供了FTC SDK功能的子集。

该子集随时间增加,但是如@CrazyCoder所述,控制器模块不包括com.qualcomm.robotcore.robot.Robot,com.qualcomm.robotcore.util.Hardware或com.qualcomm.robotcore。 hardware.DigitalChannel类。

关于DigitalChannel,这种类型的传感器不是虚拟机器人功能的一部分。但是,将虚拟的DigitalChannel类添加到控制器很容易(因此,getState将始终返回false,而setState将不执行任何操作)。

虚拟类也可能同时用于硬件和机器人,但这取决于您在操作模式下如何使用这些类。

如果您将问题作为问题提交到virtual_robot github存储库上,并带有指向您项目的链接或对您如何使用Hardware和Robot类的说明,我们(ftc团队Beta 8397)可能会向其中添加所需的功能。 virtual_robot项目。

© www.soinside.com 2019 - 2024. All rights reserved.