Open muchimi opened 5 years ago
Ok spelunking through the code, found this works:
> >
> >
> > tmthrottle = gremlin.input_devices.JoystickDecorator( TM_THROTTLE_NAME, TM_THROTTLE_GUID, MODE_ALL )
> > # where: TM_THROTTLE_GUID is a "{xxx.xxx.xxx.xxx.xxx}" string GUID
>
> > # read throttle
> > j = joy[tmthrottle.device_guid]
> > v = -j.axis(7).value
> >
Any other reference blows up as the joystick proxy is only indexed by a GUID, and not by its string representation, and Python's UUID doesn't work here either as it looks like the GUID is the GUID class, not the UUID Python object.
I'll have to double check if there is an actual issue with that stuff, because I remember talking to someone else about something along similar lines. Though I don't remember if the end result was that it's a bug in Gremlin or that something was being done slightly incorrectly.
If the joystick access works correctly (something I have to double check) and all you need is to create a proper GUID object instance for the lookup from a string representation then the gremlin.profile.parse_guid
function should do the trick.
Yes the issue I was having, which I discovered looking at the source code is that the parameter for the device GUID has to be a Gremlin GUID, not a Python UUID or a string. What got me was the error I was getting in the script was totally unhelpful and misleading - it should really say "dummy you sent me a string, I need a GUID). The method I ended up using as shown in the code sample above works well because the decorator already has the device_guid property as a GUID (not a string). It thus made sense I think to use the decorator device_guid as the indexer.
I'm having some difficulty getting the value of a stick from the callback of another stick.
@deco.axis(1) def test_callback(event, joy, vjoy):
read current value from another stick
I also get the same error if I just reference the joystick by index:
j = joy[1] # blows up with the same error -
Not sure why.
Looking for an example that lets me reference the other stick from the vjoy object . I'm doing something wrong for sure but not sure what, and not finding a good example of how to do that i in the custom plugin manual. Using Gremlin 13.3.