Animating Linkages with Python
....and Matplotlib's Animation Function
Sam Korman from Team TrotBot put his Python skills to work to improve our simulators, and shares his code below. For those who are not that experienced with Python, Sam included many useful comments in his code.
First, here's Sam's simplest script that animates TrotBot in place.
Here's a more complicated version with TrotBot moving:
Here's the python code for simulating TrotBot, Klann, Strandbeest,and Strider that generated the video above (updated on 1-17-2019). Note: this code was copy/pasted from 4 separate sims, so it's a bit sloppy and is not as streamlined as Sam's code, FYI
In the below video of the LEGO approximation, Klann was animated in place by setting the "moving" variable to "False" (or you can simply set its average speed to zero). Also, you can find the joint and bar maps used in this Klann simulator here, which the python script now matches.
The algorithms, and how we used them to simulate linkages, are described here.