Skip to content

Commit

Permalink
Fixing DynamicsFitter joint double-initialization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
keenon committed Sep 23, 2024
1 parent b4b0ab2 commit 9f67b47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dart/biomechanics/DynamicsFitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9637,6 +9637,10 @@ std::shared_ptr<DynamicsInitialization> DynamicsFitter::createInitialization(

// Copy over the joint data
init->joints.clear();
init->jointWeights.clear();
init->axisWeights.clear();
init->jointCenters.clear();
init->jointAxis.clear();
for (int trial = 0; trial < kinematicInit.size(); trial++)
{
init->joints.emplace_back();
Expand All @@ -9654,6 +9658,9 @@ std::shared_ptr<DynamicsInitialization> DynamicsFitter::createInitialization(

for (int trial = 0; trial < init->poseTrials.size(); trial++)
{
assert(
kinematicInit.at(trial).jointCenters.rows() / 3
== init->joints.at(trial).size());
init->jointCenters.push_back(kinematicInit.at(trial).jointCenters);
init->jointAxis.push_back(kinematicInit.at(trial).jointAxis);
}
Expand Down Expand Up @@ -18399,6 +18406,8 @@ void DynamicsFitter::saveDynamicsToGUI(

// Render the joints, if we have them
int numJoints = init->jointCenters.at(trialIndex).rows() / 3;
assert(numJoints == init->jointWeights.at(trialIndex).size());
assert(numJoints == init->joints.at(trialIndex).size());
server.createLayer(
functionalJointCenterLayerName, functionalJointCenterLayerColor, true);
for (int i = 0; i < numJoints; i++)
Expand Down

0 comments on commit 9f67b47

Please sign in to comment.