Open GL Robot Simulator

I finally found and fixed the last major bug in my physics simulator, so here it is. I modeled static and kinetic friction, motor acceleration using the resistance and BEMF, and collisions between 6 wheel bots. It’s a lot of fun to drift on the turns. For now, I just modeled collisions as just stopping the robot from moving when you hit something. In order to make it a bit more fun, I added in toroids, and the goal is to drive around and run over toroids to pick them up. I implemented a simple AI that you can race if you want. I also have Xbox joystick support working.

I’ve got it hosted in a SVN repository. To check it out from the command line, type

svn co https://svn.losaltosrobotics.org/physicsgame/trunk/

The simulator currently only works on Linux. The Linux specific parts are potentially just the OpenGL calls, and the signal handling code. I’ve probably made some assumptions somewhere in my code that make it run better on my machine than other machines (frame rates), so if I have, let me know and I can work on fixing that.

The code currently isn’t all that clean. I would like to go back some time when I have free time (like that will ever happen) and make it so that it is easier to plug in different types of robots. Like set it up so that the structure that defines robots contains pointers to a physics function, a collision, and a joystick/keyboard function, and from there, you can define any type of robot. It would also be fun to implement WPILib like functions and classes for the bots, so that we can develop code for FRC.

If someone knows how to do a GTK and OpenGL application under Windows and would be willing to help me port that part of the application over to Windows, that would be awesome. I don’t know how to develop under Windows. The GTK part probably mostly works out of the box, and probably very little of the OpenGL will need to be changed, but I don’t even know where to start.

EDIT:
To drive the blue bot, use hjkl and ; for shifting. If the AI isn’t running on the Red bot, you can drive it by using the arrow keys and space for shifting.

If you have any questions or suggestions, feel free to ask.

I am checking it out now…

I am on OS X so it may or may not work. I will try!

In case anyone runs into this issue while trying to get things working, I use the gtkglext package to get an OpenGL capable widget for GTK.

I just got a version to compile and run on Windows! I’ll try to work out some timing related issues from my conversion from Unix Signals to less accurate GTK waits, figure out which DLLs it needs, and then push it to the server tonight.

I would love to download it, but after checking on a bunch of different computers. It seems that the site is down. just fyi.

Thanks for the heads up. Sorry about that. The guy who has the server in his garage lost power a couple of days ago and won’t be back until Sunday to reboot it. Oh well. Such is life.

On the plus side, I ported it to run under Windows now. I’ll update this thread when it gets back up and I can get my changes pushed back to the server. Since the compile process was a bit annoying and setting stuff up to get it compiled isn’t trivial, I’ll just check in the binaries that I created and the DLLs that are needed to support it (gtk and gtkglext)

If there are any moderators reading this, can you guys change the thread title to read “Linux and Windows Open GL Robot Simulator” since it is no longer Linux specific?

The server is back up, and I now have a version that runs under Windows. Or at least it runs under my machine and 1 other machine, so it should run on any windows box. I don’t know how to write code to get joysticks working under Windows, so it’s a keyboard only simulator there. Patches are always welcome :slight_smile:

The windows executable and supporting dll’s are checked into the repository in a folder called windows. Check it out according to the instructions above, and then you should be able to just run it. A good svn client for windows is available at tortoisesvn.tigris.org .