Compass in G1. - G1 Q&A, Help & Troubleshooting

Hey,
For an application I am writing, I need to know the exact orientation of the phone in a specified point of time. Such data can be extracted from a Gyroscope sensor - but as far as I understood, there is no gyroscope in G1.
Nevertheless, I do know that it has a gravity sensor, and I downloaded an application which works as a compass - I believe the combination of gravity information and compass should be enough for me to tell the exact 3D orientation of the phone.
My question is, how did that application get the data for the orientation of the phone, in order to display the direction of north? I couldn't find a working sensor for G1 which gives that data.
Thank you very much in advance and have a nice day,
Ron.

Related

Tilt Sensor Not-Quite-SDK

I contacted HTC and asked them if they had a tilt sensor SDK, or had plans to release one, and they basically said "no". So, I decided to see what I could come up with to get tilt response integrated into my little pet-project, and to my surprise, managed to figure out how to get some basic data out of the existing tilt sensor DLL on the Diamond.
If you'd like, you can see my "hello world"-level app using the tilt sensor here on my blog. I've included the source so others can play with the few tidbits I've figured out. The app itself is pretty boring, it'll really only be of interest to developers looking to integrate tilt into their app, and even then, it's still a boring app =)
If accessing the tilt sensor is well known, feel free to ignore me.
Well done, thats great!
You should also probably look at this and talk to CharlyV, he might be able to add some info.
http://forum.xda-developers.com/showthread.php?t=403939
That's great news !
Now developers might use such information to release usefull applications and funny games !
Yes, I was wondering, for my car I use the G-tech for acceleration-measurement.
Is this sensor sensitive / good enough to also do those kind of things?
Also, navigation programs can be a lot more precise by knowing when accelerating, cornering or braking.
Riel said:
Yes, I was wondering, for my car I use the G-tech for acceleration-measurement.
Is this sensor sensitive / good enough to also do those kind of things?
Click to expand...
Click to collapse
Good question: I might try to write some sort of logging program and see what kind of data I can get out of a car trip. That's a bit off for now.
Also, I made a minor update the project, I determined a few more of the unknown values that the API returns.
perhaps you or some other guys are capable to work with some tools mentioned in this post??
http://forum.xda-developers.com/showpost.php?p=2373447&postcount=56
Is there any chance to develop a calibration tool for this sensor?? Mine drifts to lower-left and thats annoying because Opera always means, I rotate my phone :-(
Thank you
I updated the project to include a sample of how to use the event driven notification of different orientations that Opera uses (instead of polling the sensor constantly to determine the current orientation).
I'll have to do some digging to see if there's any way to calibrate the sensor. It'd be nice (mine is a bit off too), but I don't see anything immediatly obvious.
Perfect news!
I hope there are devs, who will make apps or games for this. My idea of a new game is "Black Circle".
(Side in German bug game in English, dont worry)
http://spiele.isnichwahr.de/r432-spin-the-black-circle.html
What do you tink about it?
I wrote a managed wrapper based on Scott's work:
http://blog.enterprisemobile.com/2008/07/using-htc-diamonds-sensor-sdk-from-managed-code/
I think it would be possible to calibrate the sensor by replacing the HTCSensorSDK.dll with one that acts as a pass through to the real thing. Then it could "massage" the returned values with calibration adjustments.
Teeter -> HTCSensorSDK.dll (one we roll that tweaks values) -> RealHTCSensorSDK.dll (the real DLL)
I don't think that the DLL is replaceable unless the device is flashed with a new ROM.
Thoughts?

Establish standard for G-Sensor calibration

Here is an idea: a lot of people are unhappy about the fact that their G-Sensor is out of alignment, and that this may negatively affect apps which may be developed in the future (or which are already under developemnt) and which rely on the sensor for something critical. Though my device does not suffer from this, I can fully understand them!
However, today the only app which uses the sensor is Teeter, for which - frankly - this mis-alignment is not a huge issue! The reason I say this is that this app would fall outside of what I propose below...
So, here is my idea: why don't we set up a simple standard for the G-Sensor calibration, to be stored in the registry in a dedicated set of keys, and develop a quick and simple application to calibrate it and store the values in there (much like was done in BubbleLevel)?
As long as all developers here agree to use these values and stick to the standard... voila! We can all have a calibrated G-Sensor, which any future program will know how to read correctly (by correcting the values it gets with the offsets stored in the Registry to get a perfect reading).
What do you people think (especially all you developers out there)? Anyone care to volunteer a registry location and some key names?
That would be really great
that's exactly what we need...
Instead of using HTCSensorSDK.dll we could create a HTCCalibratedSensorSDK.dll (for example )
Exactly same interface, but calibrated... The developers only would have to change their dll names...
I did the day before a such dll for testing purposes, and its really simple (I even successed in 'calibrating' teeter when overwriting the original one..).
I think this is the thing we have to do...
Other inputs?
Sven
g-sensor not working
after i installed gsen my g-sensor dont work! when i try to play teeter the ball is stuck up and only moves left to right. also it opens my ktcalbum upside down. can the touchflo be reinstalled maybe? any idea?
svenso said:
that's exactly what we need...
Instead of using HTCSensorSDK.dll we could create a HTCCalibratedSensorSDK.dll (for example )
Exactly same interface, but calibrated... The developers only would have to change their dll names...
I did the day before a such dll for testing purposes, and its really simple (I even successed in 'calibrating' teeter when overwriting the original one..).
I think this is the thing we have to do...
Other inputs?
Sven
Click to expand...
Click to collapse
This sounds live a VERY good idea. Do I understand you correctly, that you actually have a basic version of the DLL already done???

TP2 sensors API

I know that the TP2 come with different kind of sensors (ambient light, proximity, g-sensor) and wonder if we could make the most out of them.
There are lot of programs out there which make use of the g-sensor to rotate screen and so on.
What about the ambient light and proximity sensor? I have not come across any programs using them...
When I drive for example, I listen to music using my TP2. I can't really change the tracks since I am driving. I was thinking may be the proximity
sensor could help...
Eg. 1. Waving the hand in front of the sensor would move to the next track.
2. Leaving the hand in front of the sensor after few seconds would pause the music...
These are just simple ideas and I think many of you guys reading this will come with great ideas (even for the light sensor)....
My point for this post is that does anyone have/or can create API's for these sensors (It would be great if they were in .NET compact, would make life easier for developping apps.)
I am sorry for posting this in the ROM section but I think by posting it there, it will attract the attention of the ROM cooks, who I think would have come across these sensors and might have thought of doing something special with them
29 views already but no replies....
if you know c# this is everything you need
http://sensorapi.codeplex.com/SourceControl/changeset/view/11841#
Thats nice. thanks.
It does not seem to support promity sensors though, which will be the most interesting one.
It would be great if others came up with ideas of what can be done with these sensors...
jinjav said:
29 views already but no replies....
Click to expand...
Click to collapse
Maybe if you posted in the sub-forum for Windows Mobile software development (which is what your question sounds like) you'd get more response. I don't know for sure...but people who create new apps from scratch may be different people than rom cooks.
I'll do that as well. thanks
Did you look at TouchLockPro Recently the ZoomBar is added.
TouchLockPro is open source, so you can download the source code here at sourgeforge. So you can also see how to access all those other sensors too.
The idea behind it, is that others can learn from it and also make *FREE* beautiful programs. Just make sure you adhere to the open source license and make your code also public available
this post shows the approach and source code for the ZoomBar.
ZuinigeRijder said:
Did you look at TouchLockPro Recently the ZoomBar is added.
TouchLockPro is open source, so you can download the source code here at sourgeforge. So you can also see how to access all those other sensors too.
The idea behind it, is that others can learn from it and also make *FREE* beautiful programs. Just make sure you adhere to the open source license and make your code also public available
this post shows the approach and source code for the ZoomBar.
Click to expand...
Click to collapse
Thanks for that . Does it support the proximity sensor?
jinjav said:
Thanks for that . Does it support the proximity sensor?
Click to expand...
Click to collapse
No, unfortunately not. If you know the API I am also glad to know it too

[Q] Capture a programs interactions with the system?

If this has been discussed and I have overlooked it in my searches please if you know point me in the right direction. here is an example of what I am trying to do: The sensorcalibutil_yamaha, I want to find out how it is working so I can write a very simple app kind of like the one in the Froyo ROMs but where I can input inverted values for certain axis without "calibrating" them all thus messing up other axis I want to stay the same. Then save those values like this utility does only with my input tweaked values. I have tried logcat but it does not do what I need. is there something I can do in ADB?
dono, there is a file in *deep breath*
/sys/devices/virtual/accelerometer/accelerometer/
called acc_file which is rw-r--wrx (kinda weird). It looks like it contains the current accelerometer info (if you rotate the phone it changes) but I don't have a clue where the information is being read from or what function is putting it in there.
What 'cha trying to do?
Sherpa
Invert only one axis by inputting calibration values manually so as to correct the rotation issue. In the froyo roms there is a gui to do what sensorcalibutil_yamaha does bit it reads the current sensor values and issues an "offsetUpdate" with the current values as assumed Level. But on us variants you are holding the device semi verrical part landscape to get it to sort of stay rotated vertical but doing this also updates the other axes as "level" so rotation is flaky at best with no love in games at all. So if this app reads current values and issues an update we should easly be able to write a simple app that we put our own values into and issue an update. Thus allowing us to invert only a singlw axis and make rotation work perfect.
Sent from my SAMSUNG-SGH-I897 using XDA App
We've tried swapping every file with yamaha or sensor in it to a froyo build with no luck. It looks like the garray and marray values are somewhere deep inside the kernel rather than a handy library file. If your handy with a hex editor or a soldering iron you would be a hero
Sherpa
I saw an episode on revision 3 of a show called APP JUDGEMENT where the host was doing something like that to get a reading of how much his motercycle leaned in corners not sure which episode it was but its at least 4 weeks ago
Good luck hope you succeed
TMC_Sherpa said:
We've tried swapping every file with yamaha or sensor in it to a froyo build with no luck. It looks like the garray and marray values are somewhere deep inside the kernel rather than a handy library file. If your handy with a hex editor or a soldering iron you would be a hero
Sherpa
Click to expand...
Click to collapse
I am quite good with a hex editor and an expert with a soldering iron. anyways no one really cares lol so to clarify (sorry was on my device in a vehicle so I did not feel like typing a lot) No it is not stored in a file anywhere on the system (in temp memory while it reads the values before it updates) the values in this chip are stored outside the system (often in the chips software(actual firmware of the hardware) this would explain why when erasing the system and flashing back to stock leaves your rotation messed up even with a kernel reflash. it is in the kernel where the driver interprets these values (that is why in 2.1 it can be patched like in the reorient kernel) obviously the I9000 default settings are 90deg different on one axis then ours. SO my point remains, the recalibration utility works as described above, it calls commands I believe from perhaps one of the yamaha libs, libms3c_yamaha.so? it seems to do it in this order with a couple of other steps involved: it measures the sensor readings then gets the "offset" (I think this is it calculating the offset based on the current values being assumed level) then it saves those values (temp) then it issues the update. As I said before instead of updated ALL of the values as the new "level" we want to update with manually input values to work with single axes. anyone follow? I am going to give it a go tonight and at this time wish myself luck!
btw: I tried to patch the kernel with a hex editor but could never get it to repack correctly and was mostly bootless. next step is to **** my device for good with some micro-soldering (probably not plausible from the way it looks though)
It was a joke. Sir, step away from the iron.
There is an orientation lock so there is some control over the accelerometer however I'm not sure if you can lock only one axis. If it's a .so you are looking for then it ain't stripped so there should be readable text inside.
I would need to reboot to look further but the only real function in yamaha.c is yamaha_read which does what it says on the tin.
ak8973b.c does a bunch of stuff but I'm not sure why it's even in there as I doubt there are two accelerometers http://www.asahi-kasei.co.jp/akm/en/product/ak8973nbs/ak8973nbs.html but it's included with the build.
Grr, I bookmarked the photobucket but not the link
http://s379.photobucket.com/albums/oo239/vendetta-mr2/Captivate/
*Sigh* because I'm stupid
http://s379.photobucket.com/albums/oo239/vendetta-mr2/Captivate/
If it's a yamaha sensor I don't see it anywhere but then again I don't know which one it is (Thanks Samsung) so I'm not sure what part number to look for.
I think there was a point to all this but I don't remember what it was so quick ask another question, post another comment or just say something witty, I'm sure I'll remember it sooner or later.
hey what ever works for me! besides I can always fall back on the nexus. it's easier than it sounds I'll post what I find out tonight.
BLEH! "permission denied" happen to know if the gui in the froyo build is an apk?
TouchWiz is proprietary Samsung. Eugene373 has managed to remove/work around parts of it in his Frankin-Twiz but I have not messed around with that ROM so I don't know what bits are still in there.
Well that was a big ****ing fail! oh well. Gotta go back to work tomorrow so I guess that's it for me for now. I would say maybe next time but Froyo will be released by then I hope..... I guess I will spend the rest of the evening making sure I have a modem that works in froyo jpk
Ok, I gave it one last go and I got it to do portrait correctly BUT now landscape is upside down....... but it rotates nicely.....
TMC_Sherpa said:
There is an orientation lock so there is some control over the accelerometer however I'm not sure if you can lock only one axis. If it's a .so you are looking for then it ain't stripped so there should be readable text inside.
Click to expand...
Click to collapse
I rather doubt that orientation lock has anything to do with how the accelerometer values are interpreted. It probably just forces the UI to disregard changes in orientation.
Sent from my SAMSUNG-SGH-I897 using XDA App

[Q] GPS & proximity sensor

Hey Guys,
I'm a totally newbie, i've never done coding in my life but i want to start my application android studio was a good start.
I want to make GPS location app (without maps) that uses proximity alarm on static marks that i will put before. The needs to find my location every time i open it and alarm me every time i'm near those marks. No UI needed, no buttons just a blank screen with this feature.
I appreciate any help and guidance,
Thanks.
Hi,
i've searched on google and found it!! Search exactly : "A GPS Location Plotting Android Application" ther is a codeproject page that explain an example!
Bye bye

Categories

Resources