h@ck your Xbox Controller

Right after the designing of the board I started to think of doing something cool.  I kinda got anxious if I don’t do some crazy or fascinating thing.  So this time while being at my Prof’s Home I got to see a Xbox 360 controller and we just recently made our kit and board and did a workshop in our college using the same board which I discussed in the previous post.
I actually tried to run a simple bot using the Xbox controller wirelessly.  I have already got some Xbee transceivers so I thought of using them.     xbee xbox_360_controller


The new setup I just made of my bot looks like this :bot_image

 I actually used the ROS library of Joystics for interfacing the Xbox360 controller. Following was the output when I connected the Xbox controller to my system :

[13104.806643] usb 1-1.2: new full-speed USB device number 19 using ehci_hcd
[13104.903838] usb 1-1.2: New USB device found, idVendor=045e, idProduct=028e
[13104.903841] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[13104.903844] usb 1-1.2: Product: Controller
[13104.903845] usb 1-1.2: Manufacturer: \xffffffc2\xffffffa9\xffffffa9Microsoft Corporation
[13104.903847] usb 1-1.2: SerialNumber: 03E2B93
[13104.904541] Registered led device: xpad1
[13104.904605] input: Microsoft X-Box 360 pad as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input13

Okay so I  got some crucial information about the Xbox controller’s USB type, its credentials and the usb bus address etc.   

Once I got the message packet type (from the ROS libraries and message types :X :X)  the remaining things were pretty simple.
Xbox Controller actually sends a big packet every time  some event occurs on its pin or joysticks.   Actually this ain’t that big considering its the USB protocol that is being used up.

std_msgs/Header header
uint32 seq
time stamp
string frame_id
float32[] axes
int32[] buttons

This is the total weight of the message that is transmitted by the Xbox controller every time a button or axis is pushed/changed.  A simple sequence containing of types like unsigned int, time, string, array of float and int (integer are in 32 bit, first one is unsigned and other is signed)
Then using these messages I finally made a code to send some distinct values to Xbee attached to my system.  Also I attached a Xbee to the bot so that It can receive the values and act accordingly.

Below is the video link of its proof.



Leave a Reply

Your email address will not be published. Required fields are marked *