Google Earth with a PS3 controller

Google Earth is a lot of fun with a 3D input device. But not everyone can justify shelling out a hundred bucks or so on a SpaceNavigator just to play with Google Earth. I've explored other possibilities, but the best alternative I've come up with is the PS3 controller. It has more than enough joysticks and buttons for five degrees of freedom. Have a look:

The PS3 controller is pretty well supported under Linux (at least if you connect it with a USB cable, it's more complicated if you want to use Bluetooth). The only problem really is mapping its various buttons and joysticks to proper functions in Google Earth. Fortunately, there is a piece of software called pystromo that can freely remap input events, thus allowing us to turn a PS3 controller into a SpaceNavigator-lookalike.

Here's what you need to do.

  • Download and unpack pystromo.
  • Open the lib/constants.py file in the pystromo directory with a text editor. Find the line containing "ABS_MISC" and add the following two lines after that (before the curly brace):
    48: "ABS_L2",
    49: "ABS_R2",
    (We have to do this, because pystromo doesn't have constants for the PS3 controller's L2 and R2 buttons.)
  • Create a new file in the pystromo directory and call it, say, config/ps3-ge.map. Put the following in it:
  • Connect your PS3 controller using a USB cable and press the PS button.
  • As root, run the following command: ./pystromo-remap.py -R -v -m config/ps3-ge.map
  • This will create a new input device, called eventN in /dev/input/. The one you're looking for is the one with the highest number. As root, run this to give your regular user access to the device: chmod 666 /dev/input/eventN
  • Open /opt/google/earth/free/drivers.ini with a text editor and put the following after the "SETTINGS" line (after the curly brace), remembering to replace eventN with the proper device number:
    SpaceNavigator/sensitivityX = 0.4
    SpaceNavigator/sensitivityY = 0.4
    SpaceNavigator/sensitivityZ = 0.1
    SpaceNavigator/sensitivityPitch = 0.05
    SpaceNavigator/sensitivityYaw = 0.05
    SpaceNavigator/sensitivityRoll = 100
    SpaceNavigator/device = /dev/input/eventN
    SpaceNavigator/zeroX = 127
    SpaceNavigator/zeroY = 127
    SpaceNavigator/zeroZ = 127
    SpaceNavigator/zeroPitch = 127
    SpaceNavigator/zeroYaw = 127
    SpaceNavigator/zeroRoll = 127
  • Run Google Earth.

You should now be able to navigate using the left and right sticks and L2/R2 buttons.

1 comment:

  1. hey...it wont let me add the constants (i think thats what its called) for the L2/R2 Buttons .....please help?