Accessing Accelerometer

30 views
Skip to first unread message

Abhinav Parashar

unread,
Feb 28, 2008, 3:13:54 AM2/28/08
to OpenIntents
Hello,
While using open intents accelerometer class, every time the
interface of accelerometer comes on screen.
I want to use the data of accelerometer in other application ....how
to do that without invoking this interface.
Can any body help me ?
Can we merge the class which 'plusminus' on anddev.org have provided
for accelerometer with open intents ??

Thanks in advance
Abhinav

friedger

unread,
Feb 28, 2008, 3:49:31 AM2/28/08
to OpenIntents
Do you mean the AcceleratorMeter on http://www.anddev.org/viewtopic.php?p=2801
?
Friedger

Peli

unread,
Feb 28, 2008, 4:04:24 AM2/28/08
to OpenIntents
Hi Abhinav,

In the OpenIntents samples folder there is the sample application
OpenGLSensors which demonstrates how to access the accelerometer. A
simple summary of the code that you have to include in your
application is given here:

http://code.google.com/p/openintents/wiki/SensorSimulator

(Note that the latest version 0.1.3 changed accessing the settings
from MAIN_ACTION to VIEW_ACTION, which has not been updated in the
latest OpenGLSensors code, but will be fixed in 0.1.3.1 by next week).

Now, the following lines of code will start the interface:

// From a button or from the menu, // start the Open Intent for the
connection settings: Intent intent = new Intent(Intent.VIEW_ACTION,
Hardware.Preferences.CONTENT_URI); startActivity(intent);

((Again, note: VIEW_ACTION was MAIN_ACTION in version 0.1.2 and
earlier)).

This is not necessary everytime your code starts, so you can comment
these 2 lines out. (Since the settings are global and one can set them
in OpenIntents/Settings directly). Then the settings screen will not
appear.

You can create a button or a menu item, and only call these two items
when the user wishes to do so.

Let me know if this helped you to answer your question, or if you had
a different question.

Peli

On 28 Feb., 09:49, friedger <fried...@googlemail.com> wrote:
> Do you mean the AcceleratorMeter onhttp://www.anddev.org/viewtopic.php?p=2801
> > Abhinav- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Abhinav Parashar

unread,
Feb 28, 2008, 4:26:40 AM2/28/08
to OpenIntents
Thanks peli , Its working ....

Peli

unread,
Feb 28, 2008, 7:42:17 AM2/28/08
to OpenIntents
Glad that it worked.

Since you also asked about connecting to a real accelerometer on
anddev.org ( http://www.anddev.org/accessing_the_accelerometer-t499-s15.html
), I answer here:

We have included the possibility to connect to a IBM Thinkpad
accelerometer through the SensorSimulator.

This works in Linux where apparently there is a patch that writes all
accelerometer data into a specific file on the hard disk:
http://nikolajbaer.us/blog/thinkpad-accelerometer/

The implementation is not complete, though, currently, if you scroll
down the settings pane (in OpenIntents 0.1.3), you can turn on
accelerometer, but it just shows you the values, without sending them
to the Android emulator.

If you have a Thinkpad and use Linux, this would be great, because
then you could test this feature.

If you have a different laptop with accelerometer, please let me also
know, since we are interested in extending the possibilities.

So, which laptop do you have, and which accelerometer do you have, and
do you know if its data is written to some file somewhere (or how else
to access the accelerometer using java?)

Peli
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -

Abhinav Parashar

unread,
Mar 3, 2008, 12:34:46 PM3/3/08
to OpenIntents
Hi peli,
I don't have IBM ThinkPad. I have an explicit
accelerometer.
http://www.xsens.com/index.php?mainmenu=products&submenu=machine_motion&subsubmenu=MTi
(Here you can find more information regarding that )
It is connected through USB to the laptop.
Can you help me in accessing this accelerometer through android
emulator.??

And one more thing ....Its fine to measue yaw,pitch, roll but what
about movements ( Like when a person walks)
there can be some performance errors i.e. traveled distance . What do
you think about it ??
Can we use accelerometer for keeping the track of a person (using some
reference points) .Is that possible ?

Regards
Abhinav






On Feb 28, 5:42 pm, Peli <peli0...@googlemail.com> wrote:
> Glad that it worked.
>
> Since you also asked about connecting to a real accelerometer on
> anddev.org (http://www.anddev.org/accessing_the_accelerometer-t499-s15.html

Peli

unread,
Mar 3, 2008, 1:11:52 PM3/3/08
to OpenIntents
Hi Abhinav,

The accelerometer looks great indeed. May I ask how much it
approximately costs?
I had a quick look at the homepage - it seems one also has to buy the
SDK (software development kit) to access that accelerometer.
Unfortunately, they don't mention Java, but C++ or VisualBasic
examples.

The simplest (although probably not most efficient) solution I can
think of is the following:
If you could write a simple C++ or VisualBasic program with your SDK
that writes the sensor data regularly into a file, I can make the
SensorSimulator read that file regularly and send the information to
the Android emulator.

Another possibility I see is to access the MT Object DLL through Java.

How do you currently access the accelerometer? (which program or
programming language do you use?)

I personally think it will be difficult to keep track of the position
of a person through accelerometer only. Probably one can do some short-
time integration to get approximate position, but anything beyond will
be very difficult.
(Just consider, an accelerometer at rest and an accelerometer at
constant speed will both give the same output, yet the devices may
move in completely different directions. Any inaccuracy during
acceleration may result in huge position differences after some time).

Peli


On Mar 3, 6:34 pm, Abhinav Parashar <parashar.i...@gmail.com> wrote:
> Hi peli,
> I don't have IBM ThinkPad. I have an explicit
> accelerometer.http://www.xsens.com/index.php?mainmenu=products&submenu=machine_moti...

Dale Thatcher

unread,
Apr 9, 2008, 6:55:36 AM4/9/08
to OpenIntents
I bet it's more expensive than a wii-mote. I've just hooked up one to
the OpenIntents sensor simulator:

http://blog.dalethatcher.com/2008/04/wii-mote-accelerometer-into-android.html

I'll do a full write up with code and details soon.

thanks,

- Dale

On Mar 3, 7:11 pm, Peli <peli0...@googlemail.com> wrote:
> Hi Abhinav,
>
> Theaccelerometerlooks great indeed. May I ask how much it
> approximately costs?
> I had a quick look at the homepage - it seems one also has to buy the
> SDK (software development kit) to access thataccelerometer.
> Unfortunately, they don't mention Java, but C++ or VisualBasic
> examples.
>
> The simplest (although probably not most efficient) solution I can
> think of is the following:
> If you could write a simple C++ or VisualBasic program with your SDK
> that writes the sensor data regularly into a file, I can make the
> SensorSimulator read that file regularly and send the information to
> the Android emulator.
>
> Another possibility I see is to access the MT Object DLL through Java.
>
> How do you currently access theaccelerometer? (which program or
> programming language do you use?)
>
> I personally think it will be difficult to keep track of the position
> of a person throughaccelerometeronly. Probably one can do some short-
> time integration to get approximate position, but anything beyond will
> be very difficult.
> (Just consider, anaccelerometerat rest and anaccelerometerat
> constant speed will both give the same output, yet the devices may
> move in completely different directions. Any inaccuracy during
> acceleration may result in huge position differences after some time).
>
> Peli
>
> On Mar 3, 6:34 pm, Abhinav Parashar <parashar.i...@gmail.com> wrote:
>
> > Hi peli,
> > I don't have IBM ThinkPad. I have an explicit
> >accelerometer.http://www.xsens.com/index.php?mainmenu=products&submenu=machine_moti...
> > (Here you can find more information regarding that )
> > It is connected through USB to the laptop.
> > Can you help me in accessing thisaccelerometerthrough android
> > emulator.??
>
> > And one more thing ....Its fine to measue yaw,pitch, roll but what
> > about movements ( Like when a person walks)
> > there can be some performance errors i.e. traveled distance . What do
> > you think about it ??
> > Can we useaccelerometerfor keeping the track of a person (using some
> > reference points) .Is that possible ?
>
> > Regards
> > Abhinav
>
> > On Feb 28, 5:42 pm, Peli <peli0...@googlemail.com> wrote:
>
> > > Glad that it worked.
>
> > > Since you also asked about connecting to a realaccelerometeron
> > > anddev.org (http://www.anddev.org/accessing_the_accelerometer-t499-s15.html
> > > ), I answer here:
>
> > > We have included the possibility to connect to a IBM Thinkpad
> > >accelerometerthrough the SensorSimulator.
>
> > > This works in Linux where apparently there is a patch that writes all
> > >accelerometerdata into a specific file on the hard disk:http://nikolajbaer.us/blog/thinkpad-accelerometer/
>
> > > The implementation is not complete, though, currently, if you scroll
> > > down the settings pane (in OpenIntents 0.1.3), you can turn on
> > >accelerometer, but it just shows you the values, without sending them
> > > to the Android emulator.
>
> > > If you have a Thinkpad and use Linux, this would be great, because
> > > then you could test this feature.
>
> > > If you have a different laptop withaccelerometer, please let me also
> > > know, since we are interested in extending the possibilities.
>
> > > So, which laptop do you have, and whichaccelerometerdo you have, and
> > > do you know if its data is written to some file somewhere (or how else
> > > to access theaccelerometerusing java?)
>
> > > Peli
>
> > > On 28 Feb., 10:26, Abhinav Parashar <parashar.i...@gmail.com> wrote:
>
> > > > Thanks peli , Its working ....
>
> > > > On Feb 28, 2:04 pm, Peli <peli0...@googlemail.com> wrote:
>
> > > > > Hi Abhinav,
>
> > > > > In the OpenIntents samples folder there is the sample application
> > > > > OpenGLSensors which demonstrates how to access theaccelerometer. A
> > > > > > > interface ofaccelerometercomes on screen.
> > > > > > > I want to use the data ofaccelerometerin other application ....how
> > > > > > > to do that without invoking this interface.
> > > > > > > Can any body help me ?
> > > > > > > Can we merge the class which 'plusminus' on anddev.org have provided
> > > > > > > foraccelerometerwith open intents ??

Peli

unread,
Apr 9, 2008, 8:23:04 AM4/9/08
to OpenIntents
WOW! Magnificent! This looks really great! Now I have a reason to buy
a Wii :-)

Peli

On Apr 9, 12:55 pm, Dale Thatcher <goo...@dalethatcher.com> wrote:
> I bet it's more expensive than a wii-mote. I've just hooked up one to
> the OpenIntents sensor simulator:
>
> http://blog.dalethatcher.com/2008/04/wii-mote-accelerometer-into-andr...

Muthu Ramadoss

unread,
Apr 9, 2008, 8:45:00 AM4/9/08
to openi...@googlegroups.com
Wonderful.. Sensor simulator in action, Nice!

Peli wrote:
> WOW! Magnificent! This looks really great! Now I have a reason to buy
> a Wii :-)
>
> Peli
>
> On Apr 9, 12:55 pm, Dale Thatcher <goo...@dalethatcher.com> wrote:
>
>> I bet it's more expensive than a wii-mote. I've just hooked up one to
>> the OpenIntents sensor simulator:
>>
>> http://blog.dalethatcher.com/2008/04/wii-mote-accelerometer-into-andr...
>>
>> I'll do a full write up with code and details soon.
>>
>> thanks,
>>
>> - Dale
>>
>> On Mar 3, 7:11 pm, Peli <peli0...@googlemail.com> wrote:
>>

--
Thanks.

Muthu Ramadoss
http://mobeegal.in http://androidrocks.in http://intellibitz.com
http://twitter.com/intellibitz http://linkedin.com/in/tellibitz
http://slideshare.net/intellibitz
http://groups.google.com/group/android-chennai
+91 44 22476750

We develop innovative search solutions using LBS for Android.

Dale Thatcher

unread,
Apr 9, 2008, 9:57:21 AM4/9/08
to OpenIntents
Unfortunately it's not a huge excuse to buy a Wii. I just bought the
controller separately (for around 25 GBP). But don't let me stop you.

- Dale

On 9 Apr, 13:23, Peli <peli0...@googlemail.com> wrote:
> WOW! Magnificent! This looks really great! Now I have a reason to buy
> a Wii :-)
>
> Peli
>
> On Apr 9, 12:55 pm, Dale Thatcher <goo...@dalethatcher.com> wrote:
>
> > I bet it's more expensive than awii-mote. I've just hooked up one to

Peli

unread,
Apr 9, 2008, 11:49:28 AM4/9/08
to OpenIntents
Really? Is it connected to PC via USB?

Oh, I just see it is bluetooth.. http://en.wikipedia.org/wiki/Wii_Remote
not bad :-)

Peli

Neel Parikh

unread,
Apr 13, 2008, 11:13:15 PM4/13/08
to OpenIntents
I commented the lines:

Intent intent = new Intent(Intent.VIEW_ACTION,
Hardware.Preferences.CONTENT_URI);
startActivity(intent);

and now i am able to see directly the accelerometer data screen on the
emulator.

Can you please tell me where in the source code is this data actually
being written. I mean some xml file where the Text value corresponds
to the accelerometer values being displayed on screen and the buttons
like "Connect", "disconnect".

I want to read the values and tehn use tehm in my application

Thanks in advance


On Apr 9, 8:49 am, Peli <peli0...@googlemail.com> wrote:
> Really? Is it connected to PC via USB?
>
> Oh, I just see it is bluetooth..http://en.wikipedia.org/wiki/Wii_Remote
Reply all
Reply to author
Forward
0 new messages