Skip to content

Instantly share code, notes, and snippets.


Christopher Dembia chrisdembia

  • Stanford University
  • Stanford, CA
View GitHub Profile
chrisdembia / IntroOpenSimAPI.m
Last active Jul 17, 2020
Intro to OpenSim API in Matlab. To configure Matlab to access OpenSim, visit
View IntroOpenSimAPI.m
import org.opensim.modeling.*;
% Build a model.
model = Model();
body = Body('body', 1.0, Vec3(0), Inertia(0));
joint = SliderJoint('joint', model.getGround(), body);
coord = joint.updCoordinate();
View opensim-knee-reflex.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
chrisdembia / component_forward_declare_connector.cpp
Created Apr 22, 2016
View component_forward_declare_connector.cpp
#include <iostream>
using namespace std;
class AbstractConnector {
virtual std::string getTypeName() const = 0;
template <typename T>
class Connector : public AbstractConnector {
View mem_fn_sandbox.cpp
#include <functional>
#include <iostream>
class State {
int i = 5;
class Foo {
from opensim import *
model = Model('mymodel.osim')
states = StateTrajectory('mystates.osimstates')
comtraj = TimeSeriesTableVec3(states.size(), 2)
comtraj.setColumnLabels(['com_position', 'com_velocity'])
for state in states:
comtraj.appendRow(state.getTime(), [
chrisdembia / gist:84c032747e1bcac82c53
Created Jun 17, 2015
View gist:84c032747e1bcac82c53
>Log Session: Tuesday, June 16, 2015 8:50:42 PM PDT
>System Info:
Product Version = OpenSim 3.3
Operating System = Windows 8.1 version 6.3 running on amd64
Java; VM; Vendor = 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11; Oracle Corporation
Runtime = Java(TM) SE Runtime Environment 1.7.0_80-b15
Java Home = C:\OpenSim 3.3\jdk\jre
System Locale; Encoding = en_US (opensim); Cp1252
Home Directory = C:\Users\chris
View make-set.cpp
template<IN, OUT, OUTSET> static OUT generateSet(const IN& input) {
OUTSET output(input.getSize());
for (int i = 0; i < input.getSize(); ++i) {
output[i] = OUT();
chrisdembia / c3d
Last active Aug 29, 2015
View c3d
int main() {
chrisdembia / main.cpp
Created Oct 10, 2014
Ajay: templatized in-class member initializers
View main.cpp
#include <iostream>
#include <vector>
template <int M>
class myvec {
std::vector<double> v;
myvec(double iv) : v(M, iv) {}
View CMakeLists.txt
# Generic CMakeLists.txt for making a Simbody-using executable.
# This shows how to use the provided SimbodyConfig.cmake to locate a Simbody
# installation on your machine so you can use it from your own code.
# You will most likely want to copy some of these lines into your own
# CMakeLists.txt rather than use this one verbatim.
cmake_minimum_required(VERSION 2.8)
# List your source and header files here.
set(my_source_files cloneptr.cpp)