50,11 → 50,11 |
"i2c-4\ti2c \ti915 gmbus dpb \tI2C adapter\r\n", |
"i2c-5\ti2c \ti915 gmbus dpd \tI2C adapter\r\n", |
"i2c-6\ti2c \tDPDDC-B \tI2C adapter\r\n", |
"i2c-7\ti2c \ti2c-tiny-usb at bus 001 device 008\tI2C adapter\r\n" |
"i2c-7\ti2c \ti2c-tiny-usb at bus 001 device 025\tI2C adapter\r\n" |
] |
} |
], |
"prompt_number": 27 |
"prompt_number": 1 |
}, |
{ |
"cell_type": "markdown", |
88,7 → 88,7 |
"language": "python", |
"metadata": {}, |
"outputs": [], |
"prompt_number": 28 |
"prompt_number": 2 |
}, |
{ |
"cell_type": "markdown", |
112,7 → 112,7 |
"language": "python", |
"metadata": {}, |
"outputs": [], |
"prompt_number": 29 |
"prompt_number": 3 |
}, |
{ |
"cell_type": "markdown", |
178,6 → 178,9 |
"cell_type": "markdown", |
"metadata": {}, |
"source": [ |
"\u010cten\u00ed dat z akcelerometru\n", |
"-------------------------\n", |
"\n", |
"Nyn\u00ed u\u017e m\u016f\u017eeme p\u0159\u00edmo komunikovat se za\u0159\u00edzen\u00edm pojmenovan\u00fdm jako acc." |
] |
}, |
228,7 → 231,10 |
"cell_type": "markdown", |
"metadata": {}, |
"source": [ |
"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. " |
"Kalibrace akcelerometru\n", |
"-----------------------\n", |
"\n", |
"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" |
] |
}, |
{ |
420,8 → 426,171 |
"prompt_number": 26 |
}, |
{ |
"cell_type": "markdown", |
"metadata": {}, |
"source": [ |
"\u010cten\u00ed dat z gyroskopu\n", |
"---------------------\n", |
"\n" |
] |
}, |
{ |
"cell_type": "code", |
"collapsed": false, |
"input": [ |
"cfg = config.Config(\n", |
" i2c = {\n", |
" \"port\": port,\n", |
" },\n", |
"\n", |
"\tbus = [\n", |
"\t\t{\n", |
" \"type\": \"i2chub\",\n", |
" \"address\": 0x72,\n", |
" \n", |
" \"children\": [\n", |
" {\"name\": \"gyro\", \"type\": \"imu01_gyro\", \"channel\": 0, }\n", |
" ],\n", |
"\t\t},\n", |
"\t],\n", |
")\n", |
"\n", |
"cfg.initialize()\n", |
"#acc = cfg.get_device(\"acc\")\n", |
"gyro = cfg.get_device(\"gyro\")\n", |
"sys.stdout.write(\" MLAB accelerometer sensor IMU01A module example \\r\\n\")\n", |
"time.sleep(0.5)\n", |
"gyro.route()" |
], |
"language": "python", |
"metadata": {}, |
"outputs": [ |
{ |
"output_type": "stream", |
"stream": "stderr", |
"text": [ |
"WARNING:pymlab.sensors.iic:HID device does not exist, we will try SMBus directly...\n" |
] |
}, |
{ |
"output_type": "stream", |
"stream": "stdout", |
"text": [ |
" MLAB accelerometer sensor IMU01A module example \r\n" |
] |
}, |
{ |
"metadata": {}, |
"output_type": "pyout", |
"prompt_number": 4, |
"text": [ |
"True" |
] |
} |
], |
"prompt_number": 4 |
}, |
{ |
"cell_type": "code", |
"collapsed": false, |
"input": [ |
"import sys\n", |
"import time\n", |
"from IPython.display import clear_output\n", |
"\n", |
"MEASUREMENTS = 100\n", |
"list_meas = []\n", |
"# 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", |
"\n", |
"for n in range(MEASUREMENTS):\n", |
" clear_output()\n", |
" (x, y, z) = gyro.axes()\n", |
" list_meas.append([x, y, z])\n", |
" print (n, list_meas[n])\n", |
" sys.stdout.flush()" |
], |
"language": "python", |
"metadata": {}, |
"outputs": [ |
{ |
"output_type": "stream", |
"stream": "stdout", |
"text": [ |
"(99, [195, -118, 7])\n" |
] |
} |
], |
"prompt_number": 5 |
}, |
{ |
"cell_type": "code", |
"collapsed": false, |
"input": [ |
"measurements = np.array(list_meas)\n", |
"\n", |
"%pylab qt\n", |
"plt.subplot(1, 1, 1)\n", |
"plt.plot(measurements[:, 0])\n", |
"plt.plot(measurements[:, 1])\n", |
"plt.plot(measurements[:, 2])\n", |
"plt.xlabel('sample number')\n", |
"plt.ylabel('ADC')\n", |
"plt.title('Raw sensors')" |
], |
"language": "python", |
"metadata": {}, |
"outputs": [ |
{ |
"output_type": "stream", |
"stream": "stdout", |
"text": [ |
"Populating the interactive namespace from numpy and matplotlib\n" |
] |
}, |
{ |
"metadata": {}, |
"output_type": "pyout", |
"prompt_number": 6, |
"text": [ |
"<matplotlib.text.Text at 0x7f5b38053450>" |
] |
} |
], |
"prompt_number": 6 |
}, |
{ |
"cell_type": "code", |
"collapsed": false, |
"input": [ |
"help(map)" |
], |
"language": "python", |
"metadata": {}, |
"outputs": [ |
{ |
"output_type": "stream", |
"stream": "stdout", |
"text": [ |
"Help on built-in function map in module __builtin__:\n", |
"\n", |
"map(...)\n", |
" map(function, sequence[, sequence, ...]) -> list\n", |
" \n", |
" Return a list of the results of applying the function to the items of\n", |
" the argument sequence(s). If more than one sequence is given, the\n", |
" function is called with an argument list consisting of the corresponding\n", |
" item of each sequence, substituting None for missing values when not all\n", |
" sequences have the same length. If the function is None, return a list of\n", |
" the items of the sequence (or a list of tuples if more than one sequence).\n", |
"\n" |
] |
} |
], |
"prompt_number": 10 |
}, |
{ |
"cell_type": "code", |
"collapsed": false, |
"input": [], |
"language": "python", |
"metadata": {}, |