Git Product home page Git Product logo

myo-python's Introduction

Announcements

[Oct 15, 2018] Thalmic Labs have announced the discontinuation of the Myo armband. Software that used to be accessible on the Thalmic downloads page can be found on the GitHub releases page.

[Jun 28, 2018] Myo-Python 1.0 has been released. It comes with a number of API changes. If you have been following an older tutorial, you might have the new version installed but use code that worked with the old version.
Check the Migrating from v0.2.x section below.


Python bindings for the Myo SDK

Myo-Python is a CFFI wrapper for the Thalmic Myo SDK. Minimum required Python version is 3.5.

Table of Contents

Documentation

The documentation can currently be found in the docs/ directory in the GitHub Repository.

Example

Myo-Python mirrors the usage of the Myo C++ SDK in many ways as it also requires you to implement a DeviceListener that will then be invoked for any events received from a Myo device.

import myo

class Listener(myo.DeviceListener):
  def on_paired(self, event):
    print("Hello, {}!".format(event.device_name))
    event.device.vibrate(myo.VibrationType.short)
  def on_unpaired(self, event):
    return False  # Stop the hub
  def on_orientation(self, event):
    orientation = event.orientation
    acceleration = event.acceleration
    gyroscope = event.gyroscope
    # ... do something with that

if __name__ == '__main__':
  myo.init(sdk_path='./myo-sdk-win-0.9.0/')
  hub = myo.Hub()
  listener = Listener()
  while hub.run(listener.on_event, 500):
    pass

As an alternative to implementing a custom device listener, you can instead use the myo.ApiDeviceListener class which allows you to read the most recent state of one or multiple Myo devices.

import myo
import time

def main():
  myo.init(sdk_path='./myo-sdk-win-0.9.0/')
  hub = myo.Hub()
  listener = myo.ApiDeviceListener()
  with hub.run_in_background(listener.on_event):
    print("Waiting for a Myo to connect ...")
    device = listener.wait_for_single_device(2)
    if not device:
      print("No Myo connected after 2 seconds.")
      return
    print("Hello, Myo! Requesting RSSI ...")
    device.request_rssi()
    while hub.running and device.connected and not device.rssi:
      print("Waiting for RRSI...")
      time.sleep(0.001)
    print("RSSI:", device.rssi)
    print("Goodbye, Myo!")

Migrating from v0.2.x

The v0.2.x series of the Myo-Python library used ctypes and has a little bit different API. The most important changes are:

  • The Hub object no longer needs to be shut down explicitly
  • The DeviceListener method names changed to match the exact event name as specified by the Myo SDK (eg. from on_pair() to on_paired())
  • Hub.run(): The order of arguments is reversed (handler, duration_ms instead of duration_ms, handler)
  • myo.init(): Provides a few more parameters to control the way libmyo is detected.
  • myo.Feed: Renamed to myo.ApiDeviceListener

Projects using Myo-Python

Changes

v1.0.5 (2021-09-04)

  • Replace use of time.clock() with time.perf_counter() (#92)
  • Bumped minimum required Python version to 3.5

v1.0.4 (2019-04-29)

  • Remove myo.quaternion, it was a leftover and the Quaternion class was actually in myo.types.math
  • move myo.types.math and myo.types.macaddr to myo package instead
  • myo.types package is now a stub for backwards compatibility
  • Depend on enum34 package instead of nr.types.enum which has been removed in nr.types>=2.0.0
  • Update the error message of a ValueError raised in myo.init()

v1.0.3 (2018-06-28)

  • Event.mac_address now returns None if the event's type is EventType.emg (#62)
  • Hub.run() now accepts DeviceListener objects for its handler parameter. This carries over to Hub.run_forever() and Hub.run_in_background().
  • Replace requirement nr>=2.0.10,<3 in favor of nr.types>=1.0.3

v1.0.2 (2018-06-09)

  • Fix Event.warmup_result (PR #58 @fribeiro1)

v1.0.1 (2018-06-09)

  • Fix Event.rotation_on_arm (#59)

v1.0.0 (2018-06-03)

  • Rewrite using CFFI

This project is licensed under the MIT License.
Copyright © 2015-2018 Niklas Rosenstein

myo-python's People

Contributors

andybarron avatar cgoodine avatar davidawad avatar fribeiro1 avatar jelyco660 avatar joshkvfx avatar juharris avatar niklasrosenstein avatar sgzsh269 avatar

Stargazers

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

Watchers

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

myo-python's Issues

Perhaps incompatible with newest SDK?

Hello,
First of all thanks so much for making a python module for the myo (makes my life so much easier).
However, after installing this on a new machine with the 0.9.0 SDK, I encounter an issue when trying to import myo with

import myo as libmyo; libmyo.init()

Here's the message:

Traceback (most recent call last):
  File "C:\Users\TheAt\Documents\Visual Studio 2015\Projects\Myo Test\Myo Test\M
yo_Test.py", line 1, in <module>
    import myo as libmyo; libmyo.init()
  File "C:\Python34\lib\site-packages\myo\lowlevel\ctyping.py", line 118, in init
    self._lib = ctypes.cdll.LoadLibrary(lib_name)
  File "C:\Python34\lib\ctypes\__init__.py", line 429, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python34\lib\ctypes\__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

I'm not sure if this is an issue with my PATH or what but I'd greatly appreciate some help if you get the chance. Thanks!

Edit: I've figured out that my PATH is just stupid and not seeing it so I manually pointed myo-python at the SDK. However, I can't us the line:

hub.run(1000, listener)

as it says that listener is not defined. I'm not sure how to fix this either and would love some help.
Once again, thanks!

Importing in python

Hey Niklas,
I hope you're well. Thanks for the tremendous contribution. However, I have been tying to import the library in vain but the python wouldn't find myo each time I try running the examples you provide (hello world and feed). I also need to point out that I am new to python so I'm probably missing something.
As you will see in the pictures, I tried pip installing and adding to path according to the methods I have found online but nothing worked. Here are specs of environment:
OS: windows 8.1
Python: version 2.7.10 (which contains pip by default)
I also run the latest Pycharm (community version)
I placed the myo SDK and myo-python folders in c:\python27

Thank you in advance for your time.

adding to path
command prompt

EMG streaming example?

Hi Niklas,

First off, thank you for the work you did here.
I want to know if you can include a sample script for streaming emg data.
Or perhaps get me started via discussion. The orientation data streaming works no problem, but I can't seem to get emg data to stream. I just get a stream of "None" coming in. I'm assuming streaming emg data is a bit less straightforward than streaming orientation data.

Thanks!

Making Myo Armband vibrate

Hi, I would like to know how to make the myo armband vibrate (sorry, I'm not an expert of Python).
Here is my code:

import time
import myo as libmyo
libmyo.init('D:/Program Files/myo-sdk-win-0.9.0/bin')

class Listener(libmyo.DeviceListener):

    def on_connect(self, myo, timestamp, firmware_version):
        print("Hello, Myo!")
        
    def on_disconnect(self, myo, timestamp):
        print("Goodbye, Myo!")

    def on_battery_level(self, event):
        print("Your battery level is:", event.battery_level)

    def on_pose(self, myo, timestamp, pose):
        if pose == libmyo.Pose.fist:
            print("Pose: Fist")
            return False
        if pose == libmyo.Pose.double_tap:
            print("Pose: Double tap")
            return False

hub = libmyo.Hub()
listener = Listener()
hub.run(1000, listener)
try:
    while hub.running:
        print("listening")
        time.sleep(0.5)
except KeyboardInterrupt:
    print("Quitting...")
finally:
    hub.shutdown()

If I want to make the armband vibrate just after the fist pose detected, what should I add?
I saw that there is the function vibrate() in the class MyoProxy, and I tried some things, but I didn't succeed.
Thank you in advance

image not found (mac)

From @hajjboy95 (2f34a13#commitcomment-12353281)

Iget the error on my mac

Traceback (most recent call last):
  File "/Users/ismail/PycharmProjects/techx15/cfm/main.py", line 7, in <module>
    from libs import myo as libmyo; libmyo.init()
  File "/Users/ismail/PycharmProjects/techx15/cfm/libs/myo/lowlevel/ctyping.py", line 131, in init
    self._lib = ctypes.cdll.LoadLibrary("myo")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(myo, 6): image not found

Heres is my project setup , Any ideas on whats going wrong?

Thanks!

screen shot 2015-07-24 at 3 31 45 pm

quaternion def rotation_of(source, dest): throwing error

Hello,

I have an error when using the following method rotation_of.
Indeed math.sqrt can handle only one argument.
I'm wondering if the coma have to be replaced by a multiplication.

Product of the square of the magnitudes.
k = math.sqrt(source.dot(source), dest.dot(dest))

Best regards,

Can't Get Rotation on Arm

I am getting an error when reading the rotation on arm after warmup.

Code

import myo

class SampleListener(myo.DeviceListener):
  def on_warmup_completed(self, event):
    print(event.rotation_on_arm)

myo.init()

hub = myo.Hub()

listener = SampleListener()

hub.run_forever(listener.on_event)

Stack Trace

Traceback (most recent call last):
  File "myo_sample.py", line 16, in <module>
    hub.run_forever(listener.on_event)
  File "C:\Users\fmribeir\AppData\Local\Programs\Python\Python36\lib\site-packages\myo\_ffi.py", line 571, in run_forever
    while self.run(handler, duration_ms):
  File "C:\Users\fmribeir\AppData\Local\Programs\Python\Python36\lib\site-packages\myo\_ffi.py", line 560, in run
    error.raise_for_kind()
  File "C:\Users\fmribeir\AppData\Local\Programs\Python\Python36\lib\site-packages\myo\_ffi.py", line 279, in raise_for_kind
    raise ResultError(kind, self.message)
myo._ffi.ResultError: (<Result: [1] error>, b'boost::bad_get: failed value get using boost::get')

Please advise.

API throws runtime error due to invalid event type

Hi Niklas,

Thank you for providing a Python API for the Myo. I was working with the device for some time and noticed a weird behavior while using your API.

When starting to connect to the armband I run into the problem that an invalid event type is registered causing a runtime error (as defined in the if statement in the file myo/init.py starting in line 324).

I would get this event sometimes during the initial connection procedure or shortly after connecting and using the armband.

After narrowing down the root cause for this behavior I added an additional check in the if statement that deals with invalid event types. This fixed the issue and everything runs stable.

Do you or anybody else happen to have experienced anything like this before? If you want, I can of course share the details of my modification or make a pull request?

The environment I run is the following:

Mac OS X 10.10.4
Myo Connect 0.15.0

Kind regards,

Tomek

I can´t read emg data

Hi folk, I am using your github code about MyO Python language.. I can´t read emg data with your code, Could you help me please?

This is the message: 'MyoProxy' object has no attribute 'emg'

Thank you

OSError: 'myo\\libmyo.h'

Hi.
I installed myo-python by running python3 setup.py install on Windows 10. I have my SDK located at C:\myo-sdk and added the following paths to my PATH:

C:\myo-sdk
C:\myo-sdk\include
C:\myo-sdk\bin

and all of them are visible when I run path in cmd.exe. However, I'm unable to issue import myo on Spyder and on python3 from console. I've also added these paths to my Spyder's PYTHONPATH. Here's the full log:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:\Users\William\AppData\Local\Programs\Python\Python35\lib\site-packages\myo_python-1.0.0-py3.5.egg\myo\__init__.py", line 26, in <module>
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "C:\Users\William\AppData\Local\Programs\Python\Python35\lib\site-packages\myo_python-1.0.0-py3.5.egg\myo\_ffi.py", line 191, in <module>
  File "C:\Users\William\AppData\Local\Programs\Python\Python35\lib\site-packages\myo_python-1.0.0-py3.5.egg\myo\_ffi.py", line 178, in _getffi
  File "C:\Users\William\AppData\Local\Programs\Python\Python35\lib\pkgutil.py", line 632, in get_data
    return loader.get_data(resource_name)
OSError: [Errno 0] Error: 'myo\\libmyo.h'

Any suggestions?

Sampling Rate

Great work!
This is not really an issue, but I just have a question regarding your script.
Is it possible to set the sampling rate with your script? I am writing the data to a text file, and it appears that I am experiencing a delay in the data as I reach the ~350th iterations.
I was hoping by reducing the sampling rate, the delay could be reduced.

Thank you very much.

yaw, pitch and roll

Hey Niklas,
I was wondering if the self.orientation output represent the yaw pitch and roll (Euler angles) already calculated or is it the raw quaternion?
Thanks

OSerror [126], using ctypes ,

hi, i am trying to solve for many hours , and i search on internet, but nothing ,
32 bits, 64 bits, python 2.7 (32) , python 2.7 (64), python 3.5 (32) - 64 bits, and nothing

ok.. i look this
------ctyping.py
# Load the library. Could raise OSError. <------- ?? ok ,
self._lib = ctypes.cdll.LoadLibrary(lib_name)

when i try call init() .

File "C:\Python35\lib\site-packages\myo_python-0.2.2-py3.5.egg\myo\lowlevel\ctyping.py", line 119, in init
self.lib = ctypes.cdll.LoadLibrary(lib_name)
File "C:\Python35\lib\ctypes__init
_.py", line 425, in LoadLibrary
return self.dlltype(name)
File "C:\Python35\lib\ctypes__init
_.py", line 347, in init
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] No se puede encontrar el módulo especificado
I dont know how fix it

--http://stackoverflow.com/questions/3101981/python-ctypes-windll-error-dlopenself-name-mode-cant-be-found --- not working

Please help me

RMS value for EMG

Hello
I really need help
I want to make a code in order to control solenoid valve of an air muscle depending on the rms value of the EMG Reading and i donot know how to get the rms value in real time, all i want is to get the the RMS of the first 64 sample of EMG and when a new sample appear i shift one sample and take the rms of these 64 sample and so on,
Thanks
waiting for a reply

Unpair the device

Hello,

Due some errors (cant figure out exactly from where) I need to unpair the device. In the Myo Connect software there is a button, but is it also callable as a function?

Thank you!

listener.get_emg_data()

Hi Mr Niklas
when um printing listener.get_emg_data()
i get a very very long list
b
I know that first element is timestamp right (1530437403075359L, [2, 2, -2, -6, -6, -8, -2, -2])
so what for all these lists that is included in one listener.get_emg_data() ?
Thanks in advance

Invalid enumeration shall still hold the original value

Right now, if an Enumeration subclass is created from an unexpected value, either NoSuchEnumerationValue is raised or, if __fallback__ is specified on the enumeration subclass, that value is used instead. Unfortunately, this hides the original value which might be important for debugging purposes.

The following changes shall be introduced to the myo.utils.enum.Enumeration class, which must be backwards compatible:

  • When an invalid enumeration value is created, a new instance of the enumeration shall be created that holds the original value passed to the constructor
  • For the special __fallback__ enumeration value, if specified, the following evaluates to True for all enumeration objects that have an invalid value: __fallback__ == invalid_enum_value

Myo Connect unresponsive/crash after starting and shutting down hub multiple times

Hi

While using this binding to interact with the Myo, I encountered an annoying problem.

After creating a Myo Hub, and subsequently shutting it down, several times, Myo connect becomes unresponsive and crashes. This obliges me to end the Myo Connect task via the Windows Task Manager and restart the program.

On average, it takes between 6 and 10 times of creating and shutting down hubs, before this happens.

Do you know what could be the cause of this? Is it a computer specific problem? A problem with Myo Connect? Or maybe with the bindings?

Thank you very much!

math domain error (yaw)

Quaternion.py --- line 153 and 162

yaw=math.asin(2*x*y+2*z*w)

gives

ValueError: math domain error 

for avoid this in my code i put

try:
     yaw=math.asin(2*x*y+2*z*w)
except ValueError:
    yaw=0

what happened here?
my resolve is good?

Greetings since Colombia

Edit by NiklasRosenstein 2016-04-30: Code formatting

Retrieving device name throwing error

When using MacOS SDK 0.9.0, if I try to access the device name from event.device_name, I'm getting the error:

*** AttributeError: function/symbol 'libmyo_event_get_myo_name' not found in library '/<PATH>/myo.framework/myo': dlsym(0x7fd68b55b0d0, libmyo_event_get_myo_name): symbol not found

unsupported platform Linux

hi Niklas Rosenstein
i'm really interested in your work ,very amazing//
but i tried to run your code in whezziy linux giving error unsupported platform
im using raspberry pi 2
i want to insert your code in my project , so i will be Thankful if you helped me to run this code
thanks for your hard working

Acceleration and Gyroscope events don't appear

Dear Niklas,

Sorry, I've completely rewritten my question here. Previously it was different, but formulated in a wrong way. Hopefully it didn't bother you)

I successfully run your example files, but I face an issue during the use of Listener class in my application. I'm making a PyQt app that visualizes the EMG and IMU data in real time. I've written my own listener, based on your example, that puts all the data into a Queue shared between the listener and parent widget. The problem is that I don't receive orientation events at all. Let's take this code for example:
def on_event(self, kind, event): print(kind)
When a listener with this code is created in main(), like in your example, it prints this:
...
EventType: emg
EventType: emg
EventType: emg
EventType: emg
EventType: orientation
...

in a repetitive way and I find it completely correct.

But when I create the same listener in my widget, it gives only :
...
EventType: emg
...

The listener class I use in both examples is the same. The difference is whether I create it in main() function or in my app's widget. Do you have some idea about this issue?
I do it on OSX El Capitan, armbands are up to date.

Thank you very much!

Connecting problems

Hey,

I tried to start the programm with the example code and followed the instructions before.

On initialiazation of the hub ( hub = Hub() )I got an error:

Traceback (most recent call last):
  File "C:/Users/riecker/Documents/Masterthesis/PythonTestProject/myo-python-master/grabber.py", line 17, in <module>
    hub = Hub()
  File "C:\Users\riecker\Documents\Masterthesis\PythonTestProject\myo-python-master\myo\__init__.py", line 78, in __init__
    self._new()
  File "C:\Users\riecker\Documents\Masterthesis\PythonTestProject\myo-python-master\myo\__init__.py", line 99, in _new
    self._hub = _myo.Hub()
  File "C:\Users\riecker\Documents\Masterthesis\PythonTestProject\myo-python-master\myo\lowlevel\ctyping.py", line 250, in __init__
    self._memraise()
  File "C:\Users\riecker\Documents\Masterthesis\PythonTestProject\myo-python-master\myo\lowlevel\ctyping.py", line 170, in _memraise
    raise MemoryError('Could not allocate %s object.' % class_name)
MemoryError: Could not allocate Hub object.

How can I fix that or why cant the program allocate memory?

Thanks for your effort,
Nico

How can I access the current(Real time) IMU data of the MYO?

Cause I can access the orientation but not the gyro nor the accelerometer data so can you please tell me how to access them(gyro and accelerometer)?

I do appreciate your help, sorry but I kind of lost in the documentation that is why I raised ann issue

ImportError: No module named myo

I've been trying to figure this one out for awhile. Right after the download from your repository I will get the classic "No module named myo". I've tried putting in this module manually to python and I will get this error:
EnvironmentError: unsupported platform Linux
I am using a raspberry pi running on debian-linux. Any ideas why this is not working?

Multiple Myos

Hi, is it possible to use multiple Myos with these bindings? If so, how?

Mac setup

Hi, it would be useful to know where should one have the myo SDK placed ;) If I could I would just send You a message, there is only one post about it here:
https://developer.thalmic.com/forums/topic/1601/
I cannot wait to start playing with Myo and Python :)
Have a nice new years eve :) cheers
Peter

Varying number of EMG samples

Hello,

im turning on the hub: self.hub.run(200, li) then wait an amount of time to collect data sleep(0.55) and then I stop the hub: self.hub.stop().
These statements are in an endless loop and at the end of this loop I have again a sleep(x). This sleep depends on an other thread for which I'm waiting (doesnt matter in this case).

When the x in the last sleep gets bigger I get more data (EMG) from my listener although I stopped the Hub. How is that possible? Could it be the case that the Hub is still collecting data and puffers them? If yes how yould I avoid this ? I need in every loop iteration the same number of EMG samples, independent from the sleeping time.

Thanks for your effort, anybody an idea?

error "OSError: [WinError 126] The specified module could not be found"

When I run example script i receive:

 File "c:\python3\python34\Lib\ctypes\__init__.py", line 429, in LoadLibrary
   return self._dlltype(name)
 File "c:\python3\python34\Lib\ctypes\__init__.py", line 351, in __init__
   self._handle = _dlopen(self._name, mode)
 OSError: [WinError 126] The specified module could not be found

I use: python 3.4

Regards

EMG Timestamp strange behaviour

I would like to ask a little question, though I'm not sure if it's appropriate here.
So, I'm using Myo Python for a simple EMG-to-file writing, like this:

def on_emg_data(self, myo, timestamp, emg):
    if self.first_sample:
        self.start_time = timestamp
        self.first_sample = False

    self.emgfile.write("%d " % (timestamp-self.start_time+1))
    for i in xrange(8):
        self.emgfile.write("%d " % emg[i])
    self.emgfile.write("\n")

    print (timestamp-self.start_time+1)

The problem is that I can't get the meaning of timestamps provided with the signal. They appear to be not regular at all. Let me show it here:
timestamp_differences.pdf

These are differences between subsequent timestamps, and normally they should be all around one central value, but they aren't.
Maybe I'm not treating the uint64_t in a right way? Or I should probably use time.time() instead of timestamps?

Thank you very much for your work. Hope my question won't bother you much.
Bye!

Raw EMG Data or processed?

Hello,

I couldnt find any information about the format of the emg data. Is it the raw EMG data, or is it
already processed by the MyoSDK ?

Thanks :)

Example code

When I try to run the example code in python 3.4, I get an errors:
hello-myo.py: bad syntax on first print statement
pose-show.py: mo such module "myo"

OSError: dlopen(myo, 6): image not found

Hello,

This is my first time commenting on Github, if it is not the right place to report this issue, please directly me to the correct place.

I am new to Mac and Myo. I received my Myo (yeah, finally) last week and I want to do some scripting with Python. I found your wrapper in the Myo forum and got the Python path setup properly (so that I can 'import myo'). I download the Myo 0.8.1 SDK and place the myo.framework it in the /Library/Myo_SDK folder. Then I follow the instruction to set up the DYLD_LIBRARY_PATH by hitting the following line in the Terminal:

export DYLD_LIBRARY_PATH=/Library/Myo_SDK/myo.framework

And when I run the Example python script, I got this error:
OSError: dlopen(myo, 6): image not found

Any clue what is this error? Is it because I didn't setup the path correctly? Or is it because I use the 0.8.1 SDK?

Thanks for your help.

number of emg datas

Hello folks,
Firstly, i used hello_myo.py codes in NiklasRosenstein's examples folder for all of my experiments. I'm trying to collect emg data in each time interval for example 5 sec. We know that the sample rate for EMG data in myo is 200Hz and it means that program take a data each 0.005 sec (i change your default rate). During the 5 sec the number of total data should be 5/0.005 = 1000 but it was different values, and never be 1000 data. Sometimes, it was around 400, sometimes is 700 and the other times is 500. Then i changed the sample rate to 0.001 sec, number of datas was around 300 when i expected 5/0.001=500. Then i changed again the sample rate to 0.05, it did not give expected number of data. Why it is happening and is there any solutions?

expected LockingPolicy

hello,
I'm a biginner in programming, i'm working on a project with myo to use it with people with Parkinson disease, a month earlier I used the myo master SDK to assure the connection and it worked but now the same script won't work (I didn't change anything) can you help me please to solve this issue :
runfile('C:/Users/ELYES/Desktop/myo_test/myo-python-master/01_hello_myo.py', wdir='C:/Users/ELYES/Desktop/myo_test/myo-python-master')
[autoreload of sitecustomize failed:

Traceback (most recent call last):
  File "C:\Users\ELYES\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    else:
  File "C:\Users\ELYES\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    with open(filename, 'rb') as f:
  File "C:/Users/ELYES/Desktop/myo_test/myo-python-master/01_hello_myo.py", line 48, in <module>
    hub = myo.Hub()
  File "C:\Users\ELYES\Desktop\myo_test\myo-python-master\myo\_ffi.py", line 468, in __init__
    self.locking_policy = LockingPolicy.none
  File "C:\Users\ELYES\Desktop\myo_test\myo-python-master\myo\_ffi.py", line 491, in locking_policy
    raise TypeError('expected LockingPolicy')
TypeError: expected LockingPolicy

libmyo.init() not available

Hello Niklas,

Thank you for the work you've put into making this. I am encountering an error when i run the hello-python module. the error is " [Error 126] The specified module could not be found " and it is with respect to the libmyo.init() function call. Could you provide some info on this?

RSSI streaming returns none?

Hi again. Just wondering how to get the rssi in the feed_myo.py set up? Currently doing something like myo.rssi returns a string of none. Thanks!

Unable to import Myo using Anacoda

Good morning,

I am a novice. I am trying to read data from the Myo Wristband. I have read the documentation on how to import packages into my anaconda distribution. I can see the module called myo when I list the packages within the terminal but when I try to run any of the examples, I get the following error:

runfile('/Users/edgarcolin/Documents/3D printing/myo-python-master/examples/feed_myo.py', wdir='/Users/edgarcolin/Documents/3D printing/myo-python-master/examples')
Traceback (most recent call last):

File "", line 1, in
runfile('/Users/edgarcolin/Documents/3D printing/myo-python-master/examples/feed_myo.py', wdir='/Users/edgarcolin/Documents/3D printing/myo-python-master/examples')

File "/Users/edgarcolin/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "/Users/edgarcolin/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)

File "/Users/edgarcolin/Documents/3D printing/myo-python-master/examples/feed_myo.py", line 2, in
import myo as libmyo; libmyo.init()

ImportError: No module named myo

Cannot initialise hub with Python3.4

At line 126 of myo/enum.py, the 'cls' object has no attribute '_values'.

If I run the same example script with Python2.7.8 it works fine, and sticking a breakpoint on this same line shows that the '_values' attribute has been created.

I'm sorry, but I can't understand some of your metaclass magic that's going on in all those initialisers! If you've got anything you'd like me to try, or debug output you'd like added here, please let me know.

how to identify pose

how to get the pose name or number in python which is made using myo. this is what i tried but i am not getting anything.

from future import print_function
import myo as libmyo
import csv
libmyo.init('C:/sj/secondsem/multimedia/project/myo-sdk-win-0.9.0/bin')
class Listener(libmyo.DeviceListener):

    def on_connect(self, myo, timestamp):
        print("Hello, Myo!")

    def on_disconnect(self, myo, timestamp):
        print("Goodbye, Myo!")

    def on_orientation_data(self, myo, timestamp, quat):
        print("Orientation:", quat.x, quat.y, quat.z, quat.w)

    def on_pose(self, myo, timestamp, pose):
        if pose == libmyo.Pose.fist:
            print("Don't show me 'ya fist!")
            return False  # Stops the Hub
def main():

  hub = libmyo.Hub()

  listener = Listener()

  p=listener.on_pose()
  print(p)
  try:
      hub.run_once(5000, listener)
  finally:
      
      hub.shutdown()

Acquiring raw EMG signal from Myo

Hi! Thanks for your work. It is beautiful. However, I have one quick question.

If I would like to acquire the raw EMG signal from every pod. Is it possible?

Thanks for your answer. Looking forward to hearing it back from you.

Regards,
Arnold Adikrishna

Compile and Install from source

Hello,

thank you very much for your work. Maybe you could post a short example or tutorial of how to build the module from source and how to install it, that I can modify the module (fix some issues) and recompile it.
Unfortunately im new at python and dont have any idea where to start and how.

Thank you :)

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.