当前位置: 首页>>代码示例>>Python>>正文


Python myo.init函数代码示例

本文整理汇总了Python中myo.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
	
	global wingl
	global wingr
	viz.cam.setHandler(vizcam.KeyboardCamera())
	myo.init()
	gyrolist = [[0,0,0]]

	viz.fov(150)
	#wingl.setScale([10,0.3,1])
	#wingl.setCenter([100,100,100])
	wingl.setEuler([0,90,0])
	wingl.collideSphere(0.5)
	lStartPOS = [ 0, 2.5, 2 ]
	wingl.setPosition( lStartPOS )
	#wingr.setScale([10,0.3,1])
	#wingr.setCenter([100,100,100])
	wingr.setEuler([0,90,0])
	wingr.collideSphere(0.5)
	rStartPOS = [ 0, 2.5, 2 ]
	wingr.setPosition( rStartPOS )


	hub = myo.Hub()
	hub.set_locking_policy(myo.locking_policy.none)
	hub.run(1000, Listener())
	vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w, wingr])

	vizact.ontimer(0, updateEuler)

	FileReader()
	initializeObjectFiles()
	initializeLocations()
	getCurrentTestingLocationOrder()
	vizact.ontimer(0.1, update)
开发者ID:rhodesvr,项目名称:myo-march,代码行数:35,代码来源:MYO.py

示例2: main

def main():
    
    global wingl
    global wingr
    viz.cam.setHandler(vizcam.KeyboardCamera())
    myo.init()
    gyrolist = [[0,0,0]]
    viz.setMultiSample(4)
    viz.fov(150)
    wingl = viz.addChild('basketball.osgb')
    wingl.setScale([10,0.3,1])
    wingl.setCenter([100,100,100])
    wingl.setEuler([0,90,0])
    wingl.collideSphere(0.5)
    lStartPOS = [ 0, 2.5, 2 ]
    wingl.setPosition( lStartPOS )
    wingr = viz.addChild('basketball.osgb')
    wingr.setScale([10,0.3,1])
    wingr.setCenter([100,100,100])
    wingr.setEuler([0,90,0])
    wingr.collideSphere(0.5)
    rStartPOS = [ 0, 2.5, 2 ]
    wingr.setPosition( rStartPOS )

    #viz.MainView.setPosition([0,2,-15])
    hub = myo.Hub()
    hub.set_locking_policy(myo.locking_policy.none)
    hub.run(1000, Listener())
    vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w, wingr])
开发者ID:rhodesvr,项目名称:myo-march,代码行数:29,代码来源:myoTVDemo.py

示例3: main

def main():
  myo.init()
  hub = myo.Hub()
  listener = EmgRate(n=50)
  while hub.run(listener.on_event, 500):
    print("\r\033[KEMG Rate:", listener.rate, end='')
    sys.stdout.flush()
开发者ID:NiklasRosenstein,项目名称:myo-python,代码行数:7,代码来源:04_emg_rate.py

示例4: main

def main():
  libmyo.init()
  hub = libmyo.Hub()
  listener = EmgRate(50)
  try:
    while True:
      hub.run_once(100, listener)
      print("\r\033[KEMG Rate:", listener.rate, end='')
      sys.stdout.flush()
  finally:
    hub.stop(True)
    hub.shutdown()
开发者ID:Brentbin,项目名称:myo-python,代码行数:12,代码来源:emg_rate.py

示例5: main

def main():
  myo.init()
  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!")
开发者ID:NiklasRosenstein,项目名称:myo-python,代码行数:19,代码来源:05_api_listener.py

示例6: stream

def stream():
	#Initialize
	libmyo.init() 
	feed = libmyo.device_listener.Feed()
	hub = libmyo.Hub()
	hub.run(1000, feed)
	myo = feed.wait_for_single_device()

	#Continuously collect and emit data
	while 1:
		try:
			gyro = myo.gyroscope
			accel = myo.acceleration
			myo_sock.emit('data', [time.clock(), gyro.x, gyro.y, gyro.z, accel.x, accel.y, accel.z])
			time.sleep(0.02)
		except KeyboardInterrupt:
			break
		except:
			print 'Unexpected error'
			
	hub.shutdown()
开发者ID:dylanebert,项目名称:MyoLearn,代码行数:21,代码来源:myl.py

示例7: main

def main():
    global wingl
#    global wingr
    viz.cam.setHandler(vizcam.KeyboardCamera())
    myo.init()
    gyrolist = [[0,0,0]]
    viz.setMultiSample(4)
#    
    wingl = viz.addChild('basketball.osgb')
    wingl.setScale([10,0.3,1])
    wingl.setCenter([100,100,100])
    wingl.setEuler([0,90,0])
    wingl.collideSphere(0.5)
    lStartPOS = [ 0, 2.5, 2 ]
    wingl.setPosition( lStartPOS )
#    wingr = viz.addChild('basketball.osgb')
#    wingr.setScale([10,0.3,1])
#    wingr.setCenter([100,100,100])
#    wingr.setEuler([0,90,0])
#    wingr.collideSphere(0.5)
#    rStartPOS = [ 0, 2.5, 2 ]
#    wingr.setPosition( rStartPOS )

    #viz.MainView.setPosition([0,2,-15])
    hub = myo.Hub()
    hub.set_locking_policy(myo.locking_policy.none)
    hub.run(1000, Listener())
    vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w])
    vizact.onkeydown('p', hub.shutdown)
    FileReader()
    initializeObjectFiles()
    initializeLocations()
    vizact.ontimer(0.1, update)
    vizact.onkeydown(' ', statusUpdate)
    vizact.onkeydown('s', hub.shutdown)
    
#    viz.AVIRecorder.maxWidth = 1920;
#    viz.AVIRecorder.maxHight = 1080;
    vizact.onkeydown('b', viz.window.startRecording, 'myo_capture.avi' ) 
    vizact.onkeydown('e', viz.window.stopRecording )
开发者ID:rhodesvr,项目名称:myo-march,代码行数:40,代码来源:MYO2.py

示例8: print

__author__ = 'James Boggs'
__version__ = 'alpha 0.03'

# Just reads Myo input and writes it to a serial port for an Arduino
# to read. A stand-in for reading a Myo directly from the Arduino,
# which will come later.

import serial
import myo as libmyo
libmyo.init('C:\\Users\\James\\Documents\\Coding\\MyoArm\\myo-sdk-win-0.9.0\\bin')
from time import sleep

HUB_INTERVAL_MS = 1000
SERIAL_OUT_PORT = 2 #COM3


if __name__ == '__main__':
    # set up myo listener
    hub = libmyo.Hub()
    feed = libmyo.device_listener.Feed()
    hub.run(HUB_INTERVAL_MS, feed)

    # set up serial communications
    ser = serial.Serial(SERIAL_OUT_PORT)

    # begin Myo loop
    try:
        myo = feed.wait_for_single_device(timeout=10)
        if not myo:
            print("No Myo connected after 10 seconds.")
            raise
开发者ID:JBoggsy,项目名称:MyoArm,代码行数:31,代码来源:MyoReader.py

示例9: Jarvis

from __future__ import print_function
from pync import Notifier
from phue import Bridge
from random import randint
from os import system

import myo as libmyo; libmyo.init('./myo.framework')
import time
import sys

class Jarvis():
    hue_bridge_ip = '192.168.0.29'
    default_bulb_id = 2
    request_interval = 0.1  # Output only 0.1 seconds
    default_voice_names = ["Zarvox", "Ava"]

    def __init__(self):
        print("Hi ! I'm Jarvis. Nice to meet you !")
        self.last_time = 0
        self.voiceNameId = 0
        self.initHueBridge()
        self.initMyo()
        
    def run(self):
        # Listen to keyboard interrupts and stop the hub in that case.
        try:
            while self.hub.running:
                time.sleep(0.25)
        except KeyboardInterrupt:
            print("\nQuitting ...")
        finally:
开发者ID:V1C0D3R,项目名称:Jarvis,代码行数:31,代码来源:jarvis.py

示例10: init

        self.z1=quat.z
        self.w1 = quat.w
        
        

    

        

        
        

        
    
            
    

        
        

init("/users/dominic/downloads/sdk/myo.framework")
hub = Hub()
hub.run(1000, Listener(),lil_sleep=0.01)
try:
    while True:
        sleep(0.5)
except KeyboardInterrupt:
    print('\nQuit')
finally:
    hub.shutdown()  # !! crucial
开发者ID:qema,项目名称:gesture-sound,代码行数:30,代码来源:Stop.py

示例11: Listener

from __future__ import print_function

import myo as libmyo
from firebase import firebase

libmyo.init()
import time


class Listener(libmyo.DeviceListener):
    """
    Listener implementation. Return False from any function to
    stop the Hub.
    """

    interval = 0.5;  # Output only 0.05 seconds
    firebase = firebase.FirebaseApplication('https://rock-paper-scissors-game.firebaseio.com/', None)

    def __init__(self):
        super(Listener, self).__init__()
        self.orientation = None
        self.pose = libmyo.Pose.rest
        self.emg_enabled = False
        self.locked = False
        self.rssi = None
        self.emg = None
        self.last_time = 0

    def post_result(self):
        result = self.firebase.get('/user1', None)
开发者ID:HackerPack,项目名称:rock-paper-myo,代码行数:30,代码来源:RockPaperScissor.py

示例12: Listener

from __future__ import print_function

import myo as libmyo; libmyo.init('E:\\Documents\\Fall 2015\\Fall 2015_\\CSE442\\crazyflie-clients-python\\raf')
import time
import sys
import sling as Crazy
import math

class Listener(libmyo.DeviceListener):
    """
    Listener implementation. Return False from any function to
    stop the Hub.
    """

    interval = 0.08  # Output only 0.05 seconds

    def __init__(self):
        super(Listener, self).__init__()
        self.orientation = None
        self.pose = libmyo.Pose.rest
        self.emg_enabled = False
        self.locked = False
        self.rssi = None
        self.emg = None
        self.acceleration = None
        self.gyroscope = None
        self.last_time = 0
        self.TakeOff = True
        available = "radio://0/80/2M"
        self.le = Crazy.Sling(available)
        self.gotCenterYaw = False;
开发者ID:shirazamin,项目名称:CrazyFile_MyoArmband,代码行数:31,代码来源:Myo.py

示例13: print

            Listener.temp = quat.x
        else:
            print("Lower your hand/n")
            sleep(1)
            Listener.temp = quat.x

        #     newx = 1
        #     Listener.temp = quat.x
        #     sleep(1)
        # else:
        #     newx = 15
        #     Listener.temp = quat.x
        #     sleep(1)
        # print newx
        # response = urllib2.urlopen('http://rpi.michaelbailey.co/control?dc='+str(newx))
        # html = response.read()




init()
hub = Hub()
hub.run(1000, Listener())
try:
    while True:
        sleep(0.5)
except KeyboardInterrupt:
    print('\nQuit')
finally:
    hub.shutdown()  # !! crucial
开发者ID:noctisilva,项目名称:makecdt,代码行数:30,代码来源:test2.py

示例14: Listener

addon_dir = xbmc.translatePath( my_addon.getAddonInfo('path') )
libdir = os.path.join( addon_dir, 'resources', 'lib' )
sys.path.append(libdir )

import myo
print '############################################'
xbmcgui.Dialog().notification(TITLE,'Module loading')

'''	if __name__ == '__main__':
	    monitor = xbmc.Monitor()
	 
	    while not monitor.waitForAbort(10):
	        xbmc.log("hello addon! %s" % time.time(), level=xbmc.LOGDEBUG)
''' 

myo.init(libdir)
xbmcgui.Dialog().notification(TITLE,'Starting 2')

class Listener(myo.DeviceListener):
    # return False from any method to stop the Hub
    def on_connect(self, myo, timestamp):
        myo.vibrate('short')
        myo.request_rssi()

    def on_rssi(self, myo, timestamp, rssi):
		pass

    def on_event(self, event):
        pass

    def on_event_finished(self, event):
开发者ID:hllhll,项目名称:myo-kodi-control,代码行数:31,代码来源:myo_service.py

示例15: Copyright

# Copyright (C) 2014  Niklas Rosenstein
# All rights reserved.
import os, sys
sys.path.append(os.path.join('Users', 'raychen', 'Documents', 'Design', 'Hackathons', 'LAHacks', 'LeapCAD', 'myo-python'))
import myo
from myo.lowlevel import pose_t, stream_emg
from myo.six import print_
import random

myo.init()

SHOW_OUTPUT_CHANCE = 0.01
r"""
There can be a lot of output from certain data like acceleration and orientation.
This parameter controls the percent of times that data is shown.
"""

class Listener(myo.DeviceListener):
    # return False from any method to stop the Hub

    def on_connect(self, myo, timestamp):
        print_("Connected to Myo")
        myo.vibrate('short')
        myo.request_rssi()

    # def on_rssi(self, myo, timestamp, rssi):
    #     print_("RSSI:", rssi)

    def on_event(self, event):
        r""" Called before any of the event callbacks. """
开发者ID:raychensg,项目名称:LeapCAD,代码行数:30,代码来源:hello_myo.py


注:本文中的myo.init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。