GithubHelp home page GithubHelp logo

virtual_robot's Introduction

A 2D simulator to help beginning Java programmers learn to program for FTC Robotics.

New: CenterStage field image added. Physics set up for backdrops and truss legs so that they serve as barriers to robot motion.

Also: A Kiwi-Drive robot configuration with three omni wheels arranged around a 16 inch diameter circular chassis.

Want to use virtual_robot to try out AcmeRobotics RoadRunner? Refer to the Road-Runner-Quickstart-Instructions pdf.

Includes Programming Board configuration to serve as a companion to the book "Learn Java For FTC", by Alan Smith. The PDF can be downloaded for free or you can purchase the paperback on Amazon.

This is a JavaFX application developed using the (free) IntelliJ IDEA Community Edition IDE. The repository can be downloaded and unzipped, then opened with IntelliJ. It can also be run using Android Studio (see this video).

Multiple robot configurations are available. MecanumBot has a mecanum drive with a servo-driven arm at the back, and with three dead-wheel encoders. XDriveBot has four corner-mounted Omni-wheels, a rear arm driven by a cr-servo, and three dead-wheel encoders. ArmBot is a mecanum drive bot with a motor-driven arm and servo-driven grabber. Several other configurations (SwerveBot, DiffSwerveBot, etc) are available, but are currently disabled. They can be enabled by un-commenting the @Botconfig annotations in their configuration classes (package virtual_robot.robots.classes).

Each robot can be thought of as 18 inches wide. For the two-wheel bot and mecanum wheel bots, the distance between the centers of the right and left wheels is 16 inches. For the mecanum wheel bots, the distance between the centers of the front and back wheels is 14 inches, and the mecanum wheels (when viewed from the top) have an "X" configuration. For the X-Drive bot, the distance between the centers of any two adjacent wheels is 14.5 inches. Each motor has an encoder. There is a downward-facing color sensor in the center of each robot. A BNO055 IMU is also included. Each robot also has distance sensors on the front, left, right and back sides. A small green rectangle indicates the front of each robot. Wheel diameters are all 4 inches. For the robots with dead-wheel encoders (MecanumBot and XDriveBot), the forward-reverse encoder wheels are mounted 6 inches to the right and left of center, while the X-direction (i.e., right-left) encoder wheel is mounted at the center. The dead-wheels are two inches in diameter. Positioning of the dead-wheels can be changed easily in the robot configuration classes.

The field can be thought of as 12 feet wide. The field graphic (currently the Freight Frenzy field) is obtained from a bitmap (.bmp) image. The color sensor detects the field color beneath the center of the robot. The field graphic is easily changed by providing a different .bmp image in the virtual_robot.config.Config class. The .bmp image is the freight_field648.bmp file in the virtual_robot.assets folder. If a different .bmp image is used, it must be at least as wide and as tall as the field dimensions (currently 648 x 648 pixels to fit on the screen of most laptops). The Config class also allows selection between the use of "real" hardware gamepads versus a "virtual gamepad".

In addition to the robot configurations described above, there is an additional configuration called "ProgrammingBoard". It is meant to emulate the programming board described in the book "Learn Java For FTC", by Alan Smith. (The PDF can be downloaded for free or you can purchase the paperback on Amazon.) It is a board with several hardware devices attached: DcMotor, Servo, Potentiometer, Touch Sensor, and a Color-Distance Sensor. It also has a BNO055 IMU. The board doesn't move around the field, but it can be rotated (to test the IMU) by dragging the board chassis.

An approximation of the FTC SDK is provided.

User-defined OpModes must be placed in the org.firstinspires.ftc.teamcode package, and must extend OpMode (or LinearOpMode). OpModes are registered by placing a @TeleOp or @Autonomous annotation immediately above the class declaration.

Several example OpModes are provided in the org.firstinspires.ftc.teamcode package. To minimize clutter, a number of sample op modes are currently disabled; they can be re-enabled by commenting out the @Disabled annotation. A number of robot configurations are also disabled. A robot configuration can be re-enabled by finding its class in the virtual_robot.robots.classes package, and un-commenting its @BotConfig annotation.

To use:

  1. Make sure you have the Java JDK installed on your PC. Also, install the free Community Edition of JetBrains IntelliJ IDEA. (See the Detailed Installation Instructions PDF)
  2. Download the virtual_robot .zip, and extract contents. Open the project in IntelliJ. You'll see three modules in the project (Controller, TeamCode, and virtual_robot) -- the only module you'll need to touch is TeamCode. It contains the org.firstinspires.ftc.teamcode package.
  3. Write your OpModes in the org.firstinspires.ftc.teamcode package; make sure to include a @TeleOp or @Autonomous annotation. These must extend the OpMode class (may either extend OpMode OR LinearOpMode). OpMode must provide init() and loop() methods; LinearOpMode must provide runOpMode() method.
  4. You can either use the Virtual Gamepad (currently the default), or use one or two real Gamepads; to use real gamepads, open Controller/src/virtual_robot/config/Config.java and set USE_VIRTUAL_GAMEPAD to false. Then plug in your gamepad(s).
  5. Run the application (by clicking the green arrowhead at the toolbar).
  6. If using real gamepad(s), press start-A or start-B on gamepad(s) to select which is gamepad1 vs. gamepad2.
  7. Use Configuration dropdown box to select a robot configuration. The configuration will be displayed.
  8. Use the Op Mode drop down box to select the desired OpMode.
  9. Prior to initialization, position the robot on the field by left-mouse-clicking the field (for robot position), and right-mouse-clicking (for robot orientation).
  10. Use the INIT/START/STOP button as you would on the FTC Driver Station.
  11. If desired use the sliders to introduce random and systematic motor error, and inertia.

LOG OF CHANGES

CHANGES 12/7/2022 Added IMU interface, ImuOrientationOnRobot interface, RevHubOrientationOnRobot class, Quaternion class. Added Square Omniwheel Robot configuration (omniwheels on the sides rather than corners)--This is disabled by default, but can be re-enabled by un-commenting its Botconfig annotation.

CHANGES 8/26/2022 Rumble and LED capability added to the Virtual Gamepad, thanks to Alan Smith, FTC 16072. Also, fixed the invert method for 1x1 and 2x2 matrices in MatrixF, now that the corresponding bug has been fixed in the FTC SDK.

CHANGES 10/16/2021 Implemented the Freight Frenzy game, and FreightBot robot configuration. The NoGame simulation is still available, and can be set in Config.java (see below). In keeping with the FTC SDK v7.0, the Gamepad.setJoystickDeadzone method has been removed. The deadzone is fixed at 0.2, and absolute input values from 0.2->1.0 are mapped into the 0.0->1.0 range. The ACME Robotics RoadRunner core is now included as a library. EasyOpenCV is also included as a library, although only for compatibility with import statements in user classes.

CHANGES 5/7/2021 Incorporated changes from Daniel McDonald/Bots Of Prey to allow interaction with game elements. Then, to accommodate future games and simplify collision handling, incorporated the dyn4j physics and collision engine. Most robot configurations have been modified to work with the physics engine (though ArmBot has not, and provides a purely kinematic simulation). Only one configuration, BetaBot, actually takes up game elements (rings) and shoots them. A NoGame simulation is available: in Config.java, just set GAME = NoGame(). For the physics simulation, the friction coefficient between the robot wheels and the field is currently very high (10), so there is virtually no skidding. This can be modified in the Config.java class.

CHANGES 1/22/2021 Changed telemetry to match (nearly completely) the API of the FTC SDK (but no speech). Also, add stack trace output for exceptions thrown by op modes.

CHANGES 9/20/2020 Added Swerve robot configuration. Each of four swerve units has: a DcMotor for drive, a CR-Servo for steering, and a separate encoder to monitor steering (this appears as a DcMotor in the config file). A TestSwerve op mode is included for demonstration.

CHANGES 9/13/2020 Added the ability to "constrain" the field, to simulate partial fields being used for remote competitions. For a "RED" field, change the value of X_MIN_FRACTION in Config.java from 0 to 0.3333. For a partial "BLUE" field, change the value of X_MAX_FRACTION from 1 to 0.6667. This will mask the excluded parts of the field, and constrain robot motion. The distance sensors will behave as if the wall has been moved to the edge of the constraint area.

CHANGES 8/29/2020 Added the ability to have the "virtual gamepad" triggers and joysticks "snap back" to zero when released. By default, they will hold at current position when released. But, if the SHIFT or ALT key is being pressed, then when these controls are released, they will return to zero. The default behavior can be changed by changing the value of HOLD_CONTROLS_BY_DEFAULT in virtual_robot.config.Config.java.

CHANGES 8/22/2020
Added programming board configuration to serve as a companion for the book "Learn Java For FTC", by Alan Smith.

The PDF can be downloaded for free or you can purchase the paperback on Amazon.

CHANGES 7/22/2020 Added "Dead-wheel" encoder capability, and a new robot configuration that has mecanum drive wheels and three dead-wheel encoders. Also added a new op mode to demonstrate dead-wheel odometry.

CHANGES 12/16/2019 Further changes to facilitate creation of new robot configurations. The robot configuration classes (e.g., MechanumBot) still extend VirtualBot. But now, these classes are also the JavaFX Controller classes for the fxml markup files that define the robot's graphical representation in the UI. The robot configuration class must have a @BotConfig annotation that indicates the name of this config (as it will be displayed to the user) and the filename of its corresponding fxml file. The fxml file must have a Group object as its root, and must set the fx:controller attribute of that group to the name of the robot config class. Individual nodes in the group can be given fx:id attributes, which make them accessible in the robot config class by using a @FXML annotation. The easiest way to create a new configuration is to copy, then modify, the ".java" and ".fxml" files from an existing configuration (for example, MechanumBot.java and mechanum_bot.fxml). See extensive comments in the virtual_robot.controller.VirtualBot and virtual_robot.robots.classes.ArmBot classes and the virtual_robot.robots.fxml.arm_bot.fxml file for more explanation.

CHANGES 12/12/2019 Changes made to all more versatile building of new robot configurations. A transparent robot base layer (equal in width to the field) was added. This makes it possible for the robot to have accessories that extend well beyond the chassis in all four directions. A new robot configuration, ArmBot, was added. It has an extensible arm with a grabber at the end. The arm is DC Motor-operated. The grabber is Servo-operated. It is a mecanum-wheeled bot.

CHANGES 11/29/2019 Range class and additional op modes contributed by FTC Team 16072. Servo interface (and ServoImpl class) enhanced with more features of the actual FTC SDK: ability to reverse direction and to scale position range.

CHANGES 10/6/2019 Added the option of using "Virtual GamePad" instead of real GamePad. To do this, go to the Config.java class in the virtual_robot.config package (within the Controller module), and assign "true" to the USE_VIRTUAL_GAMEPAD constant. Other constants in this class include the field image (BACKGROUND) and the field width in pixels (FIELD_WIDTH). If changing FIELD_WIDTH, need to supply a square bitmap (.bmp) field image that is FIELD_WIDTH pixels wide.

CHANGES 8/17/2019 RUN_TO_POSITION mode is now available for DcMotor, with setTargetPosition, getTargetPosition, and isBusy methods. Added 175 ms of latency to the BNO055IMU.

CHANGES 8/4/2019 To better approximate real robot behavior, latency of 175ms added to the standard gyro sensor (used only on the Two-Wheel Bot). That is, updated values are available only every 175ms. The amount of latency can be changed easily in the createHardwareMap method of the virtual_robot.robots.classes.TwoWheelBot class. Will probably make a similar change to the BNO055IMU soon.

CHANGES 7/10/2019 To improve plug and play with OpModes copied and pasted from Android Studio, multiple packages were renamed. In addition, Continuous Rotation Servo capability was added. The XDrive Bot now has a CR Servo in the back rather than a standard servo. The XDriveBotDemo op mode demonstrates the use of this servo, using gamepad2.

NOTE: OpModes copied directly from Android Studio to Virtual Robot do not automatically compile when pasted into
Virtual Robot in IntelliJ, and won't show up in the OpModes dropdown box until they are compiled. Three different
methods to force compilation are: 1) Right click the file and select "Recompile"; 2) From the "Build" menu,
select "Rebuild Project"; or, 3) Make any change at all to the OpMode file (e.g., add a comment). Any one of these
methods is sufficient.

CHANGES 7/06/2019 Now uses @TeleOp, @Autonomous, and @Disabled class annotations to control the display of OpModes in the OpMode combobox. For @TeleOp and @Autonomous, a name parameter must be specified. The group parameter is optional (default group is "default"). GamePad setJoystickDeadzone capability contributed by FTC team 16072.

CHANGES 7/01/2019 Now supports two GamePads instead of just one. Use start-A and start-B to select gamepad1 and gamepad2, as you would in the FTC SDK. Two op modes for Mecanum Bot contributed by FTC team 16072, including a nice demonstration of field-centric drive using the IMU. These are in the org.firstinspires.ftc.teamcode.ftc16072 package.

CHANGES 6/25/2019 Contribution from Alan Smith (alan412): now supports "regular" op modes in addition to linear op modes.

CHANGES 4/3/2019 1. Added BNO055IMU interface to simulate (in a limited way) coding for the IMU in the REV Expansion Hub. 2. The Mecanum Bot and X Drive Bot now have a BNO055IMU rather than the original gyro. 3. The Two-Wheel Bot still has the original gyro. 4. DCMotor interface renamed to DcMotor, in keeping the the FTC SDK. 5. New utility classes: enum AngleUnit, enum AxesOrder, enum AxesReference, class Orientation

CHANGES 3/23/2019 1. Uses real game pad (instead of the original "virtual" game pad. 2. Added an X-Drive robot configuration. 3. Tweaks to opModeIsActive() and addition of isStopRequested() to allow while() loop before START. 4. Added Color class with single static method: RGBtoHSV(red, green, blue, hsv). 5. Added distance sensors to all robot configurations to measure distance from walls. 6. Replaced LineFollow example opMode with MechBotAutoDemo, a line follower that actually works.

virtual_robot's People

Contributors

alan412 avatar c4glenn avatar danielmcd avatar ftcteam8397 avatar jjtech0130 avatar jkenney2 avatar zhongxuanwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

virtual_robot's Issues

Application immediately crashes

The application immediately crashes after running it.
This is a fresh install of java and intellij. Any thoughts on this error?

Exception in Application start method
Exception in Application stop method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:873)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException:
/C:/Users/leonp/Downloads/virtual_robot-master/virtual_robot-master/out/production/Controller/virtual_robot/controller/virtual_robot.fxml

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2571)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at virtual_robot.controller.VirtualRobotApplication.start(VirtualRobotApplication.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:187)
... 1 more

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
... 12 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:659)
at java.util.ArrayList.get(ArrayList.java:435)
at com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
at virtual_robot.controller.VirtualRobotController.setupCbxOpModes(VirtualRobotController.java:372)
at virtual_robot.controller.VirtualRobotController.initialize(VirtualRobotController.java:135)
... 22 more
Exception running application virtual_robot.controller.VirtualRobotApplication

Process finished with exit code 1

Create option for inertia...

We were noticing that one major difference between testing with the simulator and on our robot is that the simulator has no inertia.

It would be interesting to be able to add some inertia in (just like the option for motor error) where the wheels had a limit of how fast they could change.

Bring back virtual controllers?

This is a great tool and as is will be very helpful for teaching autonomous mode programming.

Is there any possibility of bringing back virtual controllers as an option (while keeping the physical controllers)?

Our team has few controllers available so this limits the use of the simulator. Also, team members could work at home where they might not have any physical controllers. Thanks for considering.

Virtual gamepad - snap back issue

If you have "HOLD_CONTROLS_BY_DEFAULT" = False and you are on right joystick and move to the left and keep going and get mouse on left joystick and move it then when you let go, it lets go of the left joystick (snapping it back) but doesn't snap back the right joystick.

Please let me know if this doesn't make sense.

Should support opMode

OpModes (that aren't linear) should be the main support. LinearOpModes are simply a derived class from OpMode, so bringing over that declaration would allow both OpModes and LinearOpModes to be supported.

I forked the project so I could see about adding this support. If I am able to get to it, then I'll issue a pull request.

OpMode Annotations

Should use TeleOp, Autonomous, and Disabled annotations identical to those in the FTC SDK to select how available op modes will be displayed. The annotations branch has implemented this. Plan to merge after some testing.

Can't load process

It is giving me this error: Error running 'Main': Cannot start process, the working directory 'C:\Users\Guest\Downloads\virtual_robot-master\virtual_robot\Controller\src\virtual_robot\config' does not exist

I have everything configured properly including the JDK. I'm using IntelliJ.

Ability to add new robot configurations is limited

  1. Robot configurations cannot have accessories extending beyond the front or left side of the chassis, because that would change the "center-of-turning" of the bot.

  2. Adding new configurations requires modification of the VirtualRobotController class (the core code for the app), and new robot classes must reference UI nodes based on their numerical position in a group.

Error building with RR files

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

Virtual Controller not displaying

Running Mac OSX 10.13.6 with Java SDK 1.8.0_201. I can run the program and run the OpModes and we've been able to test Autonomous modes (which is awesome!!), but the controller never displays. Do get the following in debug:
Exception in thread "Thread-7" java.lang.NullPointerException at teamcode.LineFollow.runOpMode(LineFollow.java:16) at virtual_robot.controller.VirtualRobotController.runOpModeAndCleanUp(VirtualRobotController.java:180) at virtual_robot.controller.VirtualRobotController.access$400(VirtualRobotController.java:33) at virtual_robot.controller.VirtualRobotController$2.run(VirtualRobotController.java:133) at java.lang.Thread.run(Thread.java:748)

Virtual Controller joystick/trigger behavior

Firstly, thanks for creating this amazing project and I can't wait to use it more with my team.

Issue is that the joysticks and triggers on the virtual controller don't "snap back" to the neutral position when I release them. I have to manually move them back in order to get the robot/servos/whatever to stop moving. Would be nice if they behaved more like a real controller in this respect.

Anyway, minor issue on a great project.

Add Differential swerve

Hi
It's not issue it's suggestion
I think you need to add swerve and Differential swerve it's can be very helpful for team I mentor (I make one on yours sim but it's not working so good)
I can help if you want

Error When Inititializing

When clicking the "init" button in the application window, the program throws:
"Exception from runOpMode:
java.lang.IllegalArgumentException
No com.qualcomm.robotcore.hardware.DcMotor named arm_motor is found.
Thread for runOpMode has terminated successfully."

As a result, driving does not work

Add support for remote fields...

The remote field is only 8 feet by 12 feet. I haven't thought yet about what all needs to be changed, but it would be good to have the red and blue remote fields both in.

(I am in NC which has said all tournaments will be remote.)

pull_request_68 branch

@c4glenn
See pull_request_68 branch. I added a remove method to the DeviceMapping class (which is nested in HardwareMap), added a qq_bot.fxml file (for which QQBot.java is the controller class). See comments in the createHardwareMap method of QQBot.java. I wasn't sure whether the internals of JavaFx would tolerate extending the TurretBot class, but it seems to work. Does it function the way you expected?

Edit: Have also rearranged some setup code, moving it out of constructors and into 'initialize' methods. This allowed creation of a constuctor for MechanumBase that takes a parameter for drive motor type. A subclass of MechanumBase could now use this constructor to use motors other than the default Neverest40.

Deadlock issue involving VirtualBot, BNO055IMUImpl, and GyroSensorImpl classes

After INIT pressed, BNO055IMUImpl.initialize(), which is synchronized, gets called from the op mode thread. This method calls VirtualBot.getHeadingRadians(), which was also synchronized. So the op mode thread owns the BNO055IMUImpl lock, and must obtain the VirtualBot lock before it can proceed.

At the same time VirtualBot.updateStateAndSensors(), which is synchronized, is being called repeatedly by the game loop thread. This calls BNO055IMUImpl.updateHeadingRadians(), which is also synchronized. So the game loop thread owns the VirtualBot lock, and mus obtain the BNO055IMU lock before it can proceed.

The above can cause a deadlock.

Solution: make VirtualBot x, y, and headingRadians fields volatile, and remove the 'synchronized' keyword from their getter methods.

Feature Request: Add Gradle Support

Would it be possible to configure this repo with gradle, such that one monolithic repository can build both the production code and the simulator with different targets? I don’t have time to invest in this, but it seems possible and would be a very nice feature to have.

left_motor in config not defined

It is literally what the title says. The application says that it is not defined, using try/catch, and as such, I can't access the code needed to change it. java.lang.IllegalArgumentException, No com.qualcomm.robotcore.hardware.CRServo named back_crservo is found. Please help me define it. Thank you!

I have a question-

Hi
I am the Director of the Illinois FIRST Tech Challenge program and I have a project that I could use your help with.

We're trying to create a 3D robotics simulator for FTC teams and I had some questions about your simulator.

Here's a sample of what we have so far : Virtual FTC - Cloud sim remote control from phone, The Simulation is running in a Field VM on Google Cloud Platform and streaming through WebRTC on a browser. Android Java app on his phone at home (or Android Studio emulator). Communication going through ROSBridge and Websockets.

Hoping we can chat or zoom at some point

Jonathan Weiland Jonathan Weiland [email protected]

Unable to run program (no configuration)

Hello!
I have followed the steps in the readme file as well as on the video tutorial. I have downloaded the JDK, IntelliJ, and the project folder. I imported the project, but I am unable to run the program. The 'run' button which is usually a green play button is grey. I believe it is because there is no configuration. I can see this in the drop-down menu next to the run button where it says 'edit configurations'. I'm not sure where to go from here.

Thanks!

Recent Feature Changes

@alan412 @c4glenn

Thanks for your contributions! If you clone or download the repository, you'll find they (regular OpMode capability, ftc16072 example op modes, gamepad deadzone) are incorporated, and that there have been a couple of additional significant changes:

  1. The app now allows the use of two gamepads (just use Start-A and Start-B as you would for FTC SDK).

  2. OpModes are now registered in the same way the FTC SDK does it, using TeleOp, Autonomous, and Disabled annotations. The OpModes class and OpModeList are gone. In theory, you should be able to put your op modes in any package, not just teamcode.

Telemetry behavior needs to follow FTC SDK more closely

@alan412

Currently, update() statement ALWAYS clears telemetry. That means that telemetry written during init() method doesn't persist. It gets cleared immediately by the call to telemetry.update() in the internalPostInitLoop() method.

For example, this breaks the Helloworld example in Learn Java For FTC.

I will do a little testing with the real SDK and Android Studio to figure out how this behaves, and make some changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.