5

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?

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
  • You're looking for some library similar to the text mousedev, but for the PS3 controller? There's a library for the move - http://thp.io/2010/psmove/ which may assist you somewhat. Your question is a little bit vague, though. – Anya Shenanigans Jan 24 '13 at 23:59
  • @Petesh, it's a bit vague because I'm not entirely sure what I'm looking for. The end result is to sample the state of the controller periodically, or to receive callbacks in response to state changes. Either would be fine. That library does not seem to support the SixAxis controller unfortunately. The closest I've found so far is sixad, which is the underlying library for QtSixA. I haven't managed to get that working yet though. – Drew Noakes Jan 25 '13 at 00:18
  • QtSixA injects the messages into `uinput`, and you read from the exposed /dev/input device. It's going to be event driven - you'll receive messages when data changes. Hooking through libevent for processing the messages might make things simpler to program. – Anya Shenanigans Jan 25 '13 at 00:56
  • Also, 5 seconds of Googling reveals this page: https://help.ubuntu.com/community/Sixaxis – DanielKO Feb 15 '13 at 06:49
  • 1
    Since you mentioned you are trying to control a robot, I'm going to leave this here: http://www.ros.org/wiki/ps3joy – Nicu Stiurca Feb 18 '13 at 22:39
  • Hi Drew, I am a member of the NUbots Robocup team and after buying a PS3 controller for this exact purpose I have found this question! Did you get anywhere with this project? I would very interested in any info you found! – Brendan Annable Mar 14 '14 at 01:04

2 Answers2

3

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!

Brendan Annable
  • 2,637
  • 24
  • 37
1
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
Julian
  • 33,915
  • 22
  • 119
  • 174
  • Please a) explain how your code works b) explain how your code helps c) format more helpfully ( https://stackoverflow.com/editing-help ) d) format less noisily e) do not publish emails f) do not fix your broken email, delete it – Yunnosch Dec 06 '19 at 22:16