BUG Community

Welcome! Log In

Forums BUG SDK Virtual Bug ... Accelerometer.

Subscribe to Virtual Bug ... Accelerometer.  11 posts, 4 voices

Log in to reply to this topic
 
Mar 20, 2008 1:18am
Img_missing_medium kitplummer 7 posts

Hey guys...don't have a real BUG so I'm wondering if you can verify the behavior of the IAccelerometerSampleProvider's readSample() method?

Here's the code:



public CarTrackerWatcher (IMotionSubject motion, IAccelerometerSampleProvider accel) {
this.motion = motion;
this.accel = accel;
}

public void motionDetected() {
short [] nums = accel.readSample();
System.out.println("Motion has been detected: " + nums[0] + " : " + nums[1] + " : " + nums[2]);

}



Here's the ouput:

(: motion
Motion has been detected: 0 : 1 : 2

(:

It is kind of hard to test the physics without actual numbers for each axis...but, I can probably guess then hope that somebody can test it.

Thanks in advance. And, thanks for the recent past - for your introduction to Bug Labs and the SDK at EclipseCon.

Kit
Mar 20, 2008 6:38pm
Medium Bug Labs team jconnolly 285 posts

Hey there Kit,

I'm not sure how you want to tie the physics to the axis numbers, but I've gathered some data for you from the BUG. I can tell you that the numbers below are the result of my rotating the BUG in 3 dimensions: flat, face (with the Status bar) up, flat, face down, flat, right up (hotkey side up), flat, right down. I hope this helps.


02/04/00 06:25:14:220 666 498 488
02/04/00 06:25:14:541 663 502 490
02/04/00 06:25:14:852 662 503 491
02/04/00 06:25:15:171 667 502 491
02/04/00 06:25:15:482 662 503 490
02/04/00 06:25:15:801 663 499 489
02/04/00 06:25:16:112 664 503 489
02/04/00 06:25:16:430 663 503 491
02/04/00 06:25:16:742 666 501 491
02/04/00 06:25:17:234 662 502 488
02/04/00 06:25:17:542 662 501 489
02/04/00 06:25:17:861 663 500 491
02/04/00 06:25:18:172 661 502 492
02/04/00 06:25:18:490 661 500 489
02/04/00 06:25:18:802 663 502 488
02/04/00 06:25:19:122 662 499 490
02/04/00 06:25:19:432 662 503 491
02/04/00 06:25:19:751 661 500 488
02/04/00 06:25:20:62 665 502 489
02/04/00 06:25:20:380 663 500 488
02/04/00 06:25:20:692 664 501 491
02/04/00 06:25:21:11 661 502 491
02/04/00 06:25:21:322 662 500 490
02/04/00 06:25:21:641 663 500 490
02/04/00 06:25:22:4 663 504 489
02/04/00 06:25:22:325 663 503 487
02/04/00 06:25:22:632 664 503 491
02/04/00 06:25:22:956 663 501 491
02/04/00 06:25:23:262 666 502 489
02/04/00 06:25:23:581 662 500 491
02/04/00 06:25:23:892 665 504 487
02/04/00 06:25:24:211 660 502 492
02/04/00 06:25:24:522 659 502 492
02/04/00 06:25:24:841 664 503 492
02/04/00 06:25:25:152 664 500 489
02/04/00 06:25:25:471 661 502 491
02/04/00 06:25:25:782 667 503 490
02/04/00 06:25:26:101 660 501 490
02/04/00 06:25:26:412 658 499 490
02/04/00 06:25:26:731 665 501 488
02/04/00 06:25:27:44 669 500 491
02/04/00 06:25:27:371 663 503 490
02/04/00 06:25:27:682 662 501 488
02/04/00 06:25:28:1 664 501 490
02/04/00 06:25:28:312 665 501 489
02/04/00 06:25:28:634 662 502 491
02/04/00 06:25:28:942 661 501 491
02/04/00 06:25:29:260 663 500 491
02/04/00 06:25:29:572 662 501 489
02/04/00 06:25:29:890 664 503 491
02/04/00 06:25:30:202 662 502 488
02/04/00 06:25:30:521 664 502 491
02/04/00 06:25:30:832 664 502 487
02/04/00 06:25:31:151 664 501 488
02/04/00 06:25:31:462 662 500 489
02/04/00 06:25:31:780 663 501 493
02/04/00 06:25:32:92 663 501 491
02/04/00 06:25:32:410 663 503 489
02/04/00 06:25:32:722 662 501 489
02/04/00 06:25:33:40 663 503 490
02/04/00 06:25:33:352 662 503 489
02/04/00 06:25:33:670 661 502 490
02/04/00 06:25:33:982 664 502 491
02/04/00 06:25:34:300 663 502 489
02/04/00 06:25:34:612 664 503 491
02/04/00 06:25:34:931 663 501 488
02/04/00 06:25:35:242 662 501 489
02/04/00 06:25:35:561 663 502 490
02/04/00 06:25:35:872 663 503 489
02/04/00 06:25:36:191 663 503 490
02/04/00 06:25:36:502 661 503 489
02/04/00 06:25:36:821 663 501 487
02/04/00 06:25:37:132 664 502 492
02/04/00 06:25:37:455 662 498 487
02/04/00 06:25:37:762 662 501 491
02/04/00 06:25:38:80 663 502 491
02/04/00 06:25:38:392 663 501 493
02/04/00 06:25:38:710 663 501 490
02/04/00 06:25:39:22 665 501 488
02/04/00 06:25:39:340 663 501 489
02/04/00 06:25:39:652 663 504 490
02/04/00 06:25:39:970 662 502 490
02/04/00 06:25:40:282 663 501 493
02/04/00 06:25:40:765 663 501 490
02/04/00 06:25:41:72 661 501 492
02/04/00 06:25:41:386 664 502 490
02/04/00 06:25:41:696 664 504 490
02/04/00 06:25:42:90 663 502 490
02/04/00 06:25:42:402 664 504 486
02/04/00 06:25:42:720 661 504 489
02/04/00 06:25:43:32 663 504 493
02/04/00 06:25:43:351 663 503 491
02/04/00 06:25:43:662 663 503 491
02/04/00 06:25:43:981 662 502 491
02/04/00 06:25:44:292 663 503 490
02/04/00 06:25:44:615 664 501 487
02/04/00 06:25:44:922 662 499 490
02/04/00 06:25:45:241 663 500 490
02/04/00 06:25:45:554 666 504 487
02/04/00 06:25:45:871 664 503 490
02/04/00 06:25:46:182 661 502 491
02/04/00 06:25:46:501 661 502 491
02/04/00 06:25:46:812 664 501 493
02/04/00 06:25:47:131 663 502 488
02/04/00 06:25:47:442 663 500 488
02/04/00 06:25:47:760 662 502 490
02/04/00 06:25:48:81 662 502 487
02/04/00 06:25:48:392 663 500 489
02/04/00 06:25:48:710 663 501 489
02/04/00 06:25:49:22 663 503 490
02/04/00 06:25:49:341 664 504 490
02/04/00 06:25:49:652 660 501 488
02/04/00 06:25:49:971 662 503 488
02/04/00 06:25:50:282 663 503 490
02/04/00 06:25:50:601 665 500 486
02/04/00 06:25:50:912 664 503 492
02/04/00 06:25:51:230 663 502 489
02/04/00 06:25:51:542 663 502 489
02/04/00 06:25:51:861 662 501 491
02/04/00 06:25:52:172 663 502 491
02/04/00 06:25:52:491 663 505 490
02/04/00 06:25:52:802 663 503 489
02/04/00 06:25:53:121 663 501 492
02/04/00 06:25:53:432 662 502 489
02/04/00 06:25:53:751 662 503 490
02/04/00 06:25:54:62 663 503 492
02/04/00 06:25:54:381 662 501 488
02/04/00 06:25:54:692 666 502 490
02/04/00 06:25:55:11 665 504 491
02/04/00 06:25:55:322 663 502 488
02/04/00 06:25:55:640 659 504 493
02/04/00 06:25:55:958 668 502 487
02/04/00 06:25:56:270 668 496 489
02/04/00 06:25:56:582 655 498 493
02/04/00 06:25:56:901 688 506 499
02/04/00 06:25:57:212 688 509 500
02/04/00 06:25:57:531 663 508 408
02/04/00 06:25:57:842 667 512 410
02/04/00 06:25:58:161 655 505 491
02/04/00 06:25:58:472 653 504 496
02/04/00 06:25:58:791 647 516 485
02/04/00 06:25:59:102 647 515 484
02/04/00 06:25:59:421 656 516 440
02/04/00 06:25:59:732 657 517 441
02/04/00 06:26:00:51 665 513 547
02/04/00 06:26:00:362 665 512 546
02/04/00 06:26:00:680 649 517 418
02/04/00 06:26:00:992 647 514 416
02/04/00 06:26:01:311 667 500 511
02/04/00 06:26:01:622 667 498 512
02/04/00 06:26:01:941 660 522 500
02/04/00 06:26:02:252 660 522 501
02/04/00 06:26:02:570 661 520 476
02/04/00 06:26:02:882 661 521 477
02/04/00 06:26:03:201 688 511 432
02/04/00 06:26:03:512 688 508 432
02/04/00 06:26:03:831 470 482 343
02/04/00 06:26:04:142 470 480 341
02/04/00 06:26:04:460 472 479 337
02/04/00 06:26:04:772 473 480 337
02/04/00 06:26:05:91 472 478 336
02/04/00 06:26:05:402 472 479 337
02/04/00 06:26:05:721 473 483 332
02/04/00 06:26:06:32 476 484 333
02/04/00 06:26:06:350 475 479 336
02/04/00 06:26:06:662 476 479 333
02/04/00 06:26:07:84 474 481 335
02/04/00 06:26:07:392 475 482 337
02/04/00 06:26:07:710 474 481 334
02/04/00 06:26:08:22 473 482 336
02/04/00 06:26:08:341 474 484 336
02/04/00 06:26:08:652 474 484 336
02/04/00 06:26:08:971 470 480 335
02/04/00 06:26:09:282 473 483 337
02/04/00 06:26:09:601 471 481 336
02/04/00 06:26:09:912 472 479 338
02/04/00 06:26:10:231 478 485 339
02/04/00 06:26:10:542 481 480 335
02/04/00 06:26:10:861 482 483 333
02/04/00 06:26:11:172 484 481 335
02/04/00 06:26:11:491 500 486 330
02/04/00 06:26:11:802 497 485 334
02/04/00 06:26:12:121 487 483 333
02/04/00 06:26:12:432 486 483 335
02/04/00 06:26:12:751 485 483 334
02/04/00 06:26:13:62 486 486 333
02/04/00 06:26:13:381 482 485 334
02/04/00 06:26:13:692 484 481 334
02/04/00 06:26:14:11 486 482 329
02/04/00 06:26:14:322 482 482 330
02/04/00 06:26:14:641 635 482 410
02/04/00 06:26:14:958 634 484 413
02/04/00 06:26:15:271 660 495 468
02/04/00 06:26:15:582 659 495 470
02/04/00 06:26:15:900 657 493 476
02/04/00 06:26:16:212 658 491 475
02/04/00 06:26:16:531 661 499 467
02/04/00 06:26:16:842 662 499 466
02/04/00 06:26:17:161 569 624 465
02/04/00 06:26:17:472 569 626 469
02/04/00 06:26:17:790 514 649 481
02/04/00 06:26:18:102 511 650 480
02/04/00 06:26:18:421 512 648 487
02/04/00 06:26:18:732 513 647 484
02/04/00 06:26:19:51 513 648 486
02/04/00 06:26:19:362 513 649 483
02/04/00 06:26:19:681 512 651 487
02/04/00 06:26:19:992 510 651 485
02/04/00 06:26:20:311 511 648 486
02/04/00 06:26:20:622 514 649 488
02/04/00 06:26:20:941 544 646 489
02/04/00 06:26:21:252 541 645 491
02/04/00 06:26:21:571 654 525 480
02/04/00 06:26:21:882 655 522 480
02/04/00 06:26:22:201 662 482 476
02/04/00 06:26:22:512 665 485 476
02/04/00 06:26:22:831 662 487 477
02/04/00 06:26:23:142 661 487 478
02/04/00 06:26:23:460 601 381 454
02/04/00 06:26:23:772 600 381 455
02/04/00 06:26:24:91 473 354 464
02/04/00 06:26:24:402 472 355 465
02/04/00 06:26:24:720 482 355 472
02/04/00 06:26:25:32 483 352 475
02/04/00 06:26:25:351 486 351 480
02/04/00 06:26:25:662 487 349 479
02/04/00 06:26:25:981 493 356 479
02/04/00 06:26:26:292 491 354 481
02/04/00 06:26:26:611 500 354 474
02/04/00 06:26:26:922 502 349 476
02/04/00 06:26:27:241 498 352 479
02/04/00 06:26:27:552 498 353 481
02/04/00 06:26:27:871 510 352 481
02/04/00 06:26:28:182 509 353 481
02/04/00 06:26:28:501 655 490 483
02/04/00 06:26:28:812 657 491 486
02/04/00 06:26:29:131 664 519 487
02/04/00 06:26:29:442 665 520 479
02/04/00 06:26:29:761 666 512 484
02/04/00 06:26:30:81 669 514 480
02/04/00 06:26:30:392 662 497 485
02/04/00 06:26:30:711 644 496 513
02/04/00 06:26:31:22 651 499 512
02/04/00 06:26:31:340 513 481 643
02/04/00 06:26:31:652 515 481 646
02/04/00 06:26:32:88 479 489 638
02/04/00 06:26:32:392 480 493 639
02/04/00 06:26:32:710 476 493 639
02/04/00 06:26:33:22 475 493 635
02/04/00 06:26:33:341 477 492 639
02/04/00 06:26:33:652 473 493 640
02/04/00 06:26:33:971 470 491 636
02/04/00 06:26:34:282 469 493 637
02/04/00 06:26:34:600 476 489 639
02/04/00 06:26:34:912 475 493 641
02/04/00 06:26:35:231 627 488 558
02/04/00 06:26:35:542 624 492 563
02/04/00 06:26:35:860 663 502 477
02/04/00 06:26:36:172 665 501 475
02/04/00 06:26:36:491 670 495 482
02/04/00 06:26:36:802 667 498 481
02/04/00 06:26:37:121 666 498 483
02/04/00 06:26:37:432 666 499 483
02/04/00 06:26:37:750 666 480 502
02/04/00 06:26:38:62 666 479 503
02/04/00 06:26:38:380 665 494 498
02/04/00 06:26:38:692 667 492 496
02/04/00 06:26:39:10 637 477 496
02/04/00 06:26:39:322 638 478 496
02/04/00 06:26:39:640 652 435 501
02/04/00 06:26:39:958 650 442 501
02/04/00 06:26:40:270 659 468 511
02/04/00 06:26:40:582 651 474 503
02/04/00 06:26:40:901 659 501 514
02/04/00 06:26:41:212 659 502 514
02/04/00 06:26:41:531 662 499 507
02/04/00 06:26:41:842 659 495 504
02/04/00 06:26:42:161 669 498 505
02/04/00 06:26:42:472 665 502 503
02/04/00 06:26:42:791 655 509 514
02/04/00 06:26:43:102 668 503 500
02/04/00 06:26:43:421 663 504 504
02/04/00 06:26:43:732 662 502 506
02/04/00 06:26:44:51 663 503 505
02/04/00 06:26:44:362 662 501 507
02/04/00 06:26:44:681 662 502 507
02/04/00 06:26:44:992 662 501 505
02/04/00 06:26:45:311 660 502 507
02/04/00 06:26:45:622 663 502 504
02/04/00 06:26:45:941 661 501 505
02/04/00 06:26:46:252 661 501 505
02/04/00 06:26:46:571 660 502 506
02/04/00 06:26:46:882 660 502 506
02/04/00 06:26:47:201 661 501 504
02/04/00 06:26:47:512 663 503 508
02/04/00 06:26:47:831 661 501 506
02/04/00 06:26:48:142 660 502 507
02/04/00 06:26:48:461 663 502 505
02/04/00 06:26:48:772 663 502 505
02/04/00 06:26:49:91 661 499 508
02/04/00 06:26:49:402 663 502 509
02/04/00 06:26:49:721 662 498 507
02/04/00 06:26:50:32 662 502 505
02/04/00 06:26:50:351 661 503 506
02/04/00 06:26:50:662 663 502 505
Terminated
Mar 21, 2008 8:08pm
Img_missing_medium kitplummer 7 posts

Thanks.

What I want to do is flash the red LED on the motion module if the BUG exceeds excessive Gs (think a car tracking device that will let me know if my kid spun the tires at the stop light). I’d also like to incorporate the GPS module to track various MPHs. For example if the unit ever exceeds 70, for how long and where.

Without an actual BUG to test my math against I’m kind of stuck. So, it looks like I’ll have to get the company to buy a few (dozen). ;)

Again, thanks for the data.

Kit

Mar 21, 2008 8:18pm
Img_missing_medium kitplummer 7 posts

Hey. While I’m thinking about it – it’d be kinda cool if I could specify some argument(s) to the motion "command" given in the virtual_bug environment. Maybe a speed and direction, or options for each axis. Just an idea.

Kit

Mar 22, 2008 9:39am
Medium Bug Labs team jconnolly 285 posts

kitplummer
Hey. While I'm thinking about it - it'd be kinda cool if I could specify some argument(s) to the motion "command" given in the virtual_bug environment. Maybe a speed and direction, or options for each axis. Just an idea.

Kit


Kit,

While the com.buglabs.bug.module.motion.pub library contains classes to interact with the Accelerometer and Motion features of the BUGMotion module, the two may be thought of as separate features.

Right now the motion hardware supports simple motion detection: a motion event will be triggered when motion enters the field of detection, and another triggered when the motion stops or exits the field of detection. Unfortunately the motion module alone does not support detailed information about speed or direction. The motion command provided within the virtual bug console will, from a programmatic perspective, only provide your program with this information.

The Accelerometer module may better suit your needs for information regarding velocity (or, more precisely, change in velocity). While the motion module does not provide directional information, the accelerometer provides axis information. If you can assume the physical orientation of the module in space (say that the BUG is lying flat), then you may infer direction. Coupled with GPS functionality, the accelerometer may be useful for this purpose.

In short: the motion events are simple. Speed and direction cannot be part of the motion commands.

However, you raise a good point about the Accelerometer interface. I will provide some documentation in the wiki about how X, Y, and Z are oriented about the BUGMotion module.
Mar 22, 2008 10:51am
Medium Bug Labs team kschultz 107 posts

jconnolly

However, you raise a good point about the Accelerometer interface. I will provide some documentation in the wiki about how X, Y, and Z are oriented about the BUGMotion module.


That would be good, my main other question is what do the numbers "mean"? Are they normalized to something or are they just the raw data from the accelerometer? Are they calibrated to be consistent? The wiki says "Software selectable sensitivity (2.5g/3.3g/6.7g/10g)" but I'm not quite sure how that correlates to this data. What is the default?

Thanks,
Mar 22, 2008 12:05pm
Img_missing_medium kitplummer 7 posts

Thanks John.

I realize there motion module and the accelerometer are interfaced differently. What I was doing from my code was … don’t bother measuring the movement until there was actual motion detected. Now I understand that probably is not the best way. So, does the motion event get triggered by the accelerometer or just the "motion/visual" sensor?

Sorry for these basic questions…

Kit

Mar 22, 2008 5:36pm
Medium Bug Labs team kschultz 107 posts

The motion sensor is infrared based afaik. When the MotionDetected method is called, that is a motion from infrared side not the accelerometer side, though I think it would be difficult to cause one without the other.

Mar 22, 2008 9:26pm
Medium Bug Labs team jconnolly 285 posts

kschultz
The motion sensor is infrared based afaik. When the MotionDetected method is called, that is a motion from infrared side not the accelerometer side, though I think it would be difficult to cause one without the other.


Not necessarily. Motion may be detected by the infared sensor without the BUG unit itself being moved. Think of stationary motion sensors mounted in ceiling corners in schools, banks, etc.
Mar 23, 2008 6:59pm
Medium Bug Labs team kschultz 107 posts

Yea, I was saying the opposite, it would be difficult to get an acceleration event without getting a motion event.

Mar 24, 2008 5:03am
Medium Bug Labs team kgilmer 215 posts

Hi Kit,

Was great to meet you at EclipseCon, hope your presentation went well. You will also want to check the JavaDoc (which isn’t available right now publicly) as I’m pretty sure the units are defined there. I’m also having Angel respond (the authority) when he gets a chance.

Log in to reply to this topic