Skip to content

Commit

Permalink
Fix indexing typo and add more debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbianco committed Oct 2, 2024
1 parent bc3545f commit 1e13a8b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion OpenSim/Analyses/Test/testOutputReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,24 @@ void simulateMuscle(
//==========================================================================
// 5. Verify files were written with correct values
//==========================================================================
log_info("Loading the results from file");
TimeSeriesTable tableD("testOutputReporter_Outputs.sto");
TimeSeriesTable_<SimTK::Vec3> tableV3("testOutputReporter_OutputsVec3.sto");
TimeSeriesTable_<SimTK::SpatialVec> tableSV("testOutputReporter_OutputsSpatialVec.sto");

log_info("Indexing initial values");
double val_t0 = tableD.getIndependentColumn()[0];
const SimTK::Real& val_ke0 = tableD.getRowAtIndex(0)[0];
const Vec3& val_omega0 = tableV3.getRowAtIndex(01)[1];
const Vec3& val_omega0 = tableV3.getRowAtIndex(0)[1];
const SimTK::SpatialVec& val_jrf0 = tableSV.getRowAtIndex(0)[1];

log_info("Checking initial values");
ASSERT_EQUAL(t0, val_t0, SimTK::Eps);
ASSERT_EQUAL(ke0, val_ke0, SimTK::Eps);
ASSERT_EQUAL(ang_acc0, val_omega0, SimTK::Eps);
ASSERT_EQUAL(reaction0, val_jrf0, SimTK::Eps);

log_info("Indexing final values");
double val_tf = tableD.getIndependentColumn()[tableD.getNumRows() - 1];
const SimTK::Real& val_ke = tableD.getRowAtIndex(tableD.getNumRows() - 1)[0];
const Vec3& val_omega = tableV3.getRowAtIndex(tableV3.getNumRows() - 1)[1];
Expand All @@ -236,6 +240,7 @@ void simulateMuscle(
auto ang_acc = ball->getAngularAccelerationInGround(state);
auto reaction = slider->calcReactionOnChildExpressedInGround(state);

log_info("Checking final values");
ASSERT_EQUAL(state.getTime(), val_tf, SimTK::Eps);
ASSERT_EQUAL(ke, val_ke, SimTK::Eps);
ASSERT_EQUAL(ang_acc, val_omega, SimTK::Eps);
Expand Down

0 comments on commit 1e13a8b

Please sign in to comment.