xwiimote / xwiimote-bindings

Language bindings for the xwiimote package
Other
24 stars 10 forks source link

Nbr Motion Plus msgs != Nbr Accelerometer msgs #14

Open Franck7L opened 7 years ago

Franck7L commented 7 years ago

Hi,

I'm trying to use several wiimotes on Rpi3 and I can do a lot of things with xwiimote. Thanks !

Prevously I've used Cwiid which always gives the same amount of MP and ACCEL messages. I'm now going into xwiimote because I have RVL-CNT-01-TR wiimotes.

But by using the polling system as in our python binding example, i'm always getting more MotionPlus messages than Accelerometer messages.

Below is a reducted code i've made to demonstrate the issue. IThere's a dynamic layer (because nbr of wiimote is not always the same) but I've isolated the first wiimote to count the messages :

p = poll() 
evt = xwiimote.event()
for interface in interfaces :     
    p.register(interface.get_fd(), POLLIN)

MP_event = 0
AC_event = 0

while transmission :    
    p.poll()
    wm = 0           
    for interface in interfaces :        
        try:
            interface.dispatch(evt)
            if wm == 0 :            
                if evt.type == xwiimote.EVENT_MOTION_PLUS:                                  
                    MP_event +=1
                elif evt.type == xwiimote.EVENT_ACCEL:                
                    AC_event +=1
        except IOError as e:
            if e.errno != errno.EAGAIN:
                print "Bad" 
        wm +=1
        print MP_event, AC_event

MP_event is always growing faster than AC_event. Any idea on the reason and something I can do to recover the same amounts ?

Best regards,

Franck