beta8397 / virtual_robot Goto Github PK
View Code? Open in Web Editor NEWA 2D robot simulator to help beginners learn Java programming for FTC Robotics
A 2D robot simulator to help beginners learn Java programming for FTC Robotics
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
VirtualBot bot = getVirtualRobotController().getVirtualBotInstance(getVirtualRobotController().getCbxConfig().getValue()); bot.setPosition(10,10,0);
When I run this code, I get the error in the title. I want to access the VirtualBot class of the current robot while running opmodes, but every attempt I try at this gets an error similar to the one in the title.
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.
Currently, it is possible in the simulator to obtain reference to hardware before INIT button is pressed (i.e., a call to hardwaremap.get will work). In the real FTC system, this will not work (hardware references are obtained within the runOpMode or init methods).
Road-Runner-Quickstart-Instructions appear outdated or do not function as expected
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!
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
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.
Will the game and field be updated for centerstage?
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.
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.
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.
@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.
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]
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.
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
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.
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)
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
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.
As Oracle is making it more and more of a pain with what has to be agreed to to download the jdk 8, I am having students get Amazon Corretto (their JDK 8). I have verified it works with the simulator.
To get it: https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html
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.
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.
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.
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!
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:
The app now allows the use of two gamepads (just use Start-A and Start-B as you would for FTC SDK).
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.
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.
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.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.