Last active
September 25, 2020 05:18
-
-
Save luizsaluti/bf1a404a04b0f490be4e5fb2e927b0a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################## | |
######################## | |
######################## | |
# PLEASE READ THIS | |
# A newer and improved version of this filter was developed by WhiteMagic grab it at | |
# https://www.dropbox.com/s/2kdmku7tznbj42r/average_filter.py?dl=0 | |
import math | |
import time | |
import gremlin | |
from gremlin.spline import CubicSpline | |
from collections import deque | |
# Device creation | |
#new way | |
wingman = gremlin.input_devices.JoystickDecorator( | |
"Wingman", | |
"{3DC8CDC0-6AAC-11E9-8002-444553540000}", | |
"Default" | |
) | |
_threshold = 0.95 #safety measure to reach axis end | |
_last_values_x = [0] * 5 # define number of samples that will go into average (for both axes) | |
_last_values_y = [0] * 5 | |
last_values_x = deque(_last_values_x) | |
last_values_y = deque(_last_values_y) | |
curve = CubicSpline([ #the expected result here is a curve along with smoothing | |
(-1.0, -1.0), | |
(-0.74, -0.52), | |
( -0.176, -0.14), | |
( 0.176, 0.14), | |
( 0.74, 0.52), | |
( 1.0, 1.0) | |
]) | |
def averageAxis(axisval, last_values): | |
global _threshold | |
last_values.popleft() | |
last_values.append(axisval) | |
if abs(curve(axisval)) < _threshold: | |
return curve((sum(last_values) / len(last_values))) | |
else: | |
return curve(axisval) | |
@wingman.axis(1) | |
def roll(event, vjoy): | |
global last_values | |
vjoy[1].axis(1).value = averageAxis(event.value, last_values_x) | |
@wingman.axis(2) | |
def roll(event, vjoy): | |
global last_values | |
vjoy[1].axis(2).value = averageAxis(event.value, last_values_y) |
Author
luizsaluti
commented
Apr 8, 2020
via email
It's been some time that I don't mess with Joystick Gremlin. But have you
checked the joystick id? Could you show me how is your code right now?
Em qua., 8 de abr. de 2020 às 04:17, Vieillefont Antoine <
[email protected]> escreveu:
… ***@***.**** commented on this gist.
------------------------------
Hello, I'm interested by your module. I just tested it on Joystick Gremlin
13.3 Debug and I can not open the option of the module to set it up. Any
Idea why?
Thanks in advance, take care.
Antoine, from France.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245168>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH37MIL7SHAI2BCK2ROSJH3RLQQG5ANCNFSM4MDWJ57A>
.
Hello, sorry I deleted my comment, WhiteMagic explained me that your script
was kinda "outdated", cause the way module are handled changed since then.
So he updated it for me already. But thanks for coming back to me anyway.
In the attachement you'll find your script as updated by WhiteMagic to work
with current JG version.
Le mer. 8 avr. 2020 à 14:39, luizsaluti <[email protected]> a écrit :
… ***@***.**** commented on this gist.
------------------------------
It's been some time that I don't mess with Joystick Gremlin. But have you
checked the joystick id? Could you show me how is your code right now?
Em qua., 8 de abr. de 2020 às 04:17, Vieillefont Antoine <
***@***.***> escreveu:
> ***@***.**** commented on this gist.
> ------------------------------
>
> Hello, I'm interested by your module. I just tested it on Joystick
Gremlin
> 13.3 Debug and I can not open the option of the module to set it up. Any
> Idea why?
>
> Thanks in advance, take care.
> Antoine, from France.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245168
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AH37MIL7SHAI2BCK2ROSJH3RLQQG5ANCNFSM4MDWJ57A
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245525>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD6QJY2Z2MGROSEQPVUGRULRLRV6NANCNFSM4MDWJ57A>
.
Awesome!
So it seems that Whitemagic modified the way Joystick Gremlin works. Glad
to know it is working for you.
Cheers from Brazil,
Luiz Saluti
Em qua., 8 de abr. de 2020 às 09:54, Vieillefont Antoine <
[email protected]> escreveu:
… ***@***.**** commented on this gist.
------------------------------
Hello, sorry I deleted my comment, WhiteMagic explained me that your script
was kinda "outdated", cause the way module are handled changed since then.
So he updated it for me already. But thanks for coming back to me anyway.
In the attachement you'll find your script as updated by WhiteMagic to work
with current JG version.
Le mer. 8 avr. 2020 à 14:39, luizsaluti ***@***.***> a
écrit :
> ***@***.**** commented on this gist.
> ------------------------------
> It's been some time that I don't mess with Joystick Gremlin. But have you
> checked the joystick id? Could you show me how is your code right now?
>
> Em qua., 8 de abr. de 2020 às 04:17, Vieillefont Antoine <
> ***@***.***> escreveu:
>
> > ***@***.**** commented on this gist.
> > ------------------------------
> >
> > Hello, I'm interested by your module. I just tested it on Joystick
> Gremlin
> > 13.3 Debug and I can not open the option of the module to set it up.
Any
> > Idea why?
> >
> > Thanks in advance, take care.
> > Antoine, from France.
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <
>
https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245168
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AH37MIL7SHAI2BCK2ROSJH3RLQQG5ANCNFSM4MDWJ57A
> >
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245525
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AD6QJY2Z2MGROSEQPVUGRULRLRV6NANCNFSM4MDWJ57A
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245548>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH37MIMCOTCOQPYIUB3JCJLRLRXZ3ANCNFSM4MDWJ57A>
.
I can't see the attachment. Could you post it again?
Em qua., 8 de abr. de 2020 às 09:54, Vieillefont Antoine <
[email protected]> escreveu:
… ***@***.**** commented on this gist.
------------------------------
Hello, sorry I deleted my comment, WhiteMagic explained me that your script
was kinda "outdated", cause the way module are handled changed since then.
So he updated it for me already. But thanks for coming back to me anyway.
In the attachement you'll find your script as updated by WhiteMagic to work
with current JG version.
Le mer. 8 avr. 2020 à 14:39, luizsaluti ***@***.***> a
écrit :
> ***@***.**** commented on this gist.
> ------------------------------
> It's been some time that I don't mess with Joystick Gremlin. But have you
> checked the joystick id? Could you show me how is your code right now?
>
> Em qua., 8 de abr. de 2020 às 04:17, Vieillefont Antoine <
> ***@***.***> escreveu:
>
> > ***@***.**** commented on this gist.
> > ------------------------------
> >
> > Hello, I'm interested by your module. I just tested it on Joystick
> Gremlin
> > 13.3 Debug and I can not open the option of the module to set it up.
Any
> > Idea why?
> >
> > Thanks in advance, take care.
> > Antoine, from France.
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <
>
https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245168
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AH37MIL7SHAI2BCK2ROSJH3RLQQG5ANCNFSM4MDWJ57A
> >
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245525
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AD6QJY2Z2MGROSEQPVUGRULRLRV6NANCNFSM4MDWJ57A
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3245548>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH37MIMCOTCOQPYIUB3JCJLRLRXZ3ANCNFSM4MDWJ57A>
.
Hi @luizsaluti,
Did you ever get the attachment from hon0?
Or have a script that works in the new Gremlin?
Thanks!
Hi @luizsaluti,
Did you ever get the attachment from hon0?
Or have a script that works in the new Gremlin?
Thanks!
Here it is! https://www.dropbox.com/s/2kdmku7tznbj42r/average_filter.py?dl=0 (Modified by WhiteMagic).
Thanks hon0!
I will point to this URL in the gist so users will find it easier
Em sex., 15 de mai. de 2020 às 03:12, danwatto <[email protected]>
escreveu:
… ***@***.**** commented on this gist.
------------------------------
Thanks hon0!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://gist.github.com/bf1a404a04b0f490be4e5fb2e927b0a4#gistcomment-3304957>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH37MIPLFWN3X2AXH5AHARTRRTMOFANCNFSM4MDWJ57A>
.
The file was deleted, anyone have a copy?
The file was deleted, anyone have a copy?
Yep, added to my dropbox share: https://www.dropbox.com/s/4dz1ibrav2e11ci/Plugins.zip?dl=0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment