Git Product home page Git Product logo

Comments (19)

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

To me this sounds more like a bug in Myo Connect, but of course it could be possible that I did something wrong with the bindings. For now, maybe you can try to work around this problem and create only one single Hub object for your application. If you want to pause the Hub, it should be possible to run it again after it stopped (returning False from a Listener or calling Hub.stop()).

from myo-python.

maartendruwe avatar maartendruwe commented on August 15, 2024

Well, I tried the restarting some time ago (when it was still the bindings modified by Juharris), and I didn't get it to work successfully back then. Is there a specific restart method? Or do you just have to mess with the attributes/fields? Like Hub.running?

from myo-python.

anelica avatar anelica commented on August 15, 2024

Hi,
I have a problem with connecting. I dont see the myo.py module in this data
This is my first time with python so maybe it is an obvious mistake, and I would be very grateful if you could help me and explain how to connect to myo. Did I miss a step or something. I am in a good directory but it keeps saying that there is no module named myo. :/

from myo-python.

jdaly101 avatar jdaly101 commented on August 15, 2024

Hi Anelica,
If I had to guess, you probably missed the "pip install -e myo-python" step which adds the library to your Python path variable.

from myo-python.

anelica avatar anelica commented on August 15, 2024

I am doing it on mac OSX. Do I just type that in python console? Because it says invalid syntax

Very sorry to bother you with this stupid questions but I am just a beginner.

I have managed to install it but the same message shows again. Shouldnt there be a file named myp.py and that would be the modul I a m looking for? Or I am missing the point.

from myo-python.

maartendruwe avatar maartendruwe commented on August 15, 2024

I could be wrong, but you probably just need to add the myo sdk and the bindings to your path. There's some installation information on this Github:

$ git clone [email protected]:NiklasRosenstein/myo-python
$ virtualenv env --no-site-packages
$ source env/bin/activate
$ pip install -e myo-python
$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(pwd)/myo-sdk-mac-0.8.1/myo.framework
$ python3 myo-python/examples/hello_myo.py

I don't really now OSX, but I figure this should be done in your Mac Console, not in your Python IDE.
If you don't have pip (I don't know if all Python versions automatically include it), you should install it.
Maybe this can help for that: http://stackoverflow.com/questions/17271319/installing-pip-on-mac-os-x

from myo-python.

anelica avatar anelica commented on August 15, 2024

You helped me a lot! thank you!
I hade to update software to be able to install this so it took me whole day.
And now when I tought I have it, another problem occured. :(
Seems like something is wrong with hub

when i type hub=libmyo.Hub() i get this:

Traceback (most recent call last):
File "", line 1, in
File "/Users/ANELA/Documents/modules/myo-python-master/myo/init.py", line 74, in init
self._hub = _myo.Hub()
File "/Users/ANELA/Documents/modules/myo-python-master/myo/lowlevel/ctyping.py", line 250, in init
lib.init_hub(byref(self), byref(error))
File "/Users/ANELA/Documents/modules/myo-python-master/myo/lowlevel/ctyping.py", line 59, in getattr
raise AttributeError(name)
AttributeError: init_hub

Do you maybe know what is the problem?

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@anelica Have you called libmyo.init() before creating a Hub object?

from myo-python.

anelica avatar anelica commented on August 15, 2024

@NiklasRosenstein Yes! This is what I get

libmyo.init()
Traceback (most recent call last):
File "", line 1, in
File "/Users/ANELA/Documents/modules/myo-python-master/myo/lowlevel/ctyping.py", line 126, in init
self._lib = ctypes.cdll.LoadLibrary(lib_name)
File "/Users/ANELA/anaconda/lib/python2.7/ctypes/init.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/Users/ANELA/anaconda/lib/python2.7/ctypes/init.py", line 365, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(myo, 6): no suitable image found. Did find:
myo: not a file

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

Apparently you haven't set up the environment variables correctly. Did you add to DYLD_LIBRARY_PATH the path to the myo.framework folder inside the Myo SDK you downloaded? Please check the instructions again. You might need to adjust the path when the Myo SDK is not in the same directory as your current working directory (the example uses $(pwd) to get the full path to the current working directory and reference the Myo SDK from there).

PS: Please create a new issue next time, you basically hijacked this thread ;-)

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@maartendruwe

Well, I tried the restarting some time ago (when it was still the bindings modified by Juharris), and I didn't get it to work successfully back then. Is there a specific restart method? Or do you just have to mess with the attributes/fields? Like Hub.running?

To be honest, I haven't really tried to restart the Hub yet. Hub.running should be a read-only field so that shouldn't be the solution. I'll have to investigate if a simple Hub.stop(True) and Hub.run(1000, listener) doesn't do it.

from myo-python.

anelica avatar anelica commented on August 15, 2024

@NiklasRosenstein well I think I have!
It is in my documents under folder modules where the sdk folder is so I typed this

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/ANELA/Documents/modules/sdk/myo.framework 

Is that ok?

I am so sorry, it is my first time on GitHub :D

from myo-python.

anelica avatar anelica commented on August 15, 2024

@NiklasRosenstein Now i have put the sdk folder into the myo-python-master folder so that they are in the same and added the path but it is still not working.

Could you just tell me if i am doing good.
1.downloaded myo-python-master
2.installed via terminal with pip install
3.downloaded myo sdk
4.sdk folder is in myo-python-master folder
5.than I export it:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/ANELA/Documents/modules/myo-python-master/sdk/myo.framework
or with the pwd
6.i launch spyder (python 2.7)
7. i type: import myo as libmyo
libmyo.init()

Is that it? Because I still get the same mistake over and over. I am sure that I am missing the obvious point here :S

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@anelica Looks OK to me right now. I'll check this out on my mac asap.

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@anelica Do you launch spyder from the terminal?

from myo-python.

anelica avatar anelica commented on August 15, 2024

@NiklasRosenstein no I launch it via launcher.app

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@anelica The DYLD_LIBRARY_PATH you set up won't be visible to Spyder then. It's only inherited by the processes you start from the terminal. Not sure if it will work if you start it with open -a Spyder.

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

@maartendruwe Were you able to work around this for the moment? I didn't find the time to look into this yet, sorry.

from myo-python.

NiklasRosenstein avatar NiklasRosenstein commented on August 15, 2024

When I take the hello_myo.py example and change it to

    hub.set_locking_policy(libmyo.LockingPolicy.none)
    hub.run(1000, Listener())

    while True:
        time.sleep(1.0)
        hub.shutdown()
        print("\nRestarting hub...")
        hub.run(1000, Listener())

I get

Connecting to Myo ... Use CTRL^C to exit.
[0.9288330078125][-0.0797119140625][-0.14874267578125][-0.329833984375][<Pose: rest>][ ][ ][-54]54]
Restarting hub...
Traceback (most recent call last):
  File "myo-python\examples\hello_myo.py", line 161, in <module>
    main()
  File "myo-python\examples\hello_myo.py", line 144, in main
    hub.shutdown()
  File "c:\users\niklas\repos\niklasrosenstein\myo-python\myo-python\myo\__init__.py", line 283, in shutdown
    self._hub.shutdown()
  File "c:\users\niklas\repos\niklasrosenstein\myo-python\myo-python\myo\lowlevel\ctyping.py", line 328, in shutdown
    self._notnull()
  File "c:\users\niklas\repos\niklasrosenstein\myo-python\myo-python\myo\lowlevel\ctyping.py", line 168, in _notnull
    raise RuntimeError(message)
RuntimeError: Hub object is nullptr

But not the behaviour @maartendruwe described. Looking into myo.lowlevel.ctyping.Hub.shutdown(), we can find

    def shutdown(self):
        """
        Shuts the Hub down if it is running. The object is not usable
        after calling this function.
        """

        self._notnull()
        error = ErrorDetails()
        result = lib.shutdown_hub(self, byref(error))
        self.value = None
        error.raise_on_error()
        return result

If I remember correctly, it was documented in the Myo SDK that you can not re-use the hub once you shut it down (it's being deallocated). Creating a new lowlevel Hub object after the old has been shut down will fix this.

from myo-python.

Related Issues (20)

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.