OpenSim comes with a variety of C++ API examples, located in <OpenSimResourcesDir>/Code/CPP (where, by default, <OpenSimResourcesDir> is C:\Users\<username>\Documents\OpenSim\4.x on Windows and ~/Documents/OpenSim/4.x on Mac). In the list below, we provide the subdirectory in the Code/CPP folder where you can find each example.
- Performing a Simulation (ExampleMain) Write a main C++ program (a "tug of war") to create a model and run a forward simulation.
- Creating Your Own Analysis (Plugins/AnalysisPluginExample) Write your own Analysis to output the center of mass and orientation of each body in a model.
- Creating a Controller (ControllerExample) Extend the tug of war example with a custom controller.
- Creating an Optimization (OptimizationExample_Arm26) Write an optimization to find muscle controls to maximize the forward velocity of the hand.
- Creating a Customized Actuator (CustomActuatorExample) Implement a spring with controllable stiffness.
- Creating a Customized Muscle Model (MuscleExample) Implement a muscle model with fatigue.
To get started with any of these examples, refer to How to Build a C++ Example.
Next: SimTK Basics
Previous: How to Build a C++ Example