Simulating a virtual Roborio

Hey, Its my first time on the forum…

I was wondering if anyone found a way to make a virtual connected roborio driver that has a UI that allows to change inputs and see outputs to it…
This also means that it accepts everything that a normal roborio would such as installing java on it etc… (You may understand by now where im going…)
I want to test Java coded programs onto a roborio simulator and activate it with the dashboard to debug it…

I’ve been looking for it for a while now and thought I might as well come to the forums and ask…
I have looked into toast and frcsim… Did not find anything that would work the way I had wished for…

Thanks for anyone helping!

This currently exists if you’re using Python. :slight_smile:

http://robotpy.readthedocs.io/en/stable/guide/simulator.html

Note that it’s not a VM, but it allows you to run your robot code locally on your computer and show you the outputs and allows you to manipulate inputs.

There will most likely be a similar thing developed for Java/C++ in the 2018 season. Watch WPILib’s github for details, or if you want to contribute.

1 Like

I think this might be what you are looking for. The only problem is I think you have to be using the Toast API for it to work.

Or this library might be helpful. It lets you run JUnit tests to test your robot code in Java. My team never used it much, as you have to write the tests yourself.

First off, Thanks for the fast replies…

@firecrafty
I looked at toast before as I said and I didnt want to use it because it would change my code…

As firecrafty said for toast, Will I need to use strongback code for it to work?
Or can I still just use wpilib’s code that is already made on my computer…

That’s why I came to the forum… I want something that uses purely wpilib’s code to simulate…

And that’s why a virtual roborio would be so good as I could use the FRC Java Installer to install java on the vm roborio and use my building tools from pure wpilib to deploy the code on it… And then obviously I could use Driver Station with it and every program that requires a physical roborio to be connected…

If I knew how to do it, It seems like a nice project to tackle…

You may be able to use roborio-vm. It’s been a while, but IIRC I had a hard time getting the Python deploy (over SSH) to connect, because it looks for a specific port (22) which is not the one that qemu uses. Plus I don’t know if you could access the web interface.

Admittedly I didn’t invest a lot of time into it. It seems like it should be possible, especially on Linux.

Yeah, but you really don’t actually want a virtual roborio (and it isn’t going to happen). You just want to run your robot code and test it locally without having to modify it. That will most likely be possible in 2018.

The roborio-vm that nickbrickmaster mentions doesn’t have an FPGA interface, so you can’t actually run wpilib code on it. It’s only really useful for running generic programs compiled for ARM that don’t depend on any specific hardware being present.

So from what I’m getting… A pure wpilib simulation will only be available hopefully around 2018?
That’s sad…

Thanks for everyone that helped…
I guess I’ll just test my code only the one day of the week when I’m going to the facility that has our robot…

If you care that much about it you can switch to Python. Or Toast. Or Strongback. Or watch the wpilib repos over the summer as they get the new simulation pieces.

Just an FYI, I think Toast has been discontinued, as of the 2017 season. From the top of the github

where’S THE 2017 UPDATE? The ToastAPI, while stable for 2017, will not be officially released. There have been a lot of changes in the past year to the way WPILib is maintained, all of which are for the better. With the recent focus on the GradleRIO build system to be more expansible for multi-project configurations and libraries, a module-loading system similar to Toast’s is not required.

With device libraries being forked over to the manufacturer, simulation will become harder and harder to maintain. For this reason, I encourage teams to drop the simulation model and work more towards unit tests. Unit tests can be done with GradleRIO. When some time is available, I will be writing a post on how to achieve unit tests efficiently and effectively.

Finally, a project as big as this requires a lot of time to maintain, time which I don’t currently have. I am working on much larger projects, and unfortunately I don’t have time for this one. Other projects, such as GradleRIO, however, will be still be maintained.

I’d like to remind you that this is an open source project. If you want to continue using Toast, or turn it into something of your own, I encourage you to fork and modify the repo to your needs.

Be well, ~Jaci

Toast is compatible with 2017 WPILib, with both Toast and non-Toast projects being supported in simulation. The build system support, however, has been discontinued for Toast.

Hope?
Can you please explain what you mean in non-Toast projects?
Is there a way to just launch the wpilib with the toast simulator?
If there is, Do you know how maybe?

We made a java simulator, available here https://github.com/ArcticWarriors/snobot-2017/tree/master/Simulator

We some have (outdated) instructions on how to use it and set it up https://github.com/ArcticWarriors/team-174-resources/wiki/UsingTheSimulator. Looking at our simulation setup is probably the best place to start.

Basically, it mocks out everything WPILibJ does, no code changes required. If you set up the Eclipse project right, you immediately start playing with joysticks and see your motors/solenoids/etc move around. With a small bit of setup you can hook speed controllers to feedback sensors and gearboxes to get a more accurate simulation.

Yes. Running the Toast Jar with the --sim flag will start the simulator and will detect stock WPILibJ jars.


java -jar Toast.jar --sim --search

Where your robot code program is in the toast/modules folder

Hey, Thanks for helping!

I’m looking around and not finding anything about the Toast.jar
Where can I access it, And How would I include the RobotCode that I got into the simulator as a “module”(which I also do not understand fully)

I’m sorry that I’m bugging so much, But I couldnt understand what you said…

You will have to build Toast.jar yourself from source. There are instructions in the repository readme. Copying your jar to the folder toast/modules (relative to your project root) will be enough to make toast discover your wpilib robot code

By “your jar”, Do you mean THE Toast.jar? or my wpilib project that has the robotcode?
If it is the robotcode one, how would I achieve a jar from it… I’m using GradleRIO to build and deploy btw…

When I say “your jar”, I mean your jar. As in your wpilib project jar.
If you’re building your code with GradleRIO, you can locate your .jar file somewhere under build/

Thank you, Ill test it when I get to my working computer today…
I need to go to school now…

Thank you so much for your time…
I feel bad for bugging so much as it seems that someone with the knowledge would probably know what you mean straight away…

I cant seem to find what you mean by toast/modules…
Is it a folder that exists somewhere or something?

I’ve downloaded and built Toast-2.4.14.jar and I tried running it with a few things(in console)…
I always get to the part where Toast says: “Nuking Toast” in the console and
its stuck there for 2 minutes til it stops trying…

I’m a bit new to the whole module thing so I dont know how it works or where to put what so sorry if it annoys that I dont understand some simpler things…