From e5e089fe6c136d3962a066f9a8c7b56009459b16 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 28 Jan 2013 09:31:19 +0100 Subject: LocomotorPrimitivesController: set actuation to 0 for muscles without data --- LocomotorPrimitivesController.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'LocomotorPrimitivesController.cpp') 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(&getActuatorSet().get(i)); const OpenSim::Array 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++; -- cgit v1.2.3-54-g00ecf