Inspiration
One of us had watched a video about evolving drag racing jets in a video game (Trailmakers), and was inspired to put that idea in real life! They talked to the rest of the team about it, and with a couple modifications to the plan, everyone was on board!
What it does
It has two main functionalities: First, it has a UI to make basic launch conditions (wing width, launch angle, launch velocity, center of mass offset) for a paper airplane and animate its flight. Second, you can import more complex airplanes with an arbitrary amount of parts, along with a center of mass offset that increases the weight of the plane dynamically based on the furthest point that a line running through the center of mass and the offsetted center of mass hits, accounting for leverage (think of putting a paper clip in the front of a paper airplane). Third, it has an evolution program that makes small changes to a starting paper airplane design thousands of times in order to improve it as much as possible (make the perfect plane!)
How we built it
We split into different files to work on parts of the simulator, with one of us working on the physics equations and RK4 vectors, one of us working on the calculations for weight, mass offset, and angle, one of us working on the UI, and one of us working on the evolution algorithm and scipy optimization. Then, we combined the files together to get a clean UI, which then analyzes the values, plugging it into the RK4 algorithm, and finally finding the optimal launch conditions for the best paper airplane!
Challenges we ran into
- One of our partners left at 8:00 PM and didn't send us the code, but since we continued coding until 3:00 AM, we needed to redo much of their code so that other parts would work.
- There was a miscommunication between our coder working on calculations and our coder working on the physics, in which the physics engine could not handle different centers of mass, or the rotation of the plane relative to its movement direction.
Our frontend coder had lots of trouble putting a matplotlib graph into a gradient frame, which led to him learning a new module (matplotlib.backends.backend_tkagg) and figuring out how to apply an animation to the canvas itself.
Our coder working on the calculations of weight had to figure out a way to find if a point lies on a triangle in 3d space. After a couple hours of working on one solution using Scipy and Delaunay, he discovered his solution only worked for tetrahedons, not triangles! This led him to learning new formulas dealing with Barycentric coordinates.
Accomplishments that we're proud of
We managed to triumph past all of our issues to essentially make our own physics engine from scratch, without the use of AI at all! (except for debugging one problem at the end, but ignore that). Meanwhile, we also managed to go to multiple fun events, such as the data analytics class and the estimathon.
What we learned
We learned about aerodynamic equations, Runge Kutta(4), the principles of leverage, utilizing masspoints in 3d space, the CTK module to make UI, animation in python, Scipy to minimize a gradient and how to create a matplotlib graph. We learned all of this from not knowing how lift and drag work, how to calculate centers of mass, making any visuals in python without pygame, and even how to import libraries such as Scipy!!!
What's next for Paper Airplane Simulator
If we had more time, we would add wind, a simpler UI to import complex files, and a better evolution algorithm for finding the perfect plane that uses a gradient instead of natural selection. We also want to implement a formula to calculate how well balanced it is, so we can find a paper airplane that still flies far even if you throw it badly. With all of this, we could make an even better plane and account for real life conditions!!!
Built With
- ctk
- github
- matplotlib
- numpy
- pathlib
- python
- scipy
- tkinter
- visual-studio
Log in or sign up for Devpost to join the conversation.