View Single Post
Flandry's Avatar
Posts: 1,559 | Thanked: 1,786 times | Joined on Oct 2009 @ Boston
#1
Accelemymote
making your accelerometer more joy-ful

Accelemymote takes input from the accelerometers in the N900 and converts it into joystick events. This makes any game that supports a generic joystick interface tilt compatible.

Games and emulators that support tilt control using Accelemymote:
  • The Ur-Quan Masters
  • PrBoom (edit cfg file for best results--see comments there
  • MAME
  • Descent
  • Mupen64plus

Status: Default profile (analog 2 axis; proximity sensor as button A) and debug implemented. As installed, works reasonably well with quite a few MAME ROMs and is okay in uqm. PrBoom works well, but requires some changes to the default config due to its poor joystick support (a separate issue that will hopefully be dealt with at some point).

With some key mapping and config tweaks (this is where you come in...), a lot of other games and MAME ROMs should work well. Please report.

Package pages:
GUI -- Found in the "System" category. Will automatically install the other package:
CLI daemon -- for those who want to invoke via scripts or xterm. You'll have to use apt to grab this by itself.

Instructions:
  1. Install accelemymote-gui package.
  2. Click icon to start app.
  3. Start game.
  4. When done playing, exit gui app to shutdown joystick driver.
You can change the settings in ~/.accelemymote/main.cfg

How to Edit Settings (for Dummies )
  1. Install leafpad from app manager
  2. Open xterm
  3. Type
    Code:
    leafpad .accelemymote/main.cfg
    . Don't miss the dot in front of accelemymote. You should get an edit window full of config file--if not, you did something wrong.
  4. Edit the values of the parameters. Possibly useful ones to edit are max_roll and max_pitch (which control the sensitivity), and deadzone, which determines what fraction of the max angles from neutral is required before joystick motion begins.
  5. Save
The values in brackets [ ] are the defaults if you want to return it to original behavior. The code below should match the contents of the file if you need to copy-paste a fix.

Zeroing the axis:
To change the baseline tilt (the neutral position) from the default of 30 degrees, click the button in the GUI and hold it at the desired neutral tilt until a banner informs you it has been calibrated (about 5 s).

Triggering that automatic calibration can also be done by changing the value of the offset_pitch in the config file to 900 and then saving. Alternatively, you can change the value to whatever angle you hold the N900 at by default (0 would be flat on a table, 90 vertical).

Config Options (main.cfg)

Code:
; Accelemymote configuration file
[Format]
version =	1
[Sampling]
samples =	2	; Samples to average for each frame 	(1-5) 		[2]
frame_rate = 	10	; Number of event-generating timesteps per second (1-30)[10]
;
; At default settings, accelemymote consumes about 1% CPU cycles at baseline frequency mode
;
[Control]
flip_pitch =	-1	; -1=> tilt forward is up; 1=> tilt forward is down 	[-1]
offset_pitch = 	30	; degrees tilt backwards to the neutral position 	[30]
; Calibration: Setting offset_pitch to 900 will cause accelemymote to 
; update it with the current pitch after 4 seconds
;
; Most games that take digital joystick inputs use some intermediate 
; value as the "on" position.
; PrBoom is a bit stupid in that it doesn't consider a direction "on"
; until the max is reached, so set these to a small value for PrBoom (~7).
max_roll =	20 	; degrees plus/minus from neutral to max out the x axis	[20]
max_pitch =	18 	; degrees plus/minus from neutral to max out the y axis	[18]
; 
deadzone =	0.10	; fraction of max angle from neutral to start joystick [0.10]
;
; Set these to 0 for PrBoom (it requires spamming of events to work well)
threshold_roll =2 	; degrees of tilt change between new x axis events [2]
threshold_pitch=2 	; degrees of tilt change between new y axis events [2]
;
profile =	analog	; control mode. Options=hat, analog, debug. 	[analog]
;
; **Not currently supported/used**
; debug: prints out messages about the events being generated. Very noisy!
; hat: a digital joystick (just on or off in each direction, a dpad or hatswitch). Not currently supported.
; analog: well, an analog joystick... the default

; Turtle makes the driver sleep when upside-down (frame_rate = .5). 
; Also, flipping the phone on its face activates/deactivates joystick events.
; 1 is enabled
; 0 is disabled
; -1 is active (start in turtle mode)

turtle = 	1	; Toggle joystick by turning the N900 upside down. [1]
proximity =	2	; Enables/configures effect of proximity sensor. [2]
; Proximity 1 makes it act like inverting the phone in turtle mode.
; Proximity 2 makes it act like a joystick button A press.

autofire0 =	0	; Enables per-frame automatic spamming of button press. [0]
; **Not currently used.**
Currently a WIP. Stay tuned.
__________________

Unofficial PR1.3/Meego 1.1 FAQ

***
Classic example of arbitrary Nokia decision making. Couldn't just fallback to the no brainer of tagging with lat/lon if network isn't accessible, could you Nokia?
MAME: an arcade in your pocket
Accelemymote: make your accelerometer more joy-ful

Last edited by Flandry; 2010-07-13 at 21:43. Reason: New supported games, feature request; how-to for editing conf
 

The Following 37 Users Say Thank You to Flandry For This Useful Post: