Panda interface nintendo wiimote

Hi guys I recently discovered panda and I work in virtual reality applications.
I started to play with the WMD url[/url]python scripts to use the wiimote in simple 3d scenarios.
Since I’m new in panda i would like to ask what’s the best strategy to implement this feature.

I was trying to use the control thread in this way:

import direct.directbase.DirectStart
import math
from direct.task import Task


import sys
sys.path.append('.')

from wmd.Config import CFG
from wmd.UI.UIManager import UIManager
from wmd.Wiimote.WMManager import WMManager
from wmd.EVDispatcher import EVDispatcher
from wmd.MotionSensing import MSManager
from wmd.Pointer import POManager
from wmd.CommandMapper import CommandMapper

cf = CFG  # This contains the configuration. At this time, many config variables are being ignored.

ev = EVDispatcher( cf )  # In a way this is the core of the program. It dispatches events between each module
                     # allowing for communications between each part of the program. It also loads
		     # EventBridges, which route events like mouse position or clicks to the OS

#ui = UIManager( cf, ev ) # Loads one or more user interfaces
ms = MSManager( cf, ev ) # Motion analysis
#po = POManager( cf, ev ) # Handles the pointer, receives WM_IR, sends out ABS_POS absolute position reports
wm = WMManager( cf, ev ) # Handles the Wiimote; connects to it, manages wiimote state and mode, parses wiimote reports

cm = CommandMapper( cf, ev ) # Maps Wiimote keys and other events to commands like key presses or clicks

#this actually polls the wiimote in cycle must not be used by panda


#Load the first environment model
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)

#Run the example tutorial

#Task to get wiimote events
def WiiData(task):
  wm.step()
  return Task.cont

#Task to move the camera
def SpinCameraTask(task):

  angledegrees = task.time * 6.0
  angleradians = angledegrees * (math.pi / 180.0)
  base.camera.setPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3)
  base.camera.setHpr(angledegrees, 0, 0)
  return Task.cont

taskMgr.add(SpinCameraTask, "SpinCameraTask")
taskMgr.add(WiiData, "WiiData")
if wm.connect() and wm.setup():
	run()
wm.disconnect()

The problem is that the wiimote polling task is too slow compared to the frame rate.
Any suggestion?

Should I implement a mouse driver in the source code?

couldn’t this (the polling) go into a separate thread then? This would allow you to get the updates as soon as they are “there”

Just a suggestion, through…

Regards, Bigfoot29