Stuffs we can’t do with a mouse

As I was playing Battlefield: Bad Company 2, I discovered a limitation due to the mouse to right stick translation.

A constant rotation speed is easy to apply with a stick. That’s hard to do with a mouse!

In some situations it is required to emulate a constant max rotation speed. That’s just impossible with a mouse.

Next tasks

After a 1 month break, I want to continue working on the ps3 control.

Here is my task list:

  1. head tracking – test freetrack & estimate portability
  2. “dualshock 3” support – translate rumble to joystick/wheel force feedback (SDL 1.3 required)
  3. motion sensing commands
  4. cross-platform (windows and mac os)
  5. multiple emulators + new usb requests of the 3.50 firmware
  6. make a user manual from the tutorial
  7. other enhancements

The tasks are ordered from the highest to the lowest priority.

Other stuff:

It is now possible to launch homebrew apps onto the ps3. It could be possible to launch an app onto the ps3 emulating a “local” sixaxis and grabbing events from usb input devices.

The PSGroove effect


This is how I discovered the PSGroove hack was released: on 1. September, an unusual amount of internet users looking for “teensy++” visited my blog – about 4 times more visitors than usual.

Sixaxis emulator on a Ubuntu Live USB Persistent Flash Drive

As explained in the tutorial there, the sixaxis emulator runs well with a Ubuntu Live CD. But the bad point of that method is that the installed packages & softwares are not persistent (everything runs from volatile memory, nothing is saved on disk).

I discovered it is really easy to setup a Ubuntu Live USB Persistent Flash Drive. This stuff makes the sixaxis emulator extremely transportable: just take your bluetooth dongle and your usb flash drive, plug them on any PC, boot from USB, and start the sixaxis emulator!

A quick & easy tutorial to setup a Ubuntu Live USB Persistent Flash Drive can be found there.

Windows support on its way

After having tested a quick & ugly solution to get the sixaxis emulator work in windows (see last post), I decided to go further.

I already can run the emuclient process – which grabs events from input devices – as a native windows application.

I now want to run the emu process – which sends controls to the PS3 over bluetooth – as a native windows application too.

This task is hard because the windows bluetooth stack doesn’t expose its l2cap layer.

I’m looking for a way to have a l2cap layer access.

The freebt stack could be used (this project seems to be dead).

There also is the btstack project, which is unfortunately not designed for windows. But it contains a great idea: a HCI USB Transport using libusb (not working yet).

I’m thinking to get this HCI transport working…

I’m going to test the freebt driver first. All drivers for all windows versions are available there. It provides access to the HCI layer, so I have to implement the needed l2cap functionalities.

Ugly windows solution

Running the whole sixaxis emulator in a Linux Virtual Machine (with VirtualBox) was my first try.

But I discovered the input devices mapping from the host to the guest is not adapted at all: the mouse and the keyboard are emulated by VirtualBox, making the latency of the mouse higher, and breaking the precision of a high-end mouse.

Then I realized that the client/server architecture allows to run the emu and emuclient processes on different machines.

As you can see in the below screenshot, I decided to run the emu (which sends data to the PS3) in a Linux Virtual Machine with a command-line only linux (slitaz-base), and the emuclient (which grabs input device events) in the host Windows machine. The emuclient connects and send data to the emu through TCP/IP. The installation of slitaz+sixaxis-emulator librairies takes about 350Mo of disk space.


It works (seems to be playable), but not as good as the Linux-only solution: there obviously is more latency.

EDIT: some details if you want to try that.

Notes:

– Perform the sixaxis emulator tutorial in a VM first (if step 1 doesn’t work, try that step with a livecd).

– The network interface of the VM has to be configured in “Host-only networking” (that’s how it is called in VirtualBox, see there). If you can ping the VM Guest Linux from the Host Windows and vice versa, it should work!

– The usb bluetooth dongle has to be added to the VM usb devices.

1/ [VM/Guest Linux] in emu.c, change that line in tcp_listen function:

addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); // Listen only on localhost

to

addr.sin_addr.s_addr = htonl(INADDR_ANY); // Listen on any interface

Recompile emu process (make).

2/ [Host Windows] Get http://www.libsdl.org/release/SDL-1.2.14-win32.zip

Extract it. Copy SDL.dll to C:\Windows

3/ [Host Windows] Get http://diyps3controller.googlecode.com/files/sixaxis-emu.exe

4/ [VM/Guest Linux] Launch emu process as in the sixaxis emulator tutorial. It should power on the PS3.

5/ [Host Windows] Launch sixaxis-emu.exe with the ip address of the VM/ Guest Linux as argument. It should connect to the emu process running in the Guest Linux.

Handfree PS3 controller

OneSwitch.org.uk asked me yesterday about the feasibility of a handsfree ps3 controller. This kind of controller is especially great for people with disabilities, and I’m sure everybody can take the fun out of it.

The sixaxis emulator receives events from “common” input devices (mouse, keyboard, game devices) and translates them into ps3 controls.

There’s nothing preventing us to use a head tracking system (more generally, a gesture recognition system) and a voice recognition system as “handfree” input devices.

And a combination of common and handfree input devices is even possible…

I googled about a Linux head tracking system. Many projects are using the OpenCV library. I finally found a great project called EHCI – Enhanced human computer interface through webcam image processing library.

A demo to get 3d position of the head is available there. Head position could be translated into thumbstick movements. For example, this could be used to aim in FPS games (right thumbstick).

I have plenty of functionalities to add to the sixaxis emulator… but as always, the fun ones come to the top of my list!

My next task will be to get a demo of head tracking used to aim in a FPS.

EDIT July 9:

In the youtube video demonstrating a handfree PS3 controller, there is no technical details about how it works, so it could be fake. The only alternative ways to control a PS3 are external emulators, like using a PC+bluetooth or a programmable usb controller. Running a piece of software on the PS3 itself (while gaming) hasn’t been performed yet.

EDIT August 5:

I tried the EHCI 6DOF head tracking, but I think it’s not and not stable and accurate enough for playing purposes. With my latest work about using the sixaxis emulator in windows, I’ll be able to test the freetrack 6DOF head tracking (unfortunately not available in Linux), which seems to be approved by many gamers (see videos on youtube). This system requires a webcam and a small additional hardware (quite simple = 3 IR diodes, some resistances and a battery). It can emulate a standard joystick with 6 axis. Events from this joystick can be easily grabbed by the sixaxis emulator, and mapped to some sixaxis controls (as I already did for a steering wheel). I probably will test that at the end of August.