Beta8397 / virtual_robot

A 2D robot simulator to help beginners learn Java programming for FTC Robotics
100 stars 171 forks source link

Error building with RR files #96

Closed graceliu closed 1 year ago

graceliu commented 1 year ago

Hi, I imported RoadRunner files and I am getting build errors. I was hoping virtual robot is able to support RoadRunner. Let me know ideas on how to resolve the following issues?

For example, I would like to use the SampleMecanumDrive, and I get the following errors:

/Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java:27:39 java: cannot find symbol symbol: class VoltageSensor location: package com.qualcomm.robotcore.hardware /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java:76:13 java: cannot find symbol symbol: class VoltageSensor location: class org.firstinspires.ftc.teamcode.drive.SampleMecanumDrive

For example, I would like to use trajectory sequence, and I am getting the following errors:

/Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:3:27 java: cannot find symbol symbol: class Nullable location: package androidx.annotation /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:6:41 java: package com.acmerobotics.dashboard.canvas does not exist /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:203:13 java: cannot find symbol symbol: class Canvas location: class org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequenceRunnerCancelable /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:79:13 java: cannot find symbol symbol: class Nullable location: class org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequenceRunnerCancelable /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:69:18 java: cannot find symbol symbol: method setTelemetryTransmissionInterval(int) location: variable dashboard of type com.acmerobotics.dashboard.FtcDashboard /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:85:9 java: cannot find symbol symbol: class Canvas location: class org.firstinspires.ftc.teamcode.trajectorysequence.TrajectorySequenceRunnerCancelable /Users/graceliu/Documents/robotics/virtual_robot/TeamCode/src/org/firstinspires/ftc/teamcode/trajectorysequence/TrajectorySequenceRunnerCancelable.java:85:37 java: cannot find symbol symbol: method fieldOverlay() location: variable packet of type com.acmerobotics.dashboard.telemetry.TelemetryPacket

jkenney2 commented 1 year ago

Are you trying to use the road-runner-quick-start code?

If so, the issue is that the quickstart code makes use of both the roadrunner core, and additional code from acmerobotics (and some from FTC, google, etc) that is separate from the roadrunner core, and is not supported in virtual_robot.

The solution will be: 1) add some code to virtual_robot to minimize the incompatibility; then, 2) User removes a few non-critical things from road-runner-quickstart to allow virtual_robot to build.

Work on item (1) is ongoing. Will include instructions for item (2) when this issue is closed.

jkenney2 commented 1 year ago

EDITED 3/7/2023 (again)

Changes have been made to better accommodate the use of road-runner-quickstart. However, several changes to the quickstart files will still be necessary:

From the util package, delete: Logfiles.java, LoggingUtil.java, LynxModuleUtil.java, and AssetsTrajectoryManager.java.

From the drive.opmode package, delete: AutomaticFeedForwardTuner.java

In trajectorysequence.TrajectorySequenceRunner.java, comment out line 26: //import org.firstinspires.ftc.teamcode.util.LogFiles;

In trajectorysequence.TrajectorySequenceRunner.java, comment out lines 212-217: // if (targetPose != null) { // LogFiles.record( // targetPose, poseEstimate, voltage, // lastDriveEncPositions, lastDriveEncVels, lastTrackingEncPositions, lastTrackingEncVels // ); // }

In SampleMecanumDrive.java, comment out line 34: //import org.firstinspires.ftc.teamcode.util.LynxModuleUtil;

In SampleMecanumDrive.java, comment out line 87: // LynxModuleUtil.ensureMinimumFirmwareVersion(hardwareMap);

In SampleMecanumDrive.java, change the names of motors in lines 101-104 as follows: leftFront = hardwareMap.get(DcMotorEx.class, "front_left_motor"); leftRear = hardwareMap.get(DcMotorEx.class, "back_left_motor"); rightRear = hardwareMap.get(DcMotorEx.class, "back_right_motor"); rightFront = hardwareMap.get(DcMotorEx.class, "front_right_motor");

In SampleTankDrive.java, comment out line 34: //import org.firstinspires.ftc.teamcode.util.LynxModuleUtil;

In SampleTankDrive.java, comment out line 81: // LynxModuleUtil.ensureMinimumFirmwareVersion(hardwareMap);

In SampleMecanumDrive.java, at the "TODO" comment, line 119, reverse the directions of the left motors: // TODO: reverse any motors using DcMotor.setDirection() leftFront.setDirection(DcMotorSimple.Direction.REVERSE); leftRear.setDirection(DcMotorSimple.Direction.REVERSE);

It is necessary to provide some information about the robot in DriveConstants.java. The following work well with the Mecanum robot configuraiton in virtual_robot:

TICKS_PER_REV = 1120 MAX_RPM = 160 RUN_USING_ENCODER = true TRACK_WIDTH = 17.91 MAX_VEL = 28 MAX_ACCEL = 28

Also, max linear and turn velocities can be set as follows: public static double MAX_VEL = 28; public static double MAX_ACCEL = 28; public static double MAX_ANG_VEL = Math.toRadians(175); public static double MAX_ANG_ACCEL = Math.toRadians(175);

graceliu commented 1 year ago

Wow!  You are so fast!  Thank you so much!  I will not be able to try this out today, but will do so as soon as I can. Best, Grace

On Monday, March 6, 2023 at 07:33:02 PM PST, jkenney2 ***@***.***> wrote:  

Changes have been made to better accommodate the use of road-runner-quickstart. However, several changes to the quickstart files will still be necessary:

From the util package, delete: Logfiles.java, LoggingUtil.java, LynxModuleUtil.java, and AssetsTrajectoryManager.java.

From the drive.opmode package, delete: AutomaticFeedForwardTuner.java

In trajectorysequence.TrajectorySequenceRunner.java, comment out lines 212-217: // if (targetPose != null) { // LogFiles.record( // targetPose, poseEstimate, voltage, // lastDriveEncPositions, lastDriveEncVels, lastTrackingEncPositions, lastTrackingEncVels // ); // }

In SampleMecanumDrive.java, comment out line 87: // LynxModuleUtil.ensureMinimumFirmwareVersion(hardwareMap);

In SampleMecanumDrive.java, change the names of motors in lines 101-104 as follows: leftFront = hardwareMap.get(DcMotorEx.class, "front_left_motor"); leftRear = hardwareMap.get(DcMotorEx.class, "back_left_motor"); rightRear = hardwareMap.get(DcMotorEx.class, "back_right_motor"); rightFront = hardwareMap.get(DcMotorEx.class, "front_right_motor");

In SampleTankDrive.java, comment out line 81: // LynxModuleUtil.ensureMinimumFirmwareVersion(hardwareMap);

In SampleTankDrive.java, at the "TODO" comment, line 119, reverse the directions of the left motors: // TODO: reverse any motors using DcMotor.setDirection() leftFront.setDirection(DcMotorSimple.Direction.REVERSE); leftRear.setDirection(DcMotorSimple.Direction.REVERSE);

It is necessary to provide some information about the robot in DriveConstants.java. The following work well with the Mecanum robot configuraiton in virtual_robot:

TICKS_PER_REV = 1120 MAX_RPM = 160 RUN_USING_ENCODER = true TRACK_WIDTH = 17.91 MAX_VEL = 28 MAX_ACCEL = 28

Also, max linear and turn velocities can be set as follows: public static double MAX_VEL = 28; public static double MAX_ACCEL = 28; public static double MAX_ANG_VEL = Math.toRadians(175); public static double MAX_ANG_ACCEL = Math.toRadians(175);

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>