Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Dembia chrisdembia

View GitHub Profile
@chrisdembia
chrisdembia / IntroOpenSimAPI.m
Last active Jul 17, 2020
Intro to OpenSim API in Matlab. To configure Matlab to access OpenSim, visit https://simtk-confluence.stanford.edu/display/OpenSim/Scripting+with+Matlab
View IntroOpenSimAPI.m
import org.opensim.modeling.*;
% Build a model.
model = Model();
body = Body('body', 1.0, Vec3(0), Inertia(0));
body.attachGeometry(Sphere(0.1));
model.addBody(body);
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
chrisdembia / component_forward_declare_connector.cpp
Created Apr 22, 2016
component_forward_declare_connector.cpp
View component_forward_declare_connector.cpp
#include <iostream>
using namespace std;
class AbstractConnector {
public:
virtual std::string getTypeName() const = 0;
};
template <typename T>
class Connector : public AbstractConnector {
View mem_fn_sandbox.cpp
#include <functional>
#include <iostream>
class State {
public:
int i = 5;
};
class Foo {
public:
View deserialize-state-save-calculation.py
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(), [
model.getMassCenter(state),
model.getMassCenterVelocity(state),
@chrisdembia
chrisdembia / gist:84c032747e1bcac82c53
Created Jun 17, 2015
opensim33-x64-gait2392-scaling-exception-windows-10-64bit
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();
output[i].setName(input[i].getName());
}
}
@chrisdembia
chrisdembia / c3d
Last active Aug 29, 2015
opensim-4.0-targets
View c3d
int main() {
InverseKinematics("c3d");
}
@chrisdembia
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 {
public:
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)
project(cloneptr)
# List your source and header files here.
set(my_source_files cloneptr.cpp)
You can’t perform that action at this time.