ArianeSoft Forums

ArianeSoft Forums (http://forums.arianesoft.ca//index.php)
-   Code sharing (http://forums.arianesoft.ca//forumdisplay.php?f=33)
-   -   GSensor access for HTC devices (http://forums.arianesoft.ca//showthread.php?t=1595)

zehlein 01-24-2009 10:39 PM

GSensor access for HTC devices
 
1 Attachment(s)
I'm currently playing around with the GSensor (acceleration sensor) of my HTC Touch Diamond using a code that was provided by Berunin in this thread.
I changed the code a bit to have it working flawlessly and it is measuring the acceleration forces quite nicely now. You find the source in the attached file.

BERUNIN 01-25-2009 06:12 AM

Good Work Zehlein !!
I like it .. ;)
Perfect speed !! .)

Berunin

kornalius 01-25-2009 07:36 PM

Great stuff. Thank you very much for your efforts.

Mike Halliday 03-02-2009 02:00 PM

This is great! - Just got my Touch Diamond and tried the code. Works like a charm.

Many thanks zehlein & berunin;

Mike.

Mike Halliday 03-02-2009 02:18 PM

OK, I maybe doing something wrong, but i have added the code to one of my programs, and cant get my head around the movement readings;

If I hold the phone vertically with the screen facing me and move up and down I expected the Y values to increase (UP) and decrease (DOWN) - I take it that this is not how it works?

Do you have any pointers on how to read sensible data from the accelerometers? - Do I need to MODULUS the numbers or something?

Any help greatly welcome! :)

Cheers

Mike

zehlein 03-02-2009 04:54 PM

Tilting left and right is measured by AccX, up and down movements by AccY. Lying flat, face up should result in AccX and AccY being zero.
There is something essential about the sensorpolling you should bear in mind: if you poll too frequently (say time between polls < 40ms) the sensor "freezes" and you get always the same results, even though the device is moved. The same applies if GameAPI uses too much processing time. Just play with the InitGameAPIEx values to get it to work.

Mike Halliday 03-02-2009 05:10 PM

Hee hee,

I need eyes that work really quick for this.

I cant see what values I have on the screen when I move the phone up and down in front of me! - I need slo-mo vision I think.

Will have a re-think on this one and see if I can work out Max and Min values maybe for each axis.

Thanks for the response :)

Mike.

zehlein 03-02-2009 05:17 PM

The values should reach from -1000 to +1000 for each axis, approximately (for just tilting). It depends a bit on the calibration of the sensor.

Mike Halliday 03-02-2009 05:25 PM

hhhmm, could be that then. maybe I will have a go at re-calibrating the sensor :)

Mike Halliday 03-03-2009 04:58 PM

Telemetry and PPL
 
Right, I think I have figured this out.

I re-aligned my gsensor, but the test program still jumps between numbers, I do not get a constant reading, even when the phone is laid flat on the desk.

I am going to try something a little more convention now instead of trying something that was harder than I initially thought.

Something good will be released when I have it polished! :)

M.


All times are GMT. The time now is 02:34 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (c) ArianeSoft Inc.