Line 48... |
Line 48... |
48 |
"i2c-2\ti2c \ti915 gmbus panel \tI2C adapter\r\n", |
48 |
"i2c-2\ti2c \ti915 gmbus panel \tI2C adapter\r\n", |
49 |
"i2c-3\ti2c \ti915 gmbus dpc \tI2C adapter\r\n", |
49 |
"i2c-3\ti2c \ti915 gmbus dpc \tI2C adapter\r\n", |
50 |
"i2c-4\ti2c \ti915 gmbus dpb \tI2C adapter\r\n", |
50 |
"i2c-4\ti2c \ti915 gmbus dpb \tI2C adapter\r\n", |
51 |
"i2c-5\ti2c \ti915 gmbus dpd \tI2C adapter\r\n", |
51 |
"i2c-5\ti2c \ti915 gmbus dpd \tI2C adapter\r\n", |
52 |
"i2c-6\ti2c \tDPDDC-B \tI2C adapter\r\n", |
52 |
"i2c-6\ti2c \tDPDDC-B \tI2C adapter\r\n", |
53 |
"i2c-7\ti2c \ti2c-tiny-usb at bus 001 device 008\tI2C adapter\r\n" |
53 |
"i2c-7\ti2c \ti2c-tiny-usb at bus 001 device 025\tI2C adapter\r\n" |
54 |
] |
54 |
] |
55 |
} |
55 |
} |
56 |
], |
56 |
], |
57 |
"prompt_number": 27 |
57 |
"prompt_number": 1 |
58 |
}, |
58 |
}, |
59 |
{ |
59 |
{ |
60 |
"cell_type": "markdown", |
60 |
"cell_type": "markdown", |
61 |
"metadata": {}, |
61 |
"metadata": {}, |
62 |
"source": [ |
62 |
"source": [ |
Line 86... |
Line 86... |
86 |
"port = 7" |
86 |
"port = 7" |
87 |
], |
87 |
], |
88 |
"language": "python", |
88 |
"language": "python", |
89 |
"metadata": {}, |
89 |
"metadata": {}, |
90 |
"outputs": [], |
90 |
"outputs": [], |
91 |
"prompt_number": 28 |
91 |
"prompt_number": 2 |
92 |
}, |
92 |
}, |
93 |
{ |
93 |
{ |
94 |
"cell_type": "markdown", |
94 |
"cell_type": "markdown", |
95 |
"metadata": {}, |
95 |
"metadata": {}, |
96 |
"source": [ |
96 |
"source": [ |
Line 110... |
Line 110... |
110 |
"import numpy as np" |
110 |
"import numpy as np" |
111 |
], |
111 |
], |
112 |
"language": "python", |
112 |
"language": "python", |
113 |
"metadata": {}, |
113 |
"metadata": {}, |
114 |
"outputs": [], |
114 |
"outputs": [], |
115 |
"prompt_number": 29 |
115 |
"prompt_number": 3 |
116 |
}, |
116 |
}, |
117 |
{ |
117 |
{ |
118 |
"cell_type": "markdown", |
118 |
"cell_type": "markdown", |
119 |
"metadata": {}, |
119 |
"metadata": {}, |
120 |
"source": [ |
120 |
"source": [ |
Line 176... |
Line 176... |
176 |
}, |
176 |
}, |
177 |
{ |
177 |
{ |
178 |
"cell_type": "markdown", |
178 |
"cell_type": "markdown", |
179 |
"metadata": {}, |
179 |
"metadata": {}, |
180 |
"source": [ |
180 |
"source": [ |
- |
|
181 |
"\u010cten\u00ed dat z akcelerometru\n", |
- |
|
182 |
"-------------------------\n", |
- |
|
183 |
"\n", |
181 |
"Nyn\u00ed u\u017e m\u016f\u017eeme p\u0159\u00edmo komunikovat se za\u0159\u00edzen\u00edm pojmenovan\u00fdm jako acc." |
184 |
"Nyn\u00ed u\u017e m\u016f\u017eeme p\u0159\u00edmo komunikovat se za\u0159\u00edzen\u00edm pojmenovan\u00fdm jako acc." |
182 |
] |
185 |
] |
183 |
}, |
186 |
}, |
184 |
{ |
187 |
{ |
185 |
"cell_type": "code", |
188 |
"cell_type": "code", |
Line 226... |
Line 229... |
226 |
}, |
229 |
}, |
227 |
{ |
230 |
{ |
228 |
"cell_type": "markdown", |
231 |
"cell_type": "markdown", |
229 |
"metadata": {}, |
232 |
"metadata": {}, |
230 |
"source": [ |
233 |
"source": [ |
- |
|
234 |
"Kalibrace akcelerometru\n", |
- |
|
235 |
"-----------------------\n", |
- |
|
236 |
"\n", |
231 |
"Nam\u011b\u0159en\u00e1 data m\u016f\u017eeme tak\u00e9 z\u00edskat z p\u0159edem ulo\u017een\u00e9ho souboru. V n\u00e1sleduj\u00edc\u00edm bloku je otev\u0159en soubor s referen\u010dn\u00edmi daty, kter\u00fd se nach\u00e1z\u00ed v dokumenta\u010dn\u00ed slo\u017ece mudulu IMU01A. " |
237 |
"Nam\u011b\u0159en\u00e1 data m\u016f\u017eeme tak\u00e9 z\u00edskat z p\u0159edem ulo\u017een\u00e9ho souboru. V n\u00e1sleduj\u00edc\u00edm bloku je otev\u0159en soubor s referen\u010dn\u00edmi daty, kter\u00fd se nach\u00e1z\u00ed v dokumenta\u010dn\u00ed slo\u017ece mudulu IMU01A. \n" |
232 |
] |
238 |
] |
233 |
}, |
239 |
}, |
234 |
{ |
240 |
{ |
235 |
"cell_type": "code", |
241 |
"cell_type": "code", |
236 |
"collapsed": false, |
242 |
"collapsed": false, |
Line 418... |
Line 424... |
418 |
} |
424 |
} |
419 |
], |
425 |
], |
420 |
"prompt_number": 26 |
426 |
"prompt_number": 26 |
421 |
}, |
427 |
}, |
422 |
{ |
428 |
{ |
- |
|
429 |
"cell_type": "markdown", |
- |
|
430 |
"metadata": {}, |
- |
|
431 |
"source": [ |
- |
|
432 |
"\u010cten\u00ed dat z gyroskopu\n", |
- |
|
433 |
"---------------------\n", |
- |
|
434 |
"\n" |
- |
|
435 |
] |
- |
|
436 |
}, |
- |
|
437 |
{ |
- |
|
438 |
"cell_type": "code", |
- |
|
439 |
"collapsed": false, |
- |
|
440 |
"input": [ |
- |
|
441 |
"cfg = config.Config(\n", |
- |
|
442 |
" i2c = {\n", |
- |
|
443 |
" \"port\": port,\n", |
- |
|
444 |
" },\n", |
- |
|
445 |
"\n", |
- |
|
446 |
"\tbus = [\n", |
- |
|
447 |
"\t\t{\n", |
- |
|
448 |
" \"type\": \"i2chub\",\n", |
- |
|
449 |
" \"address\": 0x72,\n", |
- |
|
450 |
" \n", |
- |
|
451 |
" \"children\": [\n", |
- |
|
452 |
" {\"name\": \"gyro\", \"type\": \"imu01_gyro\", \"channel\": 0, }\n", |
- |
|
453 |
" ],\n", |
- |
|
454 |
"\t\t},\n", |
- |
|
455 |
"\t],\n", |
- |
|
456 |
")\n", |
- |
|
457 |
"\n", |
- |
|
458 |
"cfg.initialize()\n", |
- |
|
459 |
"#acc = cfg.get_device(\"acc\")\n", |
- |
|
460 |
"gyro = cfg.get_device(\"gyro\")\n", |
- |
|
461 |
"sys.stdout.write(\" MLAB accelerometer sensor IMU01A module example \\r\\n\")\n", |
- |
|
462 |
"time.sleep(0.5)\n", |
- |
|
463 |
"gyro.route()" |
- |
|
464 |
], |
- |
|
465 |
"language": "python", |
- |
|
466 |
"metadata": {}, |
- |
|
467 |
"outputs": [ |
- |
|
468 |
{ |
- |
|
469 |
"output_type": "stream", |
- |
|
470 |
"stream": "stderr", |
- |
|
471 |
"text": [ |
- |
|
472 |
"WARNING:pymlab.sensors.iic:HID device does not exist, we will try SMBus directly...\n" |
- |
|
473 |
] |
- |
|
474 |
}, |
- |
|
475 |
{ |
- |
|
476 |
"output_type": "stream", |
- |
|
477 |
"stream": "stdout", |
- |
|
478 |
"text": [ |
- |
|
479 |
" MLAB accelerometer sensor IMU01A module example \r\n" |
- |
|
480 |
] |
- |
|
481 |
}, |
- |
|
482 |
{ |
- |
|
483 |
"metadata": {}, |
- |
|
484 |
"output_type": "pyout", |
- |
|
485 |
"prompt_number": 4, |
- |
|
486 |
"text": [ |
- |
|
487 |
"True" |
- |
|
488 |
] |
- |
|
489 |
} |
- |
|
490 |
], |
- |
|
491 |
"prompt_number": 4 |
- |
|
492 |
}, |
- |
|
493 |
{ |
- |
|
494 |
"cell_type": "code", |
- |
|
495 |
"collapsed": false, |
- |
|
496 |
"input": [ |
- |
|
497 |
"import sys\n", |
- |
|
498 |
"import time\n", |
- |
|
499 |
"from IPython.display import clear_output\n", |
- |
|
500 |
"\n", |
- |
|
501 |
"MEASUREMENTS = 100\n", |
- |
|
502 |
"list_meas = []\n", |
- |
|
503 |
"# acc.route() V p\u0159\u00edpad\u011b v\u00edce \u010didel je pot\u0159eba ke ka\u017ed\u00e9mu p\u0159ed jeho pou\u017eit\u00edm nechat vyroutovat cesutu na sb\u011brnici.\n", |
- |
|
504 |
"\n", |
- |
|
505 |
"for n in range(MEASUREMENTS):\n", |
- |
|
506 |
" clear_output()\n", |
- |
|
507 |
" (x, y, z) = gyro.axes()\n", |
- |
|
508 |
" list_meas.append([x, y, z])\n", |
- |
|
509 |
" print (n, list_meas[n])\n", |
- |
|
510 |
" sys.stdout.flush()" |
- |
|
511 |
], |
- |
|
512 |
"language": "python", |
- |
|
513 |
"metadata": {}, |
- |
|
514 |
"outputs": [ |
- |
|
515 |
{ |
- |
|
516 |
"output_type": "stream", |
- |
|
517 |
"stream": "stdout", |
- |
|
518 |
"text": [ |
- |
|
519 |
"(99, [195, -118, 7])\n" |
- |
|
520 |
] |
- |
|
521 |
} |
- |
|
522 |
], |
- |
|
523 |
"prompt_number": 5 |
- |
|
524 |
}, |
- |
|
525 |
{ |
- |
|
526 |
"cell_type": "code", |
- |
|
527 |
"collapsed": false, |
- |
|
528 |
"input": [ |
- |
|
529 |
"measurements = np.array(list_meas)\n", |
- |
|
530 |
"\n", |
- |
|
531 |
"%pylab qt\n", |
- |
|
532 |
"plt.subplot(1, 1, 1)\n", |
- |
|
533 |
"plt.plot(measurements[:, 0])\n", |
- |
|
534 |
"plt.plot(measurements[:, 1])\n", |
- |
|
535 |
"plt.plot(measurements[:, 2])\n", |
- |
|
536 |
"plt.xlabel('sample number')\n", |
- |
|
537 |
"plt.ylabel('ADC')\n", |
- |
|
538 |
"plt.title('Raw sensors')" |
- |
|
539 |
], |
- |
|
540 |
"language": "python", |
- |
|
541 |
"metadata": {}, |
- |
|
542 |
"outputs": [ |
- |
|
543 |
{ |
- |
|
544 |
"output_type": "stream", |
- |
|
545 |
"stream": "stdout", |
- |
|
546 |
"text": [ |
- |
|
547 |
"Populating the interactive namespace from numpy and matplotlib\n" |
- |
|
548 |
] |
- |
|
549 |
}, |
- |
|
550 |
{ |
- |
|
551 |
"metadata": {}, |
- |
|
552 |
"output_type": "pyout", |
- |
|
553 |
"prompt_number": 6, |
- |
|
554 |
"text": [ |
- |
|
555 |
"<matplotlib.text.Text at 0x7f5b38053450>" |
- |
|
556 |
] |
- |
|
557 |
} |
- |
|
558 |
], |
- |
|
559 |
"prompt_number": 6 |
- |
|
560 |
}, |
- |
|
561 |
{ |
- |
|
562 |
"cell_type": "code", |
- |
|
563 |
"collapsed": false, |
- |
|
564 |
"input": [ |
- |
|
565 |
"help(map)" |
- |
|
566 |
], |
- |
|
567 |
"language": "python", |
- |
|
568 |
"metadata": {}, |
- |
|
569 |
"outputs": [ |
- |
|
570 |
{ |
- |
|
571 |
"output_type": "stream", |
- |
|
572 |
"stream": "stdout", |
- |
|
573 |
"text": [ |
- |
|
574 |
"Help on built-in function map in module __builtin__:\n", |
- |
|
575 |
"\n", |
- |
|
576 |
"map(...)\n", |
- |
|
577 |
" map(function, sequence[, sequence, ...]) -> list\n", |
- |
|
578 |
" \n", |
- |
|
579 |
" Return a list of the results of applying the function to the items of\n", |
- |
|
580 |
" the argument sequence(s). If more than one sequence is given, the\n", |
- |
|
581 |
" function is called with an argument list consisting of the corresponding\n", |
- |
|
582 |
" item of each sequence, substituting None for missing values when not all\n", |
- |
|
583 |
" sequences have the same length. If the function is None, return a list of\n", |
- |
|
584 |
" the items of the sequence (or a list of tuples if more than one sequence).\n", |
- |
|
585 |
"\n" |
- |
|
586 |
] |
- |
|
587 |
} |
- |
|
588 |
], |
- |
|
589 |
"prompt_number": 10 |
- |
|
590 |
}, |
- |
|
591 |
{ |
423 |
"cell_type": "code", |
592 |
"cell_type": "code", |
424 |
"collapsed": false, |
593 |
"collapsed": false, |
425 |
"input": [], |
594 |
"input": [], |
426 |
"language": "python", |
595 |
"language": "python", |
427 |
"metadata": {}, |
596 |
"metadata": {}, |