I am trying to change the wrapping surface of the hopper example to an ellipsoid and sphere. This would mean that, especially on the sphere, the vastus is 'balancing' on the patella. However, for an ellipsoid of significant width (read ridiculously large) this should not be a problem. For both the ellipsoid with extreme width and the sphere however, the vastus remains on the patella for about 0.2 seconds of the simulation and afterwards seems to shoot through the wrapping surface. Could anyone point me in the right direction regarding this?
Here is the code (changes to the file "buildHopperModel.cpp", patella_shape is passed to the buildHopper function as an additional argument):
Code: Select all
// Attach a patella to the distal end of the thigh over which the
// vastus muscle can wrap. linkDistalPoint only has a longitudal displacement w.r.t. the shank
auto patellaFrame = new PhysicalOffsetFrame("patellaFrame",*thigh, SimTK::Transform(linkDistalPoint));
// create an empty patella before the 'if' statement declarations
auto patella = new WrapEllipsoid();
if (patella_shape == "ellipsoid") {
delete patella;
auto patella = new WrapEllipsoid();
patella->setAllPropertiesUseDefault(true);
// a significant e2 size of the ellipsoid still leads to the vastus going through the wrapping surface
// although this is physically not possible
patella->set_dimensions(Vec3(0.08, 0.08, 1));
patella->set_quadrant("+x");
} else if (patella_shape == "sphere") {
delete patella;
auto patella = new WrapSphere();
patella->setAllPropertiesUseDefault(true);
patella->set_radius(0.08);
patella->set_quadrant("+x");
}
patella->setName("patella");
std::cout << "Patella is a " << patella->getWrapTypeName() << std::endl;
patellaFrame->addWrapObject(patella);
thigh->addComponent(patellaFrame);
// Configure the vastus muscle to wrap over the patella.
vastus->updGeometryPath().addPathWrap(*patella);
Would love to understand why this is not happening properly. Seems like it should be a simple and straightforward change to the code so I must be missing something obvious.
Cheers and thanks in advance