summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tobias.klauser@uzh.ch>2013-01-28 09:31:19 +0100
committerTobias Klauser <tobias.klauser@uzh.ch>2013-01-28 09:31:19 +0100
commite5e089fe6c136d3962a066f9a8c7b56009459b16 (patch)
treed25e0cb9eb82ca7d8c8b69f1bb40dcfe34cd294e
parent438ceb3970802f2a86181e4beb796d4a9d14f1d0 (diff)
LocomotorPrimitivesController: set actuation to 0 for muscles without data
-rw-r--r--LocomotorPrimitivesController.cpp11
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++;