Access the Sony Playstation SixAxis Controller using C++ on Linux

6.2k Views Asked by At

I'm coding in C++ on Linux (Ubuntu 12.04 specifically) and would like to use the PlayStation SixAxis controller (the type that comes with the PS3) as an input device, ideally over bluetooth.

My application will be running headless. There's no window manager running on the target platform. The target is a small robot that's running Ubuntu Server 12.04, though I'm developing on a desktop.

Are there any libraries or techniques for this that I could use?

2

There are 2 best solutions below

1
On
pkg-config opencv –libs –cflags
 run script for local-dir
t-j/qtsixa
sudo apt-get update
sudo apt-get install sixad -y
# plug controller into machine (via wire)
sudo sixpair
# unplug controller
0
On

My current solution involves using this ppa on ubuntu 12.04

sudo apt-add-repository ppa:falk-t-j/qtsixa
sudo apt-get update
sudo apt-get install sixad -y
# plug controller into machine (via wire)
sudo sixpair
# unplug controller
sixad --start
# hold PS button

I then found your c++ library, and it works great. I now have sixaxis controlled robots!