GithubHelp home page GithubHelp logo

semg_sdk's Introduction

[TOC]

sEMG_SDK

SDK of sEMG functions of matlab

目的
实现思路
  1. 先对大量复用性代码进行抽象化与模块化;
  2. 对不同功能的函数代码进行分而治之;

说明文档

1. 采集程序
2. 基于窗函数的特征提取
3. 模型参数的输入与输出

README of directories/folders

acquisition
  1. functions of acquiring sEMG/ACC online/offline
controlAPI
  1. module function of controlling movement pictures exhibition
  2. module function of controlling iLimb
  3. module funciton of controlling HOH(Hand of Hope)
  4. module function of controlling virtual hand
funs_help

Functions description and parameters settings if necessary.

general

In generally, it is described how these codes are involved into your own project, such as path involvement.

models

Common models functions are described here. For example,

  1. LDA
  2. PCA
  3. ICA
  4. NMF and so on.

Explanations on TCPIP parameters

Common
  1. HOST_IP=127.0.0.1 50040 or something like that properties of tcpip LocalHost = '127.0.0.1' LocalPort = 50040
  2. InputBufferSize, BytesAvailableFcnMode BytesAvailableFcnCount BytesAvailableFcn
EMG
  1. InputBufferSize = 6400 BytesAvailableFcnMode = 'byte' BytesAvailableFcnCount = 1728 BytesAvailableFcn , @Function when the cache in LocalHost:LocalPort is acquried enough to 1728bytes, Function is trigged.
  2. why 1728 1728 = (27 samples)x(4 bytes/sample)x(16 channels)
ACC
  1. InputBufferSize = 6400 BytesAvailableFcnMode = 'byte' BytesAvailableFcnCount = 384 BytesAvailableFcn , @Function when the cache in LocalHost:LocalPort is acquried enough to 1728bytes, Function is trigged.
  2. why 384 384 = (2 samples)x(4 bytes/sample)x(48 channels) 3-axes: x-y-z 16 channels
  3. 27:2, is the simplest proportion
Summary of TCPIP on EMG&ACC

All data from 16 channels, including EMG signal and ACC data, are stored in the tcpip cache.

In your self-defined functions, you should seperate your wanting data that relating to the selected Sensor channels.

Select the right data to update plotting or stored in the .txt or csv files.

A common error about TCPIP

Error Messages as following:

Error using icinterface/fread (line ...)
OBJ must be connected to the hardware with FOPEN.

Error in Model/NotifyEMG (line ...)
    data = cast(fread(obj.interfaceObjects{2},bytesReady), 'uint8');

Error in Model>@(varargin)obj.NotifyEMG(varargin{:}) (line ...)
    'BytesAvailableFcn', {@obj.NotifyEMG}) ...
Error instrcb (line ...)
    feval(val{1}, obj, eventStruct, var{2:end});

原因分析: 根本原因在于MATLAB里面没有中断优先级的机制。 也就是当前执行的任务,无论如何都要执行完毕。 然后,当CPU空闲的时候,就去查中断的堆栈,如果堆栈中有来自某个的中断请求,CPU就回去执行; 只要有任何一方提中断,就会将响应地址写到中断向量的堆栈中,等CPU来响应。

所以,就有可能产生一个矛盾,(针对当前的情况分析如下) 因为某一个函数执行时间比较长,在此期间TCPIP中断已经提了20个中断,都被压在堆栈中了; 正常情况下当该函数被执行完毕后,就去逐一执行堆栈中的中断; 而恰恰不巧的是,在执行该函数的过程中,其中有些命令直接把TCPIP端口关闭了, 啊?此时,中断的堆栈中竟然还有TCPIP的中断请求, 好吧,函数执行完毕后,去响应TCPIP中断请求,不巧的是,TCPIP已经关闭了,怎么办呢? 就报错呗,要求用FOPEN进行设备连接,也就错误提示的第一句话。

semg_sdk's People

Contributors

cnzero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

semg_sdk's Issues

有个问题想请教

我用的也是Delsys公司的肌电测量设备,试了一下您的代码,有两个问题:1.在发送START命令时,命令终止符需要设置,否则无法开启读取数据流的任务。我看您这边没有设置猜想可能和设备有关。2.我能读到数据之后,发现所有的信号值均为0,查找了多方面的原因仍没有头绪,不知您是否遇到过此问题,请指教。我猜想是不是会因为数据流一旦打开,16个通道的数据都会缓存在matlab中,pair的通道是1个或者两个,其余通道的值本来就为0,会不会是在选取对应通道时没匹配起来选成别的通道了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.