OSE Simulator
Background
A simulator was written for FIRST Robotics Competition robots allowing teams to understand the performance characteristics of their robots before building them. The simulator models the robots using a collection of physical parameters stored in a .yaml file and allows users to control the robots using the same game controller used in the competition.
Several of the Open Source Ecology projects involving moving vehicles and/or parts may benefit from modeling in such a simulator. Possible applications may include affordable automation or remote control modules for skid-steers or tractors for example.
It is thus possible to imagine the expansion of this simulator to incorporate other machines. In the context of Open Source ecology, this especially applies to GVCS machines.
Source Code
Here is the link to the GitLab Repository hosting the code for this project: https://gitlab.com/wjaneal/frc-simulator
Simulator Toolchain
- Robot is designed in a CAD Package such as FreeCAD or OnShape
- Export the model of the robot in a .obj format
- Import the model to Blender
- Pare down the file size by removing highly detailed parts such as nuts and bolts. The intent is to maintain the physical appearance of the robot with the smallest file size possible - this allows the simulator to work without appreciable lag even on less capable computers.
- Export the Blender file to a .glb format - this may require installing an add-on in the Blender environment
- Import the .glb file into the simulator which is written in Python / Panda3D
Software Design
The software is divided into several modules:
- The GUI code - FRCSIMMainMenu.py. This imports the controls class
- The Controls class - tying in user input through the keyboard and game controller with the simulated movement of the robot - FRCControls.py. This imports the base class.
- The FRC base class - this stages all of the Panda3D graphics assets for deployment in the application. This imports the physics class
- The FRC physics class - a collection of mathematics and physics-related functions to calculate the behaviour of the robot during the simulation. This class imports YAML files corresponding to the specific robot that is being modeled by the simulator at a particular time.
- YAML files - these are used to specify the physical attributes of each robot.