×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    21

    aXYZ source code

    Sorry to raise this topic up again..
    I'm currently working on accelerometer sampling on N95 device. I wonder is there any source code available for the aXYZ module such that I can modify the sampling rate, accuracy and so on?


    Best wishes,
    Yi

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: aXYZ source code

    Quote Originally Posted by wangyi View Post
    I'm currently working on accelerometer sampling on N95 device. I wonder is there any source code available for the aXYZ module such that I can modify the sampling rate, accuracy and so on?
    The native pyS60 Sensor API is available and works great, so you don't necessary need to use aXYZ == no need to worry about how to get aXYZ installed. Sensor API gives you raw sensor data, so you can "modify the sampling rate, accuracy and so on". Actually you have to, since raw data is too fast and too "jumpy".

    You might want to write your own sensor handler, most likely inherited from EventFilter class. However I have never seen any sample code nor I have had time to write one myself. When I do have time, I will ... check what would be the most useful thing I can do 1) in available time 2) in current location 3) with whatever I have with me. Quite often that is 10 minutes brainstorm with pen and paper

    Even though implementing an EventFilter is quite easy, the difficulty lies in designing filtering method. If you come up with something useful, please let us know, too?

    To get you started, here's what I'm using now. It's nothing fancy, the result also isn't exactly what I want, but it's reasonably fast and stabilizes the output just enough not to bother me any further:

    Code:
        # Try to stabilize movement
        global s_count, s_data1, s_data2
        if s_count < 2:
            s_count += 1
            s_data1 += a_data['data_1']
            s_data2 += a_data['data_2']
            return
    
        g_moving = True
    
        data_1 = s_data1 / s_count
        data_2 = s_data2 / s_count
        s_data1 = s_data2 = s_count = 0
        # End of stabilize
    Cheers,

    --jouni

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    21

    Re: aXYZ source code

    Thanks quite a lot for your reply JOM.
    My original thought is to lower down the sample rate in order to save battery life.
    With aXYZ module the accelerometer can only run for 5-6 hours and the phone battery will die. That's why I'm looking for a way to slow down the accelerometer and hence extend the battery life.

    Thanks,
    Yi

  4. #4
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: aXYZ source code

    Quote Originally Posted by wangyi View Post
    My original thought is to lower down the sample rate in order to save battery life.
    With aXYZ module the accelerometer can only run for 5-6 hours and the phone battery will die. That's why I'm looking for a way to slow down the accelerometer and hence extend the battery life.
    Hmph,

    I don't think you can modify chip parameters. Without that you'll always get all raw events from hardware, no matter whether you use aXYZ or Sensor API.

    With custom filter you can control other parts of your sw i.e. reduce amount of heavy calculations, disk access, screen update. That should help a bit, but not too much.

    Btw one thing, thanx to aaaaapo: when your app loses focus, you can shutdown Sensor API! I checked with Nokia Energy Profiler and it does save power, sample usage is available in here:

    http://jouni.miettunen.googlepages.com/rol-a-bol

    Idea: would have to time this first, but if (big IF) Sensor API shutdown and restart doesn't take too long time, maybe this operation could be done couple times a sec? If those operations are fast enough, on/off trick might give you few hours more power I recall raw data sample rate was above 60 times a sec, maybe over 100. It was too much for my need, so I never measured it.

    Phone CPU does the same trick. When no activity has been detected for certain time period, it goes into sleep mode. Checks only several times a sec, whether something is happening and whether it should wake up.

    Cheers,

    --jouni

  5. #5
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Re: aXYZ source code

    Quote Originally Posted by wangyi View Post
    Thanks quite a lot for your reply JOM.
    My original thought is to lower down the sample rate in order to save battery life.
    With aXYZ module the accelerometer can only run for 5-6 hours and the phone battery will die. That's why I'm looking for a way to slow down the accelerometer and hence extend the battery life.

    Thanks,
    Yi
    May be you could change the monitoring rate!

    Contact Cyke64 : Father of Axyz, he will surely help you.

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

Similar Threads

  1. Automatic code signing for open source J2ME Apps?
    By gagravarr in forum Series 40 & S60 Platform Feedback Archive
    Replies: 3
    Last Post: 2008-05-12, 06:09
  2. carbide.vs: Bug in invocation of mwccsym2.exe?
    By timosteuerwald in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2006-12-05, 15:14
  3. problem viewing variable values when debugging
    By jas203 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2006-03-25, 22:37
  4. Link errors when trying to Display bitmap
    By Bkc82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-01-16, 22:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×