Neirda8282 / PySticks

Python API for flying with a game controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This Python library simplifies the task of flying an actual or simulated aerial vehicle, like a quadcopter, using a joystick or game controller. The code automatically detects what kind of device you're using and, for game controllers, sets the axes (throttle, aileron/roll, elevator/pitch, rudder/yaw) to the popular Mode 2 configuration. The right trigger is used for toggling the auxiliary channel. Stick values (including the auxiliary) are returned in the interval [-1,+1].

To install the library, run a command (terminal) window, change to the PySticks directory and run the command python3 setup.py install (Windows) or sudo python3 setup.py install (Linux). You can then test your controller by running the tester.py script.

This library has been tested on Windows 10 and Ubuntu 18.04, with the following devices:

  • PS3 controller
  • PS4 controller
  • Xbox 360 controller
  • Logitech Extreme 3D Pro joystick
  • Spektrum transmitter with WS1000 wireless simulator dongle
  • FrSky Taranis TX9 RC transmitter with mini USB cable

If your controller isn't in this list (or isn't behaving as expected), you can add a new controller (or remedy the problem) as follows:

  1. Run the joyreporter.py script to see the name of your controller and how its axes are mapped on your OS
  2. Add (modify) this information as in the controllers dictionary in pysticks/__init__.py

About

Python API for flying with a game controller


Languages

Language:Python 100.0%