Reply
Thread Tools
Flandry's Avatar
Posts: 1,558 | Thanked: 1,773 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; 07-13-2010 at 05:43 PM. Reason: New supported games, feature request; how-to for editing conf
 

The Following 37 Users Say Thank You to Flandry For This Useful Post:
Posts: 2,014 | Thanked: 1,578 times | Joined on Sep 2009
#2
Let me be the first to say - HUZZAH!
__________________
Class .. : Power Poster, Potential Coder
Humor .. : [*********] Alignment: Chaotic Evil
Patience : [***-------] Weapon(s): +2 Logic Mace
Agro ... : |*****-----] Relic(s) : G1, N900

 
Flandry's Avatar
Posts: 1,558 | Thanked: 1,773 times | Joined on Oct 2009 @ Boston
#3
Initial proof-of-concept package uploaded. It seems to set up the driver correctly and was tested to work with PrBoom (you need to enable the joystick in the PrBoom menu.)

The way it works right now is through a toggle, implemented as a startup script and a file called ~/accelemymote/live-trigger, that gets the daemon running. It will continue to run, consuming about 0.8% CPU cycles, until you restart or delete the trigger file.

You can delete the trigger file by clicking the app icon again. If in doubt whether it is running, you can run top and see if the process shows up.

It's probably more sensible to run it from the command line for now:
/opt/maemo/usr/bin/accelemymote.sh

Let me know if it works for you. There is a lot left to do before it's ready for mainstream, but i want to be sure the module and driver installation is working.

Edit: i tried it with uqm and it's way too spammy with events to work well there right now.
__________________

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; 02-23-2010 at 06:38 AM.
 

The Following User Says Thank You to Flandry For This Useful Post:
Posts: 999 | Thanked: 1,117 times | Joined on Dec 2009 @ earth?
#4
Great work all we need now is a flight simulator...or a port of Descent!
__________________
I like cake.
 
Posts: 147 | Thanked: 31 times | Joined on Sep 2009
#5
i just tried it with prboom and it's working, so good job for this
But the problem is that is nearly impossible to play with it because of the settings of the accelerometer
Would it be possible to config accelemymote without going to ~/.accelemymote/main.cfg ? I'm really a end user and if config woul be possible from the application it would be much more friendly
anyway, it's just the 0.1 so we can expectgood things for the 0.2
 

The Following User Says Thank You to tangs For This Useful Post:
F2thaK's Avatar
Posts: 4,365 | Thanked: 2,426 times | Joined on Jan 2010 @ Australia Mate
#6
actually it installs mostlly but i get an error during install, icon is in menu........I run app, it closes and I dont see it in top

Last edited by F2thaK; 02-23-2010 at 10:36 AM.
 

The Following User Says Thank You to F2thaK For This Useful Post:
Flandry's Avatar
Posts: 1,558 | Thanked: 1,773 times | Joined on Oct 2009 @ Boston
#7
Thanks for testing.

Originally Posted by f2thak View Post
actually it installs mostlly but i get an error during install, icon is in menu........I run app, it closes and I dont see it in top
What kind of error did it give you?

tangs: The config file is a first step. Version 0.0.0 didn't have any options at all. What is it about the accelerometer setup that you find hard to control?
__________________

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
 
Bundyo's Avatar
Posts: 4,177 | Thanked: 2,822 times | Joined on Oct 2007 @ Bulgaria
#8
Someone tried to port Descent 1 to OpenGL ES, couldn't get it running though.
__________________
Technically, there are three determinate states the cat could be in: Alive, Dead, and Bloody Furious.
 
Flandry's Avatar
Posts: 1,558 | Thanked: 1,773 times | Joined on Oct 2009 @ Boston
#9
I looked at Descent 1 and 2 but they suffer from the same problem as other commercial games with open engine and closed data: you can't distribute the content via the repos so it can never be end-user friendly. That was enough to discourage me from putting more time into it. It seems like the shareware version might be ok to distribute, though, so maybe there was something else to it. I really should keep notes.

Descent 1 in its original incarnation could certainly have run on the N900 without GLES acceleration--in fact, there was a descent port for an earlier version of maemo iirc.

So far i have one report of success and one of failure at getting this package to work. Anyone else?
__________________

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
 
Posts: 21 | Thanked: 4 times | Joined on Jan 2010 @ Germany
#10
I'm a bit scared because a friend of mine installed some joydev kernel and after rebooting phone it was totally bricked so he needed to flash it... so any more reports of some brave people in here??
 

The Following User Says Thank You to Lobi_Earl For This Useful Post:
Reply

Tags
accelerometer, analog input, game controls, joystick, menu selection, mouse please, tilt

Thread Tools

 
Forum Jump


All times are GMT -4. The time now is 09:52 AM.