Skip to content

Commit

Permalink
Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
informacja committed Mar 26, 2021
1 parent a0da8aa commit b47104c
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 52 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# EMG
Temat projektu: Nauczenie i rozwój gestów metody kaskadowej prototypu dłoni quasi-nadążania w czasie rzeczywistym.
Temat projektu: Nauczenie i rozwój gestów metody grupowej kaskady w zastosowaniu prototypu bionicznej dłoni quasi-nadążania w czasie rzeczywistym.

## [Concept](https://stijournal.pl/resources/html/article/details?id=204954&language=en) [pl](https://stijournal.pl/resources/html/article/details?id=204954&language=pl)
[
![Mapa Myśli](docs/temat.png)
![Mapa Myśli](docs/diagram.png)
](https://coggle.it/diagram/X3_3tBiU9E_wpker/t/bioniczna-dłoń-image-ki)

[Podgląd mapy projektu](https://coggle.it/diagram/X3_3tBiU9E_wpker/t/bioniczna-d%C5%82o%C5%84-image-ki/6e02177ca5137de29b0a257721d5d5c0df390b9d885b2d90c6b684851fdd79f3)
Expand All @@ -20,6 +20,11 @@ Co to jest [sEMG](https://pl.wikipedia.org/wiki/Elektromiografia)?

[ HILBERT HUANG RELATED MATHEMATICAL PROBLEMS](docs/HHT.pdf)

[1] Promieniowanie elektromagnetyczne a zdrowie / Maria Przybylska. - Zielona Góra : Uniwersytet Zielonogórski, 2014.

[2] Biomechaniczne modele układu mięśniowo-szkieletowego człowieka / Wiktoria Wojnicz. - Wydanie I. - Gdańsk : Wydawnictwo Politechniki Gdańskiej, 2018.


#### Zadania (ToDo):
- [x] [Instrukcja](https://github.com/informacja/EMG/tree/master/matlab/instrukcja#readme) zbierania sygnałów
- [ ] Sieci neuronowe [TF](http://playground.tensorflow.org/#activation=tanh&batchSize=10&dataset=circle&regDataset=reg-plane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=4,6&seed=0.26866&showTestData=false&discretize=false&percTrainData=50&x=true&y=true&xTimesY=false&xSquared=true&ySquared=false&cosX=false&sinX=false&cosY=false&sinY=false&collectStats=false&problem=classification&initZero=false&hideText=false) (wizualizacja)
Expand Down
13 changes: 13 additions & 0 deletions WaveApp/README (2).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
waveApp

## Instrukcja

Obsługę prototypu realizuje oprogramowanie
1. [Akwizycji](DataTransfer_EMG_2_2.zip)
2. [Pomiarowe](M3LPC1347USB_EMG.zip)


### Pomyślna konfiguracja IDE
1.
![Qt Creator C++](docs/qt.png)
2. ![MCUX](docs/expresso.png)
Binary file added WaveApp/WaveUpApp.zip
Binary file not shown.
98 changes: 54 additions & 44 deletions WaveApp/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ MainWindow::MainWindow(QWidget *parent) :
// Hann Window
// for(int i=0; i<DSIZE2;i++)
// fftWin[i]=(0.5*(1-cos(2*M_PI*i/(DSIZE2-1))));

// ui->spinBox_gestureNr->setValue(0);
// ui->spinBox_personNr->setValue( 42);
ui->checkBoxSpectrum->setChecked(true);
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -233,45 +237,37 @@ void MainWindow::filterData()

void MainWindow::on_actionOpen_triggered()
{
QString FileName;
FileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home", tr("Data (*.dat)"));
QFile file(FileName);
if (!file.open(QIODevice::ReadOnly))
return;
//file.read(reinterpret_cast<char*>(timeData[0].data()), static_cast<uint>(VSIZE*FRCNT*sizeof(double)));

for(int j=0; j<NCH; j++)
file.read(reinterpret_cast<char*>(timeData[j].data()), static_cast<uint>(VSIZE*FRCNT*sizeof(double)));
file.close();




// QString FileName;
// FileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home", tr("Data (*.wav)"));
// QFile file(FileName);
// if (!file.open(QIODevice::ReadOnly))
// return;



// // qDebug()<< file.size();

// WaveHeaderEx waveHdr1, waveHdr2;



// //waveSignal.resize((file.size()-sizeof(waveHdr2))/sizeof(short));
// //waveSignal.fill(0);
// file.read(reinterpret_cast<char*>(&waveHdr2), static_cast<uint>(sizeof(waveHdr2)));
// //file.read(reinterpret_cast<char*>(waveSignal.data()), static_cast<uint>(waveSignal.size()*sizeof(short)));
// file.close();

// qDebug()<<"Channels"<<waveHdr2.Channels;
// qDebug()<<"dwSampleLength"<<waveHdr2.dwSampleLength;
// qDebug()<<"DataLength"<<waveHdr2.DataLength;
// qDebug()<<waveSignal.size();

// QString FileName = ui->spinBox_gestureNr->text() + ui->spinBox_personNr->text() + ".wav";
// FileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home", tr("Data (*.dat)"));
// QFile file(FileName);
// if (!file.open(QIODevice::ReadOnly))
// return;
// //file.read(reinterpret_cast<char*>(timeData[0].data()), static_cast<uint>(VSIZE*FRCNT*sizeof(double)));

// for(int j=0; j<NCH; j++)
// file.read(reinterpret_cast<char*>(timeData[j].data()), static_cast<uint>(VSIZE*FRCNT*sizeof(double)));
// file.close();

QString FileName;
FileName = QFileDialog::getOpenFileName(this, tr("Open File"),"/home", tr("Data (*.wav)"));
QFile file(FileName);
if (!file.open(QIODevice::ReadOnly))
return;

// qDebug()<< file.size();

WaveHeaderEx waveHdr1, waveHdr2;

//waveSignal.resize((file.size()-sizeof(waveHdr2))/sizeof(short));
//waveSignal.fill(0);
file.read(reinterpret_cast<char*>(&waveHdr2), static_cast<uint>(sizeof(waveHdr2)));
//file.read(reinterpret_cast<char*>(waveSignal.data()), static_cast<uint>(waveSignal.size()*sizeof(short)));
file.close();

qDebug()<<"Channels"<<waveHdr2.Channels;
qDebug()<<"dwSampleLength"<<waveHdr2.dwSampleLength;
qDebug()<<"DataLength"<<waveHdr2.DataLength;
qDebug()<<waveSignal.size();

// CreateWaveHeader(waveHdr1, NCH, 96000, static_cast<uint>(waveSignal.size()*sizeof(short)/NCH));

Expand All @@ -280,9 +276,11 @@ void MainWindow::on_actionOpen_triggered()

void MainWindow::on_actionSave_triggered()
{
QString FileName;
QString FileName = "/home";
FileName = QString("%1").arg( ui->spinBox_gestureNr->value(), 2 , 10, QChar('0')) +
QString("%1").arg( ui->spinBox_personNr->value(), 3 , 10, QChar('0')) + ".wav";
//FileName = QFileDialog::getSaveFileName(this, tr("Save File"),"/home", tr("Data (*.dat)"));
FileName = QFileDialog::getSaveFileName(this, tr("Save File"),"/home", tr("Data (*.wav)"));
FileName = QFileDialog::getSaveFileName(this, tr("Save File"), FileName, tr("Data (*.wav)"));
QFile file(FileName);
if (!file.open(QIODevice::WriteOnly))
return;
Expand All @@ -291,7 +289,6 @@ void MainWindow::on_actionSave_triggered()
for(int i=0; i<VSIZE*FRCNT;i++){
for(int j=0; j<NCH; j++)
waveSignal[k++]=static_cast<short>(timeData[j][i]*32767);

}

WaveHeaderEx waveHdr;
Expand All @@ -311,9 +308,22 @@ void MainWindow::on_actionSave_triggered()
// for(int j=0; j<NCH; j++)
// file.write(reinterpret_cast<char*>(timeData[j].data()), static_cast<uint>(VSIZE*FRCNT*sizeof(double)));



file.close();

QFileInfo fileInfo(file.fileName());
ui->groupBox_2->setTitle( fileInfo.fileName());
}

void MainWindow::on_pushButton_clicked()
{
on_actionSave_triggered(); // save file
if( ui->spinBox_gestureNr->value() < 7)
{
ui->spinBox_gestureNr->setValue( ui->spinBox_gestureNr->value()+1 );
}
else
{
ui->spinBox_gestureNr->setValue( 0 );
ui->spinBox_personNr->setValue( ui->spinBox_personNr->value()+1 );
}
}
2 changes: 2 additions & 0 deletions WaveApp/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ private slots:
void on_actionOpen_triggered();
void on_actionSave_triggered();

void on_pushButton_clicked();

private:
Ui::MainWindow *ui;
void paintEvent(QPaintEvent *event);
Expand Down
108 changes: 102 additions & 6 deletions WaveApp/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>410</height>
<height>570</height>
</rect>
</property>
<property name="minimumSize">
Expand Down Expand Up @@ -68,7 +68,7 @@
<property name="minimumSize">
<size>
<width>105</width>
<height>44</height>
<height>425</height>
</size>
</property>
<property name="maximumSize">
Expand All @@ -91,10 +91,10 @@ color: rgb(255, 255, 255);</string>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>12</x>
<y>0</y>
<width>80</width>
<height>291</height>
<x>10</x>
<y>10</y>
<width>81</width>
<height>281</height>
</rect>
</property>
<property name="title">
Expand Down Expand Up @@ -277,6 +277,102 @@ color: rgb(255, 255, 255);</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<width>81</width>
<height>108</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>gestNr.wav</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QSpinBox" name="spinBox_gestureNr">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wrapping">
<bool>false</bool>
</property>
<property name="specialValueText">
<string/>
</property>
<property name="keyboardTracking">
<bool>true</bool>
</property>
<property name="showGroupSeparator" stdset="0">
<bool>false</bool>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="displayIntegerBase">
<number>10</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_personNr">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>43</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Save </string>
</property>
<property name="shortcut">
<string>Enter</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QCheckBox" name="checkBoxSpectrum">
<property name="geometry">
<rect>
<x>20</x>
<y>300</y>
<width>72</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>Spectrum</string>
</property>
</widget>
</widget>
</widget>
<action name="actionRun">
Expand Down
Binary file added docs/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b47104c

Please sign in to comment.