Any ideas on simulating robot to prototype code

Hi
I’m teaching students to program our robot cRIO in Java. The robot isn’t always available to write and test code so I’d like to have a simulator for the students. So far we are thinking of building a test bed with all the hardware but that could get expensive.

I searched for simulating a robot in the forums and found that the 'FRC Robot Modeling and Simulation Toolkit ’ has been discontinued. I thought that was a great way to allow the programmers to develope and test code without requiring the hardware in case the robot is not ready or currently in use.

I’m sure there are a few ways to do this. I thought if the WPI java libs could disable the hardware that might allow me to purchase just a cRIO. Of course a client application that would accept commands from our java robot would be even better.

Does anything like this exist? Any ideas would be appreciated.
Thanks

I don’t know how well Java would adapt to this, but I have written simulators in LabVIEW capable of testing the higher-level code for a robot arm. I could set positions of a state machine from the virtually-running code, then have the drawing loop draw each segment of the arm to an XY graph.

In 2007, we had code on the robot that needed an array of sensor positions for a state machine. We had a simulator in VBA (Excel) to allow us to set the end height of the arm, then slide it in and out and get the sensor values.

In LabVIEW, you could write an abstraction layer to have all calls to the WPIlib handled in common places and save/write them to global variable files, then you could run the VI’s that actually do the work run by themself and test the IO by manipulating the global variables on the Front Panel. In Java, it would be trickier. This really depends on what you want to simulate; if you want to test your PID code then you really really need the real robot. If you want to simulate some code that handles semi-automatic robot arms, then you could simulate it in LabVIEW and then swap out the drawing code with PID code.

You cant disable the hardware, but you can just not listen to the hardware. If you have just a cRio, you can just not connect the IO and write it as if it was the real hardware. Then your code could do stuff and output it to the Dashboard, and collect data from the Joysticks, but not act on it. If you are not using the kit chassis, you could assemble the kit chassis with transmissions and only need to buy a new cRio, Jaguars, and motors, leaving you with a simple skid-steer drivetrain to test things that don’t depend on shifting or specific traction, like testing some parts of the camera code or such. Depending on how old your team is, you could use a past robot and put a cRio in it, to test code not dependent on the physical robot (camera code is the best example). You need to remember that even a duplicate robot will not be exactly like the competition robot, so make sure it is easy to change parameters like PID gains for when you have the real robot. You might even consider having a “New Robot” variable that switches from one set of gains to another, those from the practice robot and those from the competition robot.

If you want to just test out logic, you can write a quick GUI program (java applet or swing) with text boxes to enter data or some other value. For example, if you are writing a joystick scaler program, you would have a textbox to enter the simulated joystick value, then another box or label would show the output of your logic (the scaled joystick).

This is similar to writing LabView code and simulating it on the Front Panel.

Does the simulator have to use Java? If not, if you are testing out concepts, the insplore.com simulator might work for you.

We have built a testbed with another crio that will allow the programmers to develop and debug their code. I hope to have an led strip to verify the outputs go on as expected and a set of switches to verify they advance to the correct state.

Now I just have to figure out how to connect the hardware. I’m searching for that now, I hope I won’t have to come back and ask you guys.

Thanks apalrd and the others.