GithubHelp home page GithubHelp logo

gamepad's Issues

.disconnect() / stopBackgroundUpdates() blocks forever if no gamepad events occur.

Hi,

I think the background thread never terminates because stopBackgroundUpdates() just sets the running flag that is checked in a while loop. But _getNexEventRaw() blocks until there is an event. So, after stopBackgroundUpdates() is called, there needs to be one last event (i.e. a button press) until the flag is checked and the thread actually terminates.

Does anybody have a good idea on how to gracefully stop the update thread? (Ctrl-C works to just terminate the process, but that is not very nice.)

D-Pad Button Vs Axis Support

I am using the XBox adaptive controller to make a robot for someone who has limited motion. This controller has two buttons and a D-Pad. The d-pad shows up as an axis, but the value always remains 0 regardless of if it is pressed or not. Is there a way to configure the D-pad to work like a button press rather than an analog axis?

The script I started with is the unmodified AsyncExample.py.

Thank you!

Xbox One wireless gamepad is not detected

this library doesn't seem to detect wireless gamepads connected using BT.
When I run:
python3 PollingExample.py
script hangs on message:
Please connect your gamepad...

My hardware/software setup:
Xbox One wireless gamepad
Mac OS 12.5 Monterey
Python 3.8.9

The controller is working fine when tested on https://gamepad-tester.com/

Is there a chance to add support for wireless controllers?

Button index not found

I've been getting this error when I run any script, including EventExample.py

Gamepad connected
Traceback (most recent call last):
File "/mnt/raid1/Code/Useful/Gamepad/Gamepad.py", line 421, in addButtonPressedHandler
if callback not in self.pressedEventMap[buttonIndex]:
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/raid1/Code/Useful/Gamepad/EventExample.py", line 64, in
gamepad.addButtonPressedHandler(buttonHappy, happyButtonPressed)
File "/mnt/raid1/Code/Useful/Gamepad/Gamepad.py", line 424, in addButtonPressedHandler
raise ValueError('Button %i was not found' % buttonIndex)
ValueError: Button 0 was not found

The only thing changed in EventExample.py is this:

Wait for a connection

if not Gamepad.available(1):
print('Please connect your gamepad...')
while not Gamepad.available(1):
time.sleep(1.0)
gamepad = gamepadType(1)
print('Gamepad connected')

I put "1" in the parantheses instead of default value 0.

It says "GamePad Connected" even if the GamePad is not connected.

Not working on RPI3 with Ubuntu 16.04

Describe the bug
PS4 gamepad is detected and connected. However the reported axis and buttons are wrong. Async doesn't update the values and events are not fired.

To Reproduce
Run any example from the folder

Key Error

Hello!
I tried using the Gamepad.py but kept running into a Key error, any idea how to solve it?

We have a Logitech F710 Gamepad, that we'd like to use for event based callbacks, so thought of using this library.

I tried running the Gamepad.pyon python3 with our controller to find the mappings to make my own class, so started with the PS4 class, ran into a key error, thought it was because I used the wrong class for my gamepad.

But after a few trials, found out that the problem wasn't with the Gamepad class. The Gamepad.py generates an output for only 2 buttons (R1 and B) and 2 axes, for every other button or axis event, it throws a Key error. I haven't changed anything in the Gamepad.py. Would be great if I could receive some insight into how to solve this issue.

Screenshots

Available device names:
    Gamepad - Generic (numbers only)
    Logitech - Logitech Rumblepad
    MMP1251 - ModMyPi Raspberry Pi Wireless USB Gamepad
    PS3 - PlayStation 3 controller
    PS4 - PlayStation 4 controller
    Xbox360 - Xbox 360 controller
    example - Enter the human readable name of the device here

What device name are you using (leave blank if not in the list)
? Logitech

Gamepad connected
Logitech Rumblepad
BUTTON,	  R1,	True
BUTTON,	  R1,	False
BUTTON,	  R1,	True
BUTTON,	  R1,	False
BUTTON,	  R1,	True
BUTTON,	  R1,	False
BUTTON,	  R1,	True
BUTTON,	  B,	False
BUTTON,	  B,	True
BUTTON,	  B,	False
BUTTON,	  B,	True
BUTTON,	  B,	False
BUTTON,	  B,	True
BUTTON,	  B,	False
BUTTON,	  B,	True
BUTTON,	  B,	False
BUTTON,	  B,	True
BUTTON,	  B,	False
Traceback (most recent call last):
  File "./Gamepad.py", line 613, in <module>
    eventType, index, value = gamepad.getNextEvent()
  File "./Gamepad.py", line 244, in getNextEvent
    return self.getNextEvent()
  File "./Gamepad.py", line 211, in getNextEvent
    for callback in self.movedEventMap[index]:
KeyError: 3

Hardware setup

  • Ubuntu 18.04 Desktop
  • Logitech Cordless RumblePad 2

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.