diff options
-rw-r--r-- | LocomotorPrimitivesController.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/LocomotorPrimitivesController.cpp b/LocomotorPrimitivesController.cpp index 2708162..27ac205 100644 --- a/LocomotorPrimitivesController.cpp +++ b/LocomotorPrimitivesController.cpp @@ -47,6 +47,7 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK for (int i = 0; i < act_set_siz; i++) { const OpenSim::Muscle *muscle = dynamic_cast<const OpenSim::Muscle *>(&getActuatorSet().get(i)); const OpenSim::Array<int> indices = _act.getColumnIndicesForIdentifier(muscle->getName()); + double mact; if (indices.getSize() != 0) { int idx = indices.get(0) - 1; @@ -58,12 +59,14 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK _muscle_act[idx] = 1.0; } - SimTK::Vector ctrl(1, _muscle_act[idx]); - muscle->addInControls(ctrl, controls); + mact = _muscle_act[idx]; } else { - // std::cerr << "Error: no actuation data for muscle '" << muscle->getName() << "' at time " << t << " found" << std::endl; - continue; + // no actuation data for muscle at that time, so set it to 0.0 + mact = 0.0; } + + SimTK::Vector ctrl(1, mact); + muscle->addInControls(ctrl, controls); } n++; |