summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LocomotorPrimitivesController.cpp50
-rw-r--r--MuscleEMGProfile.cpp7
-rw-r--r--MuscleEMGProfile.h49
3 files changed, 1 insertions, 105 deletions
diff --git a/LocomotorPrimitivesController.cpp b/LocomotorPrimitivesController.cpp
index 0f57111..d22ee71 100644
--- a/LocomotorPrimitivesController.cpp
+++ b/LocomotorPrimitivesController.cpp
@@ -1,59 +1,11 @@
#include <OpenSim/OpenSim.h>
#include "LocomotorPrimitivesController.h"
-#include "MuscleEMGProfile.h"
#define VERBOSE 1
static const double TIME_DAMP = 0.1;
-#if 0
-int LocomotorPrimitivesController::loadCsvData(const std::string &muscleName, const std::string &file)
-{
- std::cout << ">> loading CSV data from " << file << std::endl;
- std::ifstream data(file);
- std::string line;
-
- std::cout << data.tellg() << std::endl;
-
- if (!data.is_open()) {
- std::cerr << "Error loading CSV data from " << file << std::endl;
- return -1;
- }
-
- MuscleEMGProfile p(muscleName, 0);
-
- while (std::getline(data, line)) {
- std::stringstream s(line);
- std::string cell;
-
- int i = 0;
- double x;
- while (std::getline(s, cell, ',')) {
- if (!isdigit(cell[0]))
- continue;
-
- std::cout << "read cell(" << (i == 0 ? "x" : "y") << ") -> " << cell << std::endl;
- double val = (double) atof(cell.c_str());
-
- if (i == 1)
- p.addData(x, val);
- else
- x = val;
-
- i = !i;
- }
- }
-
- data.close();
-
- //_act.push_back(p);
- std::cout << ">>> loaded EMG profile for " << p.getName() << ", " << p.getIdx() << "/" << p.getCapacity() << std::endl;
-
- return 0;
-}
-#endif
-
void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK::Vector &controls) const
{
double t = s.getTime();
@@ -96,7 +48,7 @@ void LocomotorPrimitivesController::computeControls(const SimTK::State &s, SimTK
if (act > 0.0)
last_twitch = t;
-
+
//if (VERBOSE && act > 0.0)
// std::cout << "(" << std::fixed << t << ") " << "v=" << std::fixed << v << ", act=" << std::fixed << act << std::endl;
diff --git a/MuscleEMGProfile.cpp b/MuscleEMGProfile.cpp
deleted file mode 100644
index b1b4977..0000000
--- a/MuscleEMGProfile.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "MuscleEMGProfile.h"
-
-void MuscleEMGProfile::addData(double x, double y)
-{
- _x.push_back(x);
- _y.push_back(y);
-} \ No newline at end of file
diff --git a/MuscleEMGProfile.h b/MuscleEMGProfile.h
deleted file mode 100644
index 2783b26..0000000
--- a/MuscleEMGProfile.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef MUSCLE_EMG_PROFILE_H_
-#define MUSCLE_EMG_PROFILE_H_
-
-#include <ostream>
-#include <string>
-#include <vector>
-
-class MuscleEMGProfile {
-public:
- MuscleEMGProfile(const std::string &name, unsigned capacity)
- : _name(const_cast<std::string &>(name))
- {
- if (capacity == 0)
- capacity = 100;
- _x.reserve(capacity);
- _y.reserve(capacity);
- }
-
- MuscleEMGProfile& operator=(const MuscleEMGProfile &m)
- {
- _name = m._name;
- _x = m._x;
- _y = m._y;
-
- return *this;
- }
-
- unsigned getIdx() { return _x.size(); }
- unsigned getCapacity() { return _x.capacity(); }
- const std::string &getName() { return _name; }
-
- void addData(double x, double y);
-
-private:
- std::string _name;
- std::vector<double> _x;
- std::vector<double> _y;
-
-// friend std::ostream& operator<<(std::ostream &s, const MuscleEMGProfile &m);
-};
-
-/*
-std::ostream& operator<<(std::ostream &s, const MuscleEMGProfile &m)
-{
- return s << "MuscleEMGProfile(" << m._name << ", " << m._idx << "/" << m._capacity << ")" << std::endl;
-}
-*/
-
-#endif /* MUSCLE_EMG_PROFILE_H_ */ \ No newline at end of file