Skip to content

Commit

Permalink
Fixing bugs on high BMI subject
Browse files Browse the repository at this point in the history
  • Loading branch information
keenon committed Jun 29, 2022
1 parent 65cf969 commit b5bdece
Show file tree
Hide file tree
Showing 11 changed files with 44,332 additions and 300 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.4
0.8.5
36 changes: 30 additions & 6 deletions dart/biomechanics/OpenSimParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,20 @@ void recursiveCreateJoint(
Eigen::Vector3s massCenter
= readVec3(bodyNode->FirstChildElement("mass_center"));
Eigen::Vector6s inertia = readVec6(bodyNode->FirstChildElement("inertia"));
if (mass <= 0)
{
std::cout << "WARNING! We're refusing to set a 0 mass for "
<< childBody->getName()
<< ", because NimblePhysics does not support 0 masses. "
"Defaulting to 0.0001."
<< std::endl;
mass = 0.0001;
}
if (inertia.segment<3>(0).norm() == 0)
{
inertia.segment<3>(0).setConstant(0.0001);
}

dynamics::Inertia inertiaObj(
mass,
massCenter(0),
Expand Down Expand Up @@ -3545,12 +3559,6 @@ OpenSimFile OpenSimParser::readOsim30(
std::string type(jointCursor->Name());
std::string name(jointCursor->Attribute("name"));

if (name == "patellofemoral_r" || name == "patellofemoral_l")
{
jointCursor = jointCursor->NextSiblingElement();
continue;
}

string parent_offset_frame = string(
jointCursor->FirstChildElement("socket_parent_frame")->GetText());
string child_offset_frame = string(
Expand Down Expand Up @@ -3591,6 +3599,14 @@ OpenSimFile OpenSimParser::readOsim30(
framesCursor = framesCursor->NextSiblingElement();
}

if (name == "patellofemoral_r" || name == "patellofemoral_l"
|| childName == "/bodyset/patella_r"
|| childName == "/bodyset/patella_l")
{
jointCursor = jointCursor->NextSiblingElement();
continue;
}

OpenSimJointXML& joint = jointLookupMap[name];
joint.name = name;
joint.type = type;
Expand All @@ -3609,6 +3625,14 @@ OpenSimFile OpenSimParser::readOsim30(
joint.parent = nullptr;
}

if (bodyLookupMap.find(childName) == bodyLookupMap.end())
{
std::cout << "ERROR loading *.osim file: Joint " << name
<< " has child body \"" << childName
<< "\", yet the child was not found in the <BodySet>"
<< std::endl;
exit(1);
}
assert(bodyLookupMap.find(childName) != bodyLookupMap.end());
assert(bodyLookupMap[childName].parent == nullptr);
joint.child = &bodyLookupMap[childName];
Expand Down
5 changes: 3 additions & 2 deletions dart/dynamics/CustomJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ void CustomJoint<Dimension>::zeroTranslationInCustomFunctions()
mFunctions[i]->offsetBy(-defaultValues(i - 3)),
mFunctionDrivenByDof[i]);
assert(
mFunctions[i]->calcValue(this->getPosition(mFunctionDrivenByDof[i]))
== 0);
abs(mFunctions[i]->calcValue(this->getPosition(mFunctionDrivenByDof[i]))
- 0)
< 1e-8);
}
Eigen::VectorXs pos = this->getPositionsStatic();
Eigen::Vector3s euler = getEulerPositions(pos);
Expand Down
9 changes: 6 additions & 3 deletions dart/dynamics/Skeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2781,9 +2781,12 @@ Eigen::VectorXs Skeleton::getRandomPoseForJoints(

for (auto joint : joints)
{
pose.segment(joint->getDof(0)->getIndexInSkeleton(), joint->getNumDofs())
= randomPose.segment(
joint->getDof(0)->getIndexInSkeleton(), joint->getNumDofs());
if (joint->getNumDofs() > 0)
{
pose.segment(joint->getDof(0)->getIndexInSkeleton(), joint->getNumDofs())
= randomPose.segment(
joint->getDof(0)->getIndexInSkeleton(), joint->getNumDofs());
}
}

return pose;
Expand Down
5 changes: 5 additions & 0 deletions data/osim/HighBMI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Geometry/
eval_5deg1.trc
eval_10deg1.trc
eval_neg5deg1.trc
eval_neg10deg1.trc
14,229 changes: 14,229 additions & 0 deletions data/osim/HighBMI/Lernagopal_more_viz.osim

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions data/osim/HighBMI/_subject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"sex":"female","massKg":"90.3","heightM":"1.65","email":"stingjp@stanford.edu"}
13,794 changes: 13,794 additions & 0 deletions data/osim/HighBMI/baseline_TM1.trc

Large diffs are not rendered by default.

466 changes: 466 additions & 0 deletions data/osim/HighBMI/static1_VM.trc

Large diffs are not rendered by default.

15,583 changes: 15,583 additions & 0 deletions data/osim/HighBMI/unscaled_generic.osim

Large diffs are not rendered by default.

Loading

0 comments on commit b5bdece

Please sign in to comment.