When I’m not doing silly things like constructing languages, writing science fiction, or biking through the Great Smokey Mountains, I have a research job in a Cornell spacecraft engineering lab to maintain. Mostly, that stuff doesn’t go on my blog because it ends up on our research group web site or in published journal articles and conference papers. But I’ve hit a milestone, and I think it’s pretty cool.
I hand-coded, from scratch, a multibody dynamics simulation package for Matlab.
This was for my research on treating reconfigurable spacecraft as kinematic mechanisms. We’re looking at how a modular spacecraft with joints (hinges, sliding surfaces, etc) between modules could twist itself around to rearrange itself. The idea is that changing the spacecraft’s shape could also change its functionality at a system level. Right now, proposals to do this involve having all the modules split off from one another, dodge around each other, and re-connect. Our thought is that the joints – the system’s kinematics, in engineering parlance – could dictate the motion in a desirable way. When modules come near one another, they can latch up and engage new joints, then twist around yet again. And again, and again, and again…until the whole system reaches the configuration we want.
In order to do numerical studies of the behavior of such a system, we needed a way to simulate multibody dynamics. We also needed the ability to explicitly control the kinematics of the system during simulation. And, since we don’t necessarily know conditions on the positions and orientations of all these modules (that’s what we’d like to discover!), we wanted tools based on a singularity-free representation such as quaternions. With few university licenses fitting that bill to play with, and surprisingly few relevant hits in the Matlab file exchange for multibody dynamics, I decided to write my own.
I call it QuIRK, which ostensibly stands for Quaternion-state Interface for Rigid-body Kinetics, but mostly I just like the name. (I was actually going for “clockwork,” but couldn’t get the “clo” to happen!)
This thing is pretty remarkably capable for a hand-coded multibody dynamics package. Once I had the toolbox functions, for instance, I produced this movie of a crazy lightly damped double-pendulum jouncing around with only twelve function calls. That’s twelve from Matlab startup to having the movie file as you see it.
Pretty neat, huh?
I wrote up extensive online documentation for my functions and put the whole thing available for download here: www.spacecraftresearch.com/flux/quirk. And, if you’re the sort of person who goes to the AIAA Guidance, Navigation, and Control Conference, I will presenting our research application of this dynamics simulator package there!
MATLAB does also sell similar packages for multibody dynamics and quaternion math.
I’m aware of the Aerospace toolbox and SimMechanics. I’ll note, though, that the purpose of QuIRK is not to do quaternion math, but to do multibody dynamics. In that regard, it offers some features that SimMechanics does not, such as an interface for defining (and modifying) mechanical systems in a programmatic way. That feature was a key component of my research.