In my senior year at Northwestern, I took ME 314-Theory Of Machines-Dynamics, where we learned about rigid body mechanics, rotating bodies, Lagrangian mechanics, and impact mechanics, all through simulations that we created. For the final project, our assignment was to simulate a real world impact between two objects. Inspired by my previous experience in combat robotics, I chose simulate a battlebot with a horizontally spinning weapon bar striking a heavy block inside an arena, which made things additionally complex because there were now 3 objects rather than 2. The project was quite successful, and it is still being shown as an example in this class 4 years later!

Simulation Videos

Here is an in-progress video of one of the first successful runs

And here is the final video:

The Solution

We wrote the simulations in Python in Google Colab. We started with some data structures written for us, but otherwise the project was our own work, using different elements that we had written in previous homework assignments. This included setting up the proper impact and motion equations, simulating the motion and impact, and then animating the result. In total, my project has ~1000 lines of code, including comments, making it one of the largest software projects that I have worked on. If you would like to see the code or run it yourself on Colab, I have attached a Colab file and a PDF for you to download below. Everything more or less worked as of mid 2024, but I can’t make any promises that everything will still work in the future.

Code Download

GOOGLE DRIVE LINK TO FILE

https://drive.google.com/file/d/1dtnqLrnUAWOZQhrNrUsT2RERRbd7Sen-/view?usp=sharing

By Cam M