Re: [Pyobjc-dev] More wiimote wrapping fun!
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2008-02-21 10:20:53
|
On 20 Feb, 2008, at 1:02, John Harrison wrote:
> I've been following the discussions concerning the wiimote wrapper
> with interest as I have this insane dream of integrating head
> tracking into my laser/pySight controlled video game in order to make
> it even sillier than it currently is. Alas, I have encountered
> problems along the way.
>
> Working with some people that I've found on this list and the
> darwiinremote project I've got something that works somewhat for
> button presses and the irPointMovedX_Y_ method. My problem is that I
> want to capture the raw IR data, and this portion of the code seem to
> not work.
>
> Here is the relevant information from the most recent WiiRemote.h
> file:
>
>
> typedef struct {
> int x, y, s;
> } IRData;
>
> @interface NSObject (WiiRemoteDelegate)
> - (void) rawIRData: (IRData[4]) irData;
>
>
>
>
> in python I have the following:
>
> WiiRemoteDelegate = objc.informal_protocol(
> "WiiRemoteDelegate",
> [
> objc.selector(None,
> selector="irPointMovedX:Y:",
> signature="v@:ff", isRequired=False),
> objc.selector(None,
> selector="rawIRData:",
> signature="v@:[4{IRData=iii}]", isRequired=False)
> ...
>
> def rawIRData_(self, *posargs, **kwdargs):
> #def rawIRData_(self, irData):
> #print 'rawIRData: %s' % (irData,)
> for x in posargs:
> print '%x' % (x)
>
>
> No matter what I do I get the same data in my delegate, formatted as
> hex here:
> 1322f2c
> 13
> bfffe350
> 1313b20
> 1313b00
> bfffe3a0
> 0
> 154c396
> 94aa0ca4
> 142b9c8
> 1322ed0
> 13
>
> This looks to me like I'm not getting the ints that I would expect
> but that I'm getting references to the IRData struct or something.
That's odd, it looks like the informal protocol isn't actually used.
What's the value of rawIRData_.signature? This should be v@:
[4{IRData=iii}]. Please use the commented-out version of the method
prototype for this, not the one with '*posargs'.
BTW. I've downloaded the WiiRemote framework a while back and my
parsing script cannot deal with some features in the header files (I
haven't even tried fixing that yet). Furthermore, you won't be able to
use the Mii structure from python because that contains bitfields and
those aren't supported yet.
Ronald
>
>
> Is there something wrong with selector and/or signature? Do I need
> to add method encodings to the signature? What would a properly
> encoded signature look like? If these are pointers is there a way to
> dereference them in python?
>
> I've been banging my head against this for more time than I'd like to
> admit and keep getting either bus errors or junk data.
>
> Thanks!
> John
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Pyobjc-dev mailing list
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
|