Reading data from Xbox controller - Linux

This is the place for queries that don't fit in any of the other categories.

Reading data from Xbox controller - Linux

Postby majestateninja » Sat Apr 20, 2013 10:46 am

Hi all,

I'm actually a virgin to both Linux and Python (and to programming in general - aside from some very very OLD Basic programming and some batch scripting I have no programming experience).

I want to be able to do the following:

- Connect an XBOX 360 controller to a Raspberry PI. AFAIK, there is a user-space Linux driver for the XBOX 360 Controller: xboxdrv.

- Get axis/button values at a predifined sampling rate (tens of Hz).

- Apply a specific smoothing function (ie: Kalman filter) to certain value groups.

- Encoding smoothed data as PPM and sending it to GPIO pins of Raspberry PI (I have no idea how the GPIO controller registers in Linux).

First question: How exactly do I ask the driver to output sensor data into some defined variables?

You do not need to be very specific (although it would be much appreciated) - just point me to whatever you know will help me learn the steps in order to be able to solve said problem. Thanks.
majestateninja
 
Posts: 2
Joined: Sat Apr 20, 2013 10:23 am

Re: Reading data from Xbox controller - Linux

Postby Guitarman2010 » Sun Apr 21, 2013 12:10 am

You would need some knowledge of writing Linux drivers possibly using C
Guitarman2010
 
Posts: 22
Joined: Thu Mar 07, 2013 4:39 pm

Re: Reading data from Xbox controller - Linux

Postby majestateninja » Sun Apr 21, 2013 1:18 am

The driver is already available.
majestateninja
 
Posts: 2
Joined: Sat Apr 20, 2013 10:23 am

Re: Reading data from Xbox controller - Linux

Postby smerkousdavid » Sat Jan 10, 2015 2:59 am

I am actually trying to do something very similar here is as far as i got and i am really close to breaking the code:

P.S. I was using Ubuntu 12.04 adjust code to necessary purpose(if needed)

Lets start:

First install xboxdrv(steps here): https://github.com/raelgc/ubuntu_xboxdrv

Second install RXTX for usb communication(if needed)(I needed it for UDOO): https://github.com/rxtx/rxtx

Third(if needed)(NEEDED FOR UDOO!!!!) This is a communication code for two processors with a BAUD RATE of 115200 (can be adjustable) TERMINAL NEEDED:http://www.udoo.org/ProjectsAndTutorials/interaction-between-linux-and-arduino-on-udoo/

Fourth Install Python for linux to communicate with the xbox controller: https://www.python.org/downloads/ (Also make sure IDE works)

Fifth install py serial for the actual communication: http://pyserial.sourceforge.net/

Sixth and Finally add the code into the python(this is where im stuck but almost there):
Code: Select all
import serial
ser = serial.Serial('/dev/ttymx36', 115200)
ser.write=('5)


extra link: http://playground.arduino.cc/Interfacing/Python
This is where im stuck, because what im trying to do is actually read,l almost one week but this whole project has taken about 1 month so good luck guys!!! Please don't put bad comments i really have tried for about a month to get this right
(Replace USB0 with the port your using, and the ser write)
Last edited by Yoriz on Sat Jan 10, 2015 3:23 am, edited 1 time in total.
Reason: First post lock.
smerkousdavid
 
Posts: 1
Joined: Sat Jan 10, 2015 2:37 am


Return to General Coding Help

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests