summaryrefslogtreecommitdiff
path: root/LocomotorPrimitivesController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LocomotorPrimitivesController.cpp')
-rw-r--r--LocomotorPrimitivesController.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/LocomotorPrimitivesController.cpp b/LocomotorPrimitivesController.cpp
index 84b6187..e4308bc 100644
--- a/LocomotorPrimitivesController.cpp
+++ b/LocomotorPrimitivesController.cpp
@@ -46,7 +46,7 @@ int LocomotorPrimitivesController::loadCsvData(const std::string &muscleName, co
data.close();
- _act.push_back(p);
+ //_act.push_back(p);
std::cout << ">>> loaded EMG profile for " << p.getName() << ", " << p.getIdx() << "/" << p.getCapacity() << std::endl;
return 0;
@@ -58,12 +58,22 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK
static double last_twitch = t;
/* Extract muscle activation for each of the muscles */
- for (std::vector<MuscleEMGProfile>::const_iterator it = _act.begin(); it != _act.end(); ++it) {
- MuscleEMGProfile p = *it;
+ int act_set_siz = getActuatorSet().getSize();
+ for (int i = 0; i < act_set_siz; i++) {
+ const OpenSim::Muscle *m = dynamic_cast<const OpenSim::Muscle *>(&getActuatorSet().get(i));
+ const OpenSim::Array<int> indices = _act.getColumnIndicesForIdentifier(m->getName());
+
+ if (indices.getSize() != 0) {
+ double muscle_act = 0.0;
+
+ _act.getDataAtTime(t, indices.get(0), &muscle_act);
+ std::cout << indices.get(0) << " actuation data for '" << m->getName() << "' found: " << muscle_act << std::endl;
+ }
//std::cout << " " << p.getName() << "(" << p.getIdx() << "/" << p.getCapacity() << ")" << std::endl;
}
+#if 0
//const OpenSim::Muscle *rectfem = dynamic_cast<const OpenSim::Muscle *>(&getActuatorSet().get("bifemlh_r"));
const OpenSim::Muscle *rectfem = dynamic_cast<const OpenSim::Muscle *>(&getActuatorSet().get("rect_fem_r"));
const OpenSim::Muscle *ercspn_r = dynamic_cast<const OpenSim::Muscle *>(&getActuatorSet().get("ercspn_r"));
@@ -98,4 +108,5 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK
ercspn_l->addInControls(ctrl_ercsp, controls);
extobl_r->addInControls(ctrl_extobl, controls);
extobl_l->addInControls(ctrl_extobl, controls);
+#endif
} \ No newline at end of file