This code creates two cat models that can achieve a flipping maneuver. The first is simply two segments connected by a 2-degree-of-freedom (no twist) joint. It exhibits the counter-rotation mechanism of flipping. The second builds on top of the first with actuate-able legs, and a twist degree of freedom between the model's two halves. This model exhibits both the counter-rotation and variable- inertia mechanisms of flipping.
#include <OpenSim/OpenSim.h> int main(int argc, char *argv[]) { // First model: exhibiting the counter-rotation mechanism of flipping // ======================================================================== // Mass and geometry properties // ------------------------------------------------------------------------ // Define anterior and posterior halves of the cat // ------------------------------------------------------------------------ // ********** PART A.1 ********** // Define joints between bodies (ground and two halves) // ------------------------------------------------------------------------ // ********** PART A.2 ********** // Add bodies to the model // ------------------------------------------------------------------------ // ********** PART A.3 ********** // Display geometry // ------------------------------------------------------------------------ // ********** PART A.4 ********** // Actuation // ------------------------------------------------------------------------ // ********** PART A.5 ********** // Print the model // ------------------------------------------------------------------------ cat.print("flippinfelines_hunch_wag.osim"); // Second model: adding legs for the variable-inertia mechanism of flipping // ======================================================================== // ********** PART B ********** return EXIT_SUCCESS; };
// First model: exhibiting the counter-rotation mechanism of flipping // ======================================================================== // ********** PART A ********** // Second model: adding legs for the variable-inertia mechanism of flipping // ======================================================================== // Leg properties // ------------------------------------------------------------------------ // Define leg bodies // ------------------------------------------------------------------------ // Define leg joints (i.e., between legs and two halves of cat) // ------------------------------------------------------------------------ // Add bodies to the model // ------------------------------------------------------------------------ // ...now that we have connected the bodies via joints. // Display geometry // ------------------------------------------------------------------------ // Actuation // ------------------------------------------------------------------------ // Enforce joint limits on the legs // ------------------------------------------------------------------------ // Print the model // ------------------------------------------------------------------------