Exemple #1
0
    init = 1

blenderpath = GameLogic.expandPath('//')

if init:
    print(blenderpath)
    GameLogic.Object = {}
    print("BLENDER: GameLogic object created")
    GameLogic.Object['closed'] = False
    
    GameLogic.setLogicTicRate(60)
    
    mice = xinput.find_mice(model="Mouse")
    m = [mice[0],mice[1]]
    for mouse in m:
        xinput.set_owner(mouse) # Don't need this if using correct udev rule
        xinput.switch_mode(mouse)
        
    if len(mice):   
        s1, conn1, addr1, p1 = \
            gu.spawn_process("\0mouse0socket", 
                          ['%s/evread/readout' % blenderpath, '%d' % mice[0].evno, '0'])
        s2, conn2, addr2, p2 = \
            gu.spawn_process("\0mouse1socket", 
                          ['%s/evread/readout' % blenderpath, '%d' % mice[1].evno, '1'])
        
        conn1.send(b'start')
        conn2.send(b'start')
        
        gu.recv_ready(conn1)
        gu.recv_ready(conn2)
import math
import dao
import numpy as np
import serial
import xinput
import gnoomutils as gu
import sys
import time

#python3 ball_running_test.py

mice = xinput.find_mice(model="Mouse")
m = [mice[0],mice[1]]
blenderpath = "/home/kemerelab/git/VR_Ball"
for mouse in m:
    xinput.set_owner(mouse)
    xinput.switch_mode(mouse)

if len(mice):   
    s1, conn1, addr1, p1 = \
      gu.spawn_process("\0mouse0socket", 
                  ['%s/evread/readout' % blenderpath, '%d' % mice[0].evno, '0'])
    s2, conn2, addr2, p2 = \
      gu.spawn_process("\0mouse1socket", 
                  ['%s/evread/readout' % blenderpath, '%d' % mice[1].evno, '1'])

    conn1.send(b'start')
    conn2.send(b'start')

    gu.recv_ready(conn1)
    gu.recv_ready(conn2)