Get customjoint in Python to work (solved)
Posted: Tue Oct 26, 2021 7:16 am
I really am struggling to get a customjoint in Python.
Concretely, how do I translate this fragment from an example from testJoints.cpp into python?
In python hipTransform is not subscriptable.
UPDATE: Finally cracked it.
Note the different set_function().
Thanks in advance, Sietse
Concretely, how do I translate this fragment from an example from testJoints.cpp into python?
Code: Select all
SpatialTransform hipTransform;
hipTransform[0].setCoordinateNames(
OpenSim::Array<std::string>("hip_q0", 1, 1));
hipTransform[0].setFunction(new LinearFunction());
......
CustomJoint hip("hip", ground, hipInPelvis, Vec3(0), osim_thigh, hipInFemur,
Vec3(0), hipTransform);
UPDATE: Finally cracked it.
Code: Select all
spatialTransform = osim.SpatialTransform()
pupdown= osim.ArrayStr()
pupdown.append("p_updown")
spatialTransform.updTransformAxis(0).setCoordinateNames(pupdown)
spatialTransform.updTransformAxis(0).set_function(osim.LinearFunction())
Thanks in advance, Sietse