Home User CP Donate Chat Register Today!  
  Get New posts Faq / Help?
   


Go Back   Hackint0sh > Projects and Hacks > iPhone > Applications & Development > Free Toolchain Software

Reply
 
LinkBack Thread Tools Display Modes
  #351 (permalink)  
Old 07-09-2008, 07:02 PM
saxosuper1600
Status: Offline
Senior Member
 
Join Date: Oct 2007
Location: Santiago, Chile
Posts: 221
Rep Power: 18
saxosuper1600 will become famous soon enough
Default

great job jim danner now, think this...if you want someone to help us ( the person you want to call for help never read this thread) is better to start a mini thread asking for help cause not all the people read ALL threads from ALL topics so starting a new mini thread will get more people from reading it and helping us...don't know if this understands it, anyway about the name.....if this gets official and finished some day, will be in installer, hackint0sh and who knows engadget gizmodo etc... and it will be like this "igtech for iphone LIKE THE REAL GTECH" (for example) and you'll getting free publicity. my thoughts if you want we change it....bye
__________________
Please we need help in developing an application to measure (HP, Lateral G's, Braking distance) in our cars...

http://www.hackint0sh.org/forum/show...ght=likes+cars PLEASE CODERS AND DEVELOPERS....HELP NEEDED READ POST #80 FOR MORE INFO!
THIS IS NOT AN OVERSIZED LETTER SIZE!

REP UP IF MY POST HELPED YOU IN ANY WAY!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #352 (permalink)  
Old 07-10-2008, 05:38 PM
rjshearman
Status: Offline
Senior Member
 
Join Date: Sep 2007
Posts: 370
Rep Power: 25
rjshearman will become famous soon enough
Default

Quote:
Originally Posted by Jim Danner View Post
Below is the updated calculation section of the main.js file from the Jiggy application that JuiCe was writing. This is from post #285, updated with JuiCe's comments from post #330.
  1. Start the UI, say hello to the user
  2. Tell the user to fix the phone in its position, to touch a button and to wait for 3 seconds so Calibration 1 can be done
  3. When the button is touched: start Calibration 1 by setting initializing=true and activating the measurement/calculation routine
  4. (Optional: write the result C of Calibration 1 to a plist or something, for use the next time the application is used)
  5. Tell the user to prepare for Calibration 2, a 3-second accelaration run in a straight line on a flat road, and touch a button when ready to go
  6. When the button is touched: start Calibration 2 by setting staging = true and orienting = true and activating the measurement/calculation routine
  7. (Optional: write the results ex, ey and ez of Calibration 2 to a plist for later use -- this will only be useful if the phone will be fixed to the car in exactly the same way next time)
  8. Tell the user to prepare for the actual test run and touch a button
  9. When the button is touched, start measuring by setting testing=true and activating the measurement/calculation routine
  10. Display results during the test run + a button to end the test
  11. After the test, make a graph of the measured data
Jim,

I'm still very new to iPhone development but have recently been playing with the new SDK.

The main problem I have is that I have not been accepted into the developer program yet and therefore cannot put apps on my device. So basically I am unable to actually test the Accelerometer at this time.

I have implemented the calibration routines as mentioned by you and these values will be saved for later use.

I've just found the following information in the iPhone OS Programming Guide (pdf) and wondered if this would/could change your calculations (i'm pretty lost when it comes to the maths on this project):

Isolating the Gravity Component From Acceleration Data

If you are using the accelerometer data to detect the current orientation of a device, you need to be able to filter out the portion of the acceleration data that is caused by gravity from the portion that is caused by motion of the device. To do this, you can use a low-pass filter to reduce the influence of sudden changes on the accelerometer data. The resulting filtered values would then reflect the more constant effects of gravity.

Listing 10-3 shows a simplified version of a low-pass filter. This example uses a low-value filtering factor to generate a value that uses 10 percent of the unfiltered acceleration data and 90 percent of the previously filtered value. The previous values are stored in the accelX, accelY, and accelZ member variables of the class. Because acceleration data comes in regularly, these values settle out quickly and respond slowly to sudden but short-lived changes in motion.

Code:
#define kFilteringFactor 0.1
 
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    // Use a basic low-pass filter to keep only the gravity component of each axis.
    accelX = (acceleration.x * kFilteringFactor) + (accelX * (1.0 - kFilteringFactor));
    accelY = (acceleration.y * kFilteringFactor) + (accelY * (1.0 - kFilteringFactor));
    accelZ = (acceleration.z * kFilteringFactor) + (accelZ * (1.0 - kFilteringFactor));
 
   // Use the acceleration data.
}
Isolating Instantaneous Motion From Acceleration Data

If you are using accelerometer data to detect just the instant motion of a device, you need to be able to isolate sudden changes in movement from the constant effect of gravity. You can do that with a high-pass filter.

Listing 10-4 shows a simplified high-pass filter computation. The acceleration values from the previous event are stored in the accelX, accelY, and accelZ member variables of the class. This example computes the low-pass filter value and then subtracts it from the current value to obtain just the instantaneous component of motion.

Code:
#define kFilteringFactor 0.1
 
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    // Use a basic high-pass filter to keep only the instantaneous motion component of each axis.
    accelX = acceleration.x - ( (acceleration.x * kFilteringFactor) + (accelX * (1.0 - kFilteringFactor)) );
    accelY = acceleration.y - ( (acceleration.y * kFilteringFactor) + (accelY * (1.0 - kFilteringFactor)) );
    accelZ = acceleration.z - ( (acceleration.z * kFilteringFactor) + (accelZ * (1.0 - kFilteringFactor)) );
 
   // Use the acceleration data.
}
New acceleration data is generated x amounts of time per second:

EG:
// Constant for the number of times per second (Hertz) to sample acceleration.
#define kAccelerometerFrequency 40

// Configure and start the accelerometer
[[UIAccelerometer sharedAccelerometer] setUpdateInterval1.0 / kAccelerometerFrequency)];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];

I hope more people are working on this idea (and will post here to let us know) so that we may have a working app at some point.

Cheers
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #353 (permalink)  
Old 07-10-2008, 06:41 PM
Jim Danner
Status: Offline
Respected Member
 
Join Date: Dec 2007
Posts: 1,042
Rep Power: 69
Jim Danner is a jewel in the roughJim Danner is a jewel in the roughJim Danner is a jewel in the rough
Default

Thanks. Interesting to see that this guide (by Apple?) has some thoughts about these issues. I understand more or less what they mean, but their methods surprise me a little bit.

Isolating the gravity component
This I understand, and it is not unlike what my formulas do in the first calibration run. To avoid random deviations, they take a running average of the measurements that come in over a period of time. So instead of the total of one single measurement, their result is 10% of the most recent one + 9% of the one before + 8.1% of the one before that + ... (multiply by 0.9 for the next earlier one, etc.). These percentages add up to 100, and the most recent one counts most heavily. Makes sense, if you need to know the current gravity vector but don't want it to be disturbed by random measurement error.

Isolating instantaneous motion
What they do here seems strange. The intention is to do the same as the main routine from my calculations: take the measured values and subtract gravity from them. But here they subtract a mixture of previous and current values from it, so what they take off is actually more than just gravity. Their formula reduces to (measured value - gravity)x0.9. Thus, 10% of what they want to measure is filtered away. If we do it this way, we get values that are too low. I suspect that this routine is intended for gaming applications etc. but not for precision measurements.

Great to see that you could make a real native application (as opposed to a script running under Jiggy). I assume this will enable you to read the accelerometers at much higher frequency (like the 40 times per second of the example), with better accuracy as a result. If that is the case, there may be better calculation algorithms we could use to filter out vibrations -- let's discuss this when you know the possible frequencies. Keep going!
__________________
iPhone 3GS / 3.1.2 JB (PwnageTool) / 04.26.08 carrier-locked, Carrier Logo Fixer / Cydia / 1000 posts on Hackint0sh

Installing Cydia programs on a phone that has no internet connection: read this.

Editing binary .plist, .strings, .nib and .xib files:
* on your computer: Windows tool / conversion website.
* on your iPhone: convert those files in a terminal with plutil (installed with Erica Utilities) or edit them with iFile (Cydia links).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #354 (permalink)  
Old 07-13-2008, 02:08 PM
rjshearman
Status: Offline
Senior Member
 
Join Date: Sep 2007
Posts: 370
Rep Power: 25
rjshearman will become famous soon enough
Default

Jim,

Just wanted to let you know that i'm still trying to work on this.

I've been accepted into the developer program and paid my $99 but i'm still waiting for the certificates until I can actually put it on a device?

I have the calibration routines in place (although not tested) but just wanted to check that you are happy with the following equations and i'll try and implement them:

Code:
// Calculate all the interesting values on the basis of the measurement
        var t = new Date().getTime()/1000; // The current time (since Epoch) in seconds
                // Some grouping here?  ((ex*_x)+(ey*_y)+(ex*_z))
                a = (ex*_x + ey*_y + ez*_z)/C; // The formula that puts it all together. a=forward acceleration in m/s2
        // Grouping here too maybe.. v = (lv+(la+a)*(t-lt))/2
        var v = lv + (la+a)*(t-lt)/2; // Current velocity in m/s: old velocity+(average acceleration*duration)
        var u = v*3.6; // current velocity in km/h
        var m = u*0.62137; // current velocity in MPH
        // Grouping here if you want.. d = (ld+(lv+v)*(t-lt))/2
        var d = ld + (lv+v)*(t-lt)/2; // Distance traveled, in m
        var yrd = d*1.0936; // Distance traveled, in yards (is this the customary unit?)
How accurate do you think the velocity will be?

Just to keep you busy, do you think it would be possible to work out an angle based on the current velocity? So that we may produce actual speed display on screen like a car speedometer?
EG: If you imagine a clock: 8 o'clock would be 0 KPH and 4 o'clock would be 200 KPH? The needle would then move between the two.
We would know the center spot but not sure if it's possible to work out the degree of the current velocity to show on screen? (ATan2 is used in one of the sample codes, perhaps will help?)

Seeing as this thread has had such a huge group input i'd be happy to make anything that I create FREE on the AppStore. In fact unless the Dev team come up with a way for people to distribute SDK apps outside of the App Store then I think i'd have too.

Can people do some research into this and let me know if it's possible to distribute SDK apps? (any possible workarounds)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #355 (permalink)  
Old 07-13-2008, 02:19 PM
rjshearman
Status: Offline
Senior Member
 
Join Date: Sep 2007
Posts: 370
Rep Power: 25
rjshearman will become famous soon enough
Default

What customizing settings are people after?

I'm just making a list of things to try and include:

CALIBRATION: Test 1 & Test 2

MONITOR SPEED IN: Miles Per Hour (MPH) or Kilometers Per Hour (KPH)

MONITOR DISTANCE IN: Miles (M) or Kilometers (KM)

AUTO-STOP TIMER: None, After 5 seconds, After 10 seconds, 60 KPH, 60 MPH, 100 KPH, 100 MPH
Note: The time will automatically stop when the selected option occurs. None means that the user will have to actually press "Stop" while recording.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #356 (permalink)  
Old 07-13-2008, 06:20 PM
lovemygti's Avatar
lovemygti
Status: Offline
Member
 
Join Date: Mar 2008
Posts: 61
Rep Power: 9
lovemygti will become famous soon enough
Default

good man rjshearman. I thought we had been abandoned as no one knows how to do the UI. Re your post above and wish list. I would love to see some of the following:

Speedo - either large digital (like an alarm clock) / clasic dial or an option to toggle between the 2 or have one above the other.

A pure acceleration screen - where your 0 - 60 0-100 mph's are auto displayed on screen in their own little boxes. Also a save option that saves these values and allows comments to be added. Ie ryans gti 13/07/08 wet roads

A funky g meter - which shows g's being pulled an in which direction

A top speed travelled log, which of course shows top speed travelled. If poss this part should be password protected as my wife went mental after seeing my gps as it logs current and top speed (yes it was 140mph but the roads were quiet honey, please can i have the car keys back)

A graph which can plot your last run, showing acceleration, shift patterns/times.

A before and after screen...do a run.. do your mod to the car, i.e induction kit or what ever... re run.. compare the differences all on one screen.

A calculate your actual bhp screen.. using your vehicle weight and acceleration values, it should be calculatable (if the word exists)

A settings screen, to enter vehicle weight, switch between mph / kph, toggle the background pic/skin for app, digital speedo font colour, graph settings and recalibrate

Ps i've got rolling road/dyno data from my golf, so things like bhp measurements, 0-60 runs etc can be compared from what the app says to what test equipment says. It will certainly show how accurate the app is and may help with tweaking the formulaes if you need it.

Hope it goes well, good luck and thanks in advance for your help

Last edited by lovemygti; 07-14-2008 at 12:00 AM. Reason: i can't spell
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #357 (permalink)  
Old 07-13-2008, 09:47 PM
Jim Danner
Status: Offline
Respected Member
 
Join Date: Dec 2007
Posts: 1,042
Rep Power: 69
Jim Danner is a jewel in the roughJim Danner is a jewel in the roughJim Danner is a jewel in the rough
Default

Quote:
Originally Posted by rjshearman View Post
Jim,

Just wanted to let you know that i'm still trying to work on this.

I've been accepted into the developer program and paid my $99 but i'm still waiting for the certificates until I can actually put it on a device?

I have the calibration routines in place (although not tested) but just wanted to check that you are happy with the following equations and i'll try and implement them:

Code:
...
How accurate do you think the velocity will be?

Just to keep you busy, do you think it would be possible to work out an angle based on the current velocity? So that we may produce actual speed display on screen like a car speedometer?
EG: If you imagine a clock: 8 o'clock would be 0 KPH and 4 o'clock would be 200 KPH? The needle would then move between the two.
We would know the center spot but not sure if it's possible to work out the degree of the current velocity to show on screen? (ATan2 is used in one of the sample codes, perhaps will help?)

Seeing as this thread has had such a huge group input i'd be happy to make anything that I create FREE on the AppStore. In fact unless the Dev team come up with a way for people to distribute SDK apps outside of the App Store then I think i'd have too.

Can people do some research into this and let me know if it's possible to distribute SDK apps? (any possible workarounds)
Congratulations on your acceptance to the developer program. This might be a big step towards the realization of this application, which was first proposed by saxosuper1600 eight months ago.

I would suggest you use the formulas from post # 349 above. They have been slightly modified to deal with some comments from JuiCe. (The ones you quoted were an earlier version).

Accuracy should be reasonable; we should be able to be within a few percent error on accelerations, and speeds may accumulate somewhat larger deviations over the course of a run.

For distributing applications outside the App Store, there must be an open toolchain for the new 2.0 firmware. I'm pretty sure this will come to exist (or may exist already), for example this blog post and this thread suggest that it is of interest to the right people. The open toolchain could be used to compile your code to work without any sort of DRM or restrictions. Installer and Cydia will continue to exist under the 2.0 firmware.

Working out the angle of the speed dial is easy. With the parameters you mentioned, the angle between a vertical line and the dial comes out at (u-100)*1.2 (in degrees, where positive angles are to the right and negative ones to the left). I don't know how you would actually program the displaying of such a thing; maybe you need to use different variables than an angle -- let me know.

For customization, I would like to note that power (horsepower, kW) can only be calculated (or rather, approximated) if the mass of the vehicle is known -- so there would have to be an input area for that. Making graphs of the test results would be my first thought for a real improvement, and if it were possible to zoom in on the graph and see some numbers around it (highest point, etc.), that would be interesting for the user.
__________________
iPhone 3GS / 3.1.2 JB (PwnageTool) / 04.26.08 carrier-locked, Carrier Logo Fixer / Cydia / 1000 posts on Hackint0sh

Installing Cydia programs on a phone that has no internet connection: read this.

Editing binary .plist, .strings, .nib and .xib files:
* on your computer: Windows tool / conversion website.
* on your iPhone: convert those files in a terminal with plutil (installed with Erica Utilities) or edit them with iFile (Cydia links).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #358 (permalink)  
Old 07-13-2008, 11:19 PM
jasonsmith
Status: Offline
Senior Member
 
Join Date: Jul 2007
Posts: 492
Rep Power: 27
jasonsmith is on a distinguished road
Default

You guys are hardcore, awesome dedication!
__________________
8g 1.0 OTB HW-Unlocked (took it apart) on Rogers, take that Ted!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #359 (permalink)  
Old 07-14-2008, 12:02 AM
saxosuper1600
Status: Offline
Senior Member
 
Join Date: Oct 2007
Location: Santiago, Chile
Posts: 221
Rep Power: 18
saxosuper1600 will become famous soon enough
Default

hi rjshearman welcome, first thanks for your help and all of you guys who are supporting/helping with this idea it will be an innovative app. so, second thing as jim said you need the weight of the car to know its power but can you also think of entering a field for torque? why torque....because if you know the weight of the car and torque it can be measured the RPM of the engine also!....you should also (ALL OF YOU) SEE THIS LINK !!http://www.rdrop.com/~/larry/download/formulas.pdf jim here you will find useful formulas! bye see ya guys!
__________________
Please we need help in developing an application to measure (HP, Lateral G's, Braking distance) in our cars...

http://www.hackint0sh.org/forum/show...ght=likes+cars PLEASE CODERS AND DEVELOPERS....HELP NEEDED READ POST #80 FOR MORE INFO!
THIS IS NOT AN OVERSIZED LETTER SIZE!

REP UP IF MY POST HELPED YOU IN ANY WAY!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Sponsored links Remove advertisements
Advertisement
Advertisement

  #360 (permalink)  
Old 07-14-2008, 09:53 AM
rjshearman
Status: Offline
Senior Member
 
Join Date: Sep 2007
Posts: 370
Rep Power: 25
rjshearman will become famous soon enough
Default

Quote:
Originally Posted by Jim Danner View Post
I would suggest you use the formulas from post # 349 above. They have been slightly modified to deal with some comments from JuiCe. (The ones you quoted were an earlier version).

Accuracy should be reasonable; we should be able to be within a few percent error on accelerations, and speeds may accumulate somewhat larger deviations over the course of a run.
Thanks, will take a look.
Quote:
Originally Posted by Jim Danner View Post
Working out the angle of the speed dial is easy. With the parameters you mentioned, the angle between a vertical line and the dial comes out at (u-100)*1.2 (in degrees, where positive angles are to the right and negative ones to the left). I don't know how you would actually program the displaying of such a thing; maybe you need to use different variables than an angle -- let me know.
I don't want to get too involved in this at the moment but you are right, we would need to know an "x" value and "y" value on screen (pixels) to draw a line and show the current Velocity (or any other variable in this way).

I've found some sample code which draws the second hand on an analogue clock (which may help):

Quote:
The main part of the program is the plotting of the hands. For this, we use polar co-ordinates with the origin at the center of the window and with angle starting at the twelve-o'clock position running clockwise. The semi-width or x-radius of the clock is taken to be one-third of that of the enclosing window, ie. Width/3. Consequently, the x value is given by the sum of the x co-ordinate of the center and the radius multiplied by the sine of the angle:

Code:
int x_sec = Width/2  + 
    (int)(Width/3  * Math.Sin(2 * Math.PI * (double)i_sec/60));
The angle is simply the fraction of a full circle, where 60 seconds correspond to 2 pi radians. In case of the y co-ordinate of the hand, we must take into account the fact that the 12 o'clock position is that of minimum y value, so that the cosine must be subtracted:

Code:
int y_sec = Height/2 - 
    (int)(Height/3 * Math.Cos(2 * Math.PI * (double)i_sec/60));
Anyway, leaving this alone for now.
Quote:
Originally Posted by Jim Danner View Post
For customization, I would like to note that power (horsepower, kW) can only be calculated (or rather, approximated) if the mass of the vehicle is known -- so there would have to be an input area for that. Making graphs of the test results would be my first thought for a real improvement, and if it were possible to zoom in on the graph and see some numbers around it (highest point, etc.), that would be interesting for the user.
Again, leaving this alone for the moment until we have a starting point.

Will update soon.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +2. The time now is 07:32 AM.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 Ad Management by RedTyger
follow us on Twitter!

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407