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.
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.