I’m looking for a very simple simulator which would allow us to teach new students how to write robot code and run it without having an actual robot. Since we can’t meet in person, we have no way to test code being written. And it’s incredibly difficult for a new student to get a handle on the way code executes without being able to see the results. The “GearsBot” example code which is provided in the VS Code install would be a perfect teaching tool if we could “see” the code execute. I tried using the “simulate robot code on desktop” option but it’s not particularly useful. All I could do was see some motor speed values change. I would love to see a graphic representation of the robot and watch it move as buttons are pressed.
From what it sounds like, you want a full physics simulation where you can drive around a virtual robot? If so, nothing that’s plug n play is currently available. There are physics being built into the WPILib simulation (that simulate robot code on desktop) button for a 2D robot, but that also requires a bit of work, as we can’t easily guess your exact hardware setup.
I was thinking of something like the simplistic Scratch interface. I realize that’s pretty limited but it’s better than nothing. Obviously every year we get students who know nothing at all about FRC. Some of them don’t even know how to program. So it really helps to have some easy learning tools. Most of our students use laptops running windows. And the school classroom uses Windows PCs.
I was able to simulate our robot code using FRC Sim. I haven’t played with it too much but I was able to drive around our robot in the sim using WASD after messing with out joystick code a bit.
Thanks. I’ll look into that.
My team is only meeting remotely this year, and most of the students only have chromebooks, so I’ve been working on creating robot simulations they can run by visiting a website. I’ve been using gitpod for this and this is what I have so far:
Here’s the repo if you want to try it yourself: GitHub - frc-web-components/differential-drive-simulation
It uses a java differential drive state-space sim example that has yet to be merged. This is all a work in progress, and I hope it will improve a lot over the next few weeks. I plan on creating sims for many of wpilib’s examples, including more interesting ones like gearsbot.
I wrote the FRCSim for our team (4183) last year due to limited robots to go around. This year we will be using it with new students and hopefully improving it. I created this empty SimBot project that comes with sim support configured and a vs code launch configuration:
It’s pretty easy to configure motors just by copy/pasting some yaml code, or letting the sim run with defaults. Configuring a drive base is a little trickier, but if you aren’t concerned about modeling your exact robot, you can just use the sample yaml and robot ids in the SimBot. That’s what I do for testing. If you configure a drive base, you can get the little robot square to drive around the map with the WASD/IJKL keys on the keyboard.
This sim is also designed to start up a GRPC server and communicate with a C# client in Godot or Unity, but that’s really early stages and takes a lot of work it turns out.
Anyway, if you mess around with it and have questions, let me know.
Oh yeah, one more thing, in our SimMain class that launches the sim in test mode, we subscribe to a bunch of simulator events to draw our turret and draw a little dot where the robot thinks it is, vs where the sim has positioned it. You could always subscribe to events and pop up a new window to draw an arm, or an elevator or whatever.
I know the op is looking for something else but is there a good example of what is possible using wpilib simulation out there somewhere? I’m interested in using it for my team but not quite sure where to start even after checking out the docs.
That’s because we haven’t finished the simulation support yet. The simulation docs are still a work in progress and are part of this PR:
The simulation GUI existed last year, but physics-based simulation will be new for 2021. It’ll make it easier to simulate sensors and actions caused by HID inputs in a realistic fashion.
Our team developed a robot simulator that reads directly from your robot code. Check out this video for more info: https://youtu.be/A66TlzYuKSo