{"id":259001,"date":"2015-06-09T17:09:02","date_gmt":"2015-06-09T13:09:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=259001"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=259001","title":{"rendered":"Ruby \u0438 C. \u0427\u0430\u0441\u0442\u044c 4. \u0414\u0440\u0443\u0436\u0438\u043c \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440, \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f \u0438 \u0434\u0430\u043b\u044c\u043d\u043e\u043c\u0435\u0440 \u0441 Raphael.js"},"content":{"rendered":"<p>     \t\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043e\u0442  <a href=\"http:\/\/habrahabr.ru\/users\/iv_s\/\" class=\"user_link\">iv_s<\/a> (<a href=\"http:\/\/habrahabr.ru\/post\/48928\/\">\u0440\u0430\u0437<\/a> <a href=\"http:\/\/habrahabr.ru\/post\/49202\/\">\u0434\u0432\u0430<\/a> <a href=\"http:\/\/habrahabr.ru\/post\/50039\/\">\u0442\u0440\u0438<\/a>) \u0431\u044b\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f C \u0438 Ruby \u0432\u043c\u0435\u0441\u0442\u0435. \u042f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0435 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 C-\u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  \u042f \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u044c\u043a\u0443 \u0443\u043b\u0443\u0447\u0448\u0430\u044e \u0441\u0432\u043e\u0435\u0433\u043e <a href=\"http:\/\/www.partisanink.com\/versions\/2.5\">\u0440\u043e\u0431\u043e\u0442\u0430-\u0440\u0438\u0441\u043e\u0432\u0430\u0447\u0430<\/a>. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Ruby, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u043d\u0435\u043c\u0443 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u0441 \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c, \u043c\u043d\u0435, \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e.<\/p>\n<p>  \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0448\u0438\u043d\u043e\u0439 I2C \u0432 Ruby \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2013 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C. <\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/M7uhC0H-a-M?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u0430\u044f:<br \/>  \u043d\u0430 RaspberryPi \u0437\u0430\u043f\u0443\u0449\u0435\u043d Sinatra \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u043f\u043b\u0430\u0442\u044b \u043f\u043e \u043e\u0441\u044f\u043c X \u0438 Y, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f \u0432 \u0441\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440\u0430\u0445.<br \/>  \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/mech.fsv.cvut.cz\/~stransky\/en\/software\/raphael3d\/\">Raphael3d.js<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0435 100\u043c\u0441 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u043b\u0430\u0442\u0443 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u043b\u0430\u0442\u044b \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h3>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u043b\u0430\u0442\u0443 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430\/\u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u0430. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0442\u0440\u0435\u0445\u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432\u044b\u0439 <a href=\"http:\/\/cxem.net\/mc\/mc324.php\">MPU6050<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u044b, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0447\u0435\u0435, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"http:\/\/wiringpi.com\/download-and-install\/\">wiringPi<\/a>. \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435, wiringPi \u0434\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u044b\u0432\u043e\u0434\u0430\u043c (GPIO) \u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c RaspberryPi. \u0422\u0430\u043a \u0447\u0442\u043e \u0432\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0434\u0430\u043b\u0435\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0438\u0437 \u0437\u0430\u0434\u0430\u0447, \u043e\u0442 \u043c\u0438\u0433\u0430\u043d\u0438\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c, \u0434\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 PWM.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2013 \u043d\u0430\u0439\u0442\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 wiringPi \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0451 \u043a ruby-\u043f\u0440\u043e\u0435\u043a\u0442\u0443.  <\/p>\n<pre><code class=\"ruby\">require 'fiddle' wiringpi = Fiddle.dlopen('\/home\/pi\/wiringPi\/wiringPi\/libwiringPi.so.2.25') <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u043a\u0430\u043a \u0438\u0445 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<br \/>  Fiddle \u2013 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c Ruby, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0436\u0435 *nix \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c libffi (Foreign Function Interface Library). <br \/>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043d\u0435 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0442\u043e \u044f \u0432\u044b\u0431\u0438\u0440\u0430\u044e \u043d\u0443\u0436\u043d\u044b\u0435 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445:<\/p>\n<p>  \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 wiringPiI2C.h  <\/p>\n<pre><code class=\"cpp\">extern int wiringPiI2CSetup          (const int devId) ; extern int wiringPiI2CWriteReg8 (int fd, int reg, int data) ; <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435:   <\/p>\n<pre><code class=\"ruby\">int = Fiddle::TYPE_INT @i2c_setup = Fiddle::Function.new(wiringpi['wiringPiI2CSetup'], [int], int) @i2c_write_reg8 = Fiddle::Function.new(wiringpi['wiringPiI2CWriteReg8'], [int, int, int], int) <\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u0442\u043e \u2013 \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u0442\u043e, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0445 \u0442\u0438\u043f\u0430, \u043e\u043d\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u044b\u043c\u0438 Fiddle::TYPE_VOIDP<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"ruby\">@fd = @i2c_setup.call 0x68 #\u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430 \u0448\u0438\u043d\u0435 I2C. \u0411\u0435\u0440\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u043d\u0443\u0430\u043b\u0435 \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b i2cdetect. @i2c_write_reg8.call @fd, 0x6B, 0x00 # \u043f\u0438\u0448\u0435\u043c \u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 0x6B \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2013 \u044d\u0442\u043e \u0432\u044b\u0432\u043e\u0434 \u0438\u0437 \u0441\u043f\u044f\u0449\u0435\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430. <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432\u0441\u0451, \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043a\u043b\u0430\u0441\u0441 MPU6050, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 measure, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u043f\u043b\u0430\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 \u041a\u0430\u043b\u043c\u0430\u043d\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u043e\u043c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"ruby\">require 'fiddle'  class MPU6050   attr_reader :last_x, :last_y, :k   def initialize(path_to_wiring_pi_so)     wiringpi = Fiddle.dlopen(path_to_wiring_pi_so)      int = Fiddle::TYPE_INT     char_p = Fiddle::TYPE_VOIDP      # int wiringPiI2CSetup (int devId) ;     @i2c_setup = Fiddle::Function.new(wiringpi['wiringPiI2CSetup'], [int], int)      # int wiringPiI2CSetupInterface (const char *device, int devId) ;     @i2c_setup_interface = Fiddle::Function.new(wiringpi['wiringPiI2CSetupInterface'], [char_p, int], int)      # int wiringPiI2CRead (int fd) ;     @i2c_read = Fiddle::Function.new(wiringpi['wiringPiI2CRead'], [int], int)      # int wiringPiI2CWrite (int fd, int data) ;     @i2c_write = Fiddle::Function.new(wiringpi['wiringPiI2CWrite'], [int, int], int)      # int wiringPiI2CWriteReg8 (int fd, int reg, int data) ;     @i2c_write_reg8 = Fiddle::Function.new(wiringpi['wiringPiI2CWriteReg8'], [int, int, int], int)      # int wiringPiI2CWriteReg16 (int fd, int reg, int data) ;     @i2c_write_reg8 = Fiddle::Function.new(wiringpi['wiringPiI2CWriteReg16'], [int, int, int], int)      # int wiringPiI2CReadReg8 (int fd, int reg) ;     @i2c_read_reg8 = Fiddle::Function.new(wiringpi['wiringPiI2CReadReg8'], [int, int], int)      # int wiringPiI2CReadReg16 (int fd, int reg) ;     @i2c_read_reg16 = Fiddle::Function.new(wiringpi['wiringPiI2CReadReg16'], [int, int], int)      @fd = @i2c_setup.call 0x68     @i2c_write_reg8.call @fd, 0x6B, 0x00      @last_x = 0     @last_y = 0     @k = 0.30    end    def read_word_2c(fd, addr)     val = @i2c_read_reg8.call(fd, addr)     val = val &lt;&lt; 8     val += @i2c_read_reg8.call(fd, addr+1)     val -= 65536 if val &gt;= 0x8000     val   end    def measure     gyro_x = (read_word_2c(@fd, 0x43) \/ 131.0).round(1)     gyro_y = (read_word_2c(@fd, 0x45) \/ 131.0).round(1)     gyro_z = (read_word_2c(@fd, 0x47) \/ 131.0).round(1)       acceleration_x = read_word_2c(@fd, 0x3b) \/ 16384.0     acceleration_y = read_word_2c(@fd, 0x3d) \/ 16384.0     acceleration_z = read_word_2c(@fd, 0x3f) \/ 16384.0      rotation_x = k * get_x_rotation(acceleration_x, acceleration_y, acceleration_z) + (1-k) * @last_x     rotation_y = k * get_y_rotation(acceleration_x, acceleration_y, acceleration_z) + (1-k) * @last_y      @last_x = rotation_x     @last_y = rotation_y      # {gyro_x: gyro_x, gyro_y: gyro_y, gyro_z: gyro_z, rotation_x: rotation_x, rotation_y: rotation_y}     &quot;#{rotation_x.round(1)} #{rotation_y.round(1)}&quot;   end    private   def to_degrees(radians)     radians \/ Math::PI * 180   end    def dist(a, b)     Math.sqrt((a*a)+(b*b))   end    def get_x_rotation(x, y, z)     to_degrees Math.atan(x \/ dist(y, z))   end    def get_y_rotation(x, y, z)     to_degrees Math.atan(y \/ dist(x, z))   end  end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0431\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u0436\u0435\u0441\u0442\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u043e \u0435\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445. \u0410 \u0432\u043e\u0442 \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434, \u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0438 C-\u043a\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0418\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442.<\/p>\n<p>  \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441 <a href=\"http:\/\/robocraft.ru\/blog\/electronics\/772.html\">\u0434\u0430\u043b\u044c\u043d\u043e\u043c\u0435\u0440\u043e\u043c<\/a>, \u0435\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u2013 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0432 10 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434, \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0438\u043c\u043f\u0443\u043b\u044c\u0441\u0430, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u0441\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440\u0430\u0445.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"ruby\">require 'fiddle' require 'inline'  class HCSRO4   IN = 0   OUT = 1    TRIG = 17   ECHO = 27    def initialize(path_to_wiring_pi_so)     wiringpi = Fiddle.dlopen(path_to_wiring_pi_so)      int = Fiddle::TYPE_INT     void = Fiddle::TYPE_VOID      # extern int  wiringPiSetup       (void) ;     @setup = Fiddle::Function.new(wiringpi['wiringPiSetup'], [void], int)      # extern int  wiringPiSetupGpio       (void) ;     @setup_gpio = Fiddle::Function.new(wiringpi['wiringPiSetupGpio'], [void], int)      # extern void pinMode             (int pin, int mode) ;     @pin_mode = Fiddle::Function.new(wiringpi['pinMode'], [int, int], void)      @setup_gpio.call nil     @pin_mode.call TRIG, OUT     @pin_mode.call ECHO, IN   end    inline do |builder|     #sudo cp WiringPi\/wiringPi\/*.h \/usr\/include\/     builder.include '&lt;wiringPi.h&gt;'     builder.c '     double measure(int trig, int echo){         \/\/initial pulse         digitalWrite(trig, HIGH);         delayMicroseconds(20);         digitalWrite(trig, LOW);          \/\/Wait for echo start         while(digitalRead(echo) == LOW);          \/\/Wait for echo end         long startTime = micros();         while(digitalRead(echo) == HIGH);          long travelTime = micros() - startTime;         double distance = travelTime \/ 58.0;          return distance;     }   '   end end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440:  <\/p>\n<pre><code class=\"ruby\">require 'sinatra' require_relative 'mpu6050' require_relative 'hcsro4'  configure do   set :mpu, MPU6050.new('\/home\/pi\/wiringPi\/wiringPi\/libwiringPi.so.2.25')   set :hc, HCSRO4.new('\/home\/pi\/wiringPi\/wiringPi\/libwiringPi.so.2.25') end  get '\/' do   response['Access-Control-Allow-Origin'] = '*'   settings.mpu.measure.to_s + ' ' + settings.hc.measure(17, 27).to_s # \u043f\u0438\u043d\u044b, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u0430\u043b\u044c\u043d\u043e\u043c\u0435\u0440 end <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043b\u044e\u0434\u0438 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u044e\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435\u2026<br \/>  \u0410\u043b\u044c\u0442\u0430\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u043c\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439. <br \/>  \u0412 \u0442\u0435\u043e\u0440\u0438\u0438, \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/WiringPi\/WiringPi-Ruby\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 wiringPi \u0432 Ruby, \u043d\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043e\u043d\u0430 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u044b RaspberryPi \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438.<br \/>  \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u043e\u0431\u043d\u0430\u044f Ruby <a href=\"https:\/\/github.com\/ffi\/ffi\">\u043e\u0431\u0435\u0440\u0442\u043a\u0430<\/a> \u0434\u043b\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 libffi \u0441 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c DSL \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0441\u0435\u0445 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  Ajax \u0437\u0430\u043f\u0440\u043e\u0441 \u043a\u0430\u0436\u0434\u044b\u0435 100\u043c\u0441 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Raphael. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044d\u0442\u043e \u043d\u0435 \u0441\u0430\u043c Raphael, \u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u044b\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438.  <\/p>\n<pre><code class=\"javascript\">    var scene, viewer;     var rotationX = 0, rotationY = 0;     var divX = document.getElementById('rotation_x');     var divY = document.getElementById('rotation_y');      function rotate(x, y, z){         scene.camera.rotateX(x).rotateZ(y).rotateY(z);         viewer.update();     }      function getAngles(){         var r = new XMLHttpRequest();         r.open('get','http:\/\/192.168.0.102:4567', true);         r.send();         r.onreadystatechange = function(){             if (r.readyState != 4 || r.status != 200) return;             var angles = r.responseText.split(' ');              divX.textContent = angles[0];             divY.textContent = angles[1];              x_deg = Math.PI * (parseFloat(angles[0]) - rotationX)\/ 180;             y_deg = Math.PI * (parseFloat(angles[1]) - rotationY)\/ 180;              rotate(x_deg, y_deg, 0);             rotationX = parseFloat(angles[0]);             rotationY = parseFloat(angles[1]);         }     }      window.onload = function() {         var paper = Raphael('canvas', 1000, 800);         var mat = new Raphael3d.Material('#363', '#030');         var cube = Raphael3d.Surface.Box(0, 0, 0, 5, 4, 0.15, paper, {});         scene = new Raphael3d.Scene(paper);         scene.setMaterial(mat).addSurfaces(cube);         scene.projection = Raphael3d.Matrix4x4.PerspectiveMatrixZ(900);         viewer = paper.Viewer(45, 45, 998, 798, {opacity: 0});         viewer.setScene(scene).fit();         rotate(-1.5,0.2, 0);          var timer = setInterval(getAngles, 100);         document.getElementById('canvas').onclick = function(){             clearInterval(timer);         }     } <\/code><\/pre>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u0435\u043d\u044f \u0432\u043e\u0441\u0445\u0438\u0449\u0430\u044e\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0448\u0438\u043d\u043e\u0439 I2C \u0438 Javascript \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u043b\u044e\u0441\u0430\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439. \u041f\u0440\u043e\u043f\u0430\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 hardware \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439, 3D-\u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439 \u0438 Javascript&#8217;\u043e\u043c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0438 \u043f\u0440\u043e\u043f\u0430\u0441\u0442\u044c\u044e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0430 \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440, \u043a\u0430\u043a \u044f. \u041a\u0443\u0440\u0435\u043d\u0438\u0435 \u043c\u0430\u043d\u0443\u0430\u043b\u043e\u0432, \u043f\u043e\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043e\u0431\u0438\u043b\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0434\u0430\u0435\u0442 \u043e \u0441\u0435\u0431\u0435 \u0437\u043d\u0430\u0442\u044c.<\/p>\n<p>  P.S.<br \/>  \u0412\u0441\u0435 \u0436\u0435\u043b\u0435\u0437\u043a\u0438 \u044f \u0431\u0440\u0430\u043b \u0432 \u041c\u0438\u043d\u0441\u043a\u043e\u043c <a href=\"http:\/\/hackerspace.by\">\u0445\u0430\u043a\u0435\u0440\u0441\u043f\u0435\u0439\u0441\u0435<\/a>, \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/k2m30\/mpu6050\">\u0437\u0434\u0435\u0441\u044c<\/a>.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/259675\/\"> http:\/\/habrahabr.ru\/post\/259675\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043e\u0442  <a href=\"http:\/\/habrahabr.ru\/users\/iv_s\/\" class=\"user_link\">iv_s<\/a> (<a href=\"http:\/\/habrahabr.ru\/post\/48928\/\">\u0440\u0430\u0437<\/a> <a href=\"http:\/\/habrahabr.ru\/post\/49202\/\">\u0434\u0432\u0430<\/a> <a href=\"http:\/\/habrahabr.ru\/post\/50039\/\">\u0442\u0440\u0438<\/a>) \u0431\u044b\u043b\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f C \u0438 Ruby \u0432\u043c\u0435\u0441\u0442\u0435. \u042f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0435 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 C-\u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  \u042f \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u044c\u043a\u0443 \u0443\u043b\u0443\u0447\u0448\u0430\u044e \u0441\u0432\u043e\u0435\u0433\u043e <a href=\"http:\/\/www.partisanink.com\/versions\/2.5\">\u0440\u043e\u0431\u043e\u0442\u0430-\u0440\u0438\u0441\u043e\u0432\u0430\u0447\u0430<\/a>. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Ruby, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a \u043d\u0435\u043c\u0443 \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u043e\u043c\u0435\u0442\u0440\u0430 \u0441 \u0433\u0438\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c, \u043c\u043d\u0435, \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e.<\/p>\n<p>  \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0448\u0438\u043d\u043e\u0439 I2C \u0432 Ruby \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2013 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C. <\/p>\n<p>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/M7uhC0H-a-M?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u0430\u044f:<br \/>  \u043d\u0430 RaspberryPi \u0437\u0430\u043f\u0443\u0449\u0435\u043d Sinatra \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0435 \u043f\u043b\u0430\u0442\u044b \u043f\u043e \u043e\u0441\u044f\u043c X \u0438 Y, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u043e \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f \u0432 \u0441\u0430\u043d\u0442\u0438\u043c\u0435\u0442\u0440\u0430\u0445.<br \/>  \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/mech.fsv.cvut.cz\/~stransky\/en\/software\/raphael3d\/\">Raphael3d.js<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0435 100\u043c\u0441 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u043b\u0430\u0442\u0443 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u043b\u0430\u0442\u044b \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-259001","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=259001"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/259001\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=259001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=259001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=259001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}