{"id":193272,"date":"2013-11-22T16:48:03","date_gmt":"2013-11-22T12:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=193272"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=193272","title":{"rendered":"<span class=\"post_title\">\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c Lego Segway<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u043c\u044b, \u043d\u0430\u0447\u0430\u0442\u043e\u0439 \u0432 \u043f\u043e\u0441\u0442\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/178103\/\">habrahabr.ru\/post\/178103\/<\/a>. <br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0441 \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f Lego, \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438 \u043e\u0431\u0441\u0447\u0435\u0442\u0443 \u0440\u043e\u0431\u043e\u0442\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u044b\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0446\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 Segway. \u042d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0442\u0435\u043e\u0440\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/629\/d95\/842\/629d9584228a41fb950968a7420868bd.jpg\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430. \u0412\u044b\u0431\u0435\u0440\u0435\u043c \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/c07\/8c3\/618\/c078c36187904b0f2fc27655c603f376.png\"\/><br \/>  \u0412\u0441\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441 \u0438 \u043c\u043e\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0435\u0440\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0448 Segway, \u043a\u0430\u043a \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u044b\u0439 \u043a\u0438\u0440\u043f\u0438\u0447, \u043d\u0435 \u043e\u0431\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0435\u0440\u0446\u0438\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043a\u043e\u043b\u0435\u0441, \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<br \/>  \u0417\u0430\u043f\u0438\u0448\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0446\u0435\u043d\u0442\u0440\u0430 \u043c\u0430\u0441\u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/8d5\/d02\/dbd\/8d5d02dbd15b1d0f1f183261cc04318a.png\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/541\/3a9\/5a8\/5413a95a89a93b8c6f0512991d069f4d.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u041b\u0430\u0433\u0440\u0430\u043d\u0436\u0438\u0430\u043d\u0430:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/4cf\/528\/e07\/4cf528e07dcfd657aa6fcd439276d18b.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 Maxima \u0438 \u0435\u0435 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0440\u0435\u0434\u043e\u0439 WxMaxima. \u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0432\u0432\u043e\u0434\u0430 \u0444\u043e\u0440\u043c\u0443\u043b \u0432 Maxima, \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0433\u0440\u0435\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0443\u043a\u0432\u044b \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0435. \u0412\u0432\u0435\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"matlab\">V:expand( \ttrigsimp( \t\t((diff(integrate(R*diff(O(t),t),t)+L*sin(y(t)),t))^2+ \t\t(diff(R+L*cos(y(t)),t))^2)*M\/2 \t\t+J2*(diff(y(t),t))^2\/2-M*g*(R+L*cos(y(t))) \t) ); tex(V); <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \\verb|trigsimp| \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0430 \\verb|expand| \u0434\u043b\u044f \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u043a\u043e\u0431\u043e\u043a. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \\verb|tex| \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 tex-\u0444\u043e\u0440\u043c\u0430\u0442, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0432 tex-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u043e\u0432.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432\u0441\u0435\u0445 \u0437\u0430\u043c\u0435\u043d, \u043a\u043e\u0442\u0440\u044b\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/11e\/1b7\/773\/11e1b777358c622391ebfca04a0cab35.png\"\/><\/p>\n<p>  \u0410 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u041b\u0430\u0433\u0440\u0430\u043d\u0436\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/372\/8d8\/915\/3728d89154333060571158d41ef0dd55.png\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f Maxima \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439:<\/p>\n<pre><code class=\"matlab\">expand(diff(diff(V,diff(O(t),t)),t)-diff(V,O(t))); expand(diff(diff(V,diff(y(t),t)),t)-diff(V,y(t))); <\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0432\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/348\/48a\/7ab\/34848a7ab4d3c29ad73ef26963f9cf31.png\"\/><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e Segway:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/d39\/fee\/bbe\/d39feebbe41608ff4a27f796b7659b89.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/60c\/146\/f91\/60c146f91330322230c11ef5bd4538dc.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/c4b\/7fb\/71b\/c4b7fb71b4cb2d796577303c73aa04d2.png\"\/><\/p>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043d\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u043c\u043e\u0442\u043a\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0430\u043b\u0430, \u043f\u043e\u043b\u043e\u0436\u0438\u043c L=0:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/997\/023\/100\/997023100f1ba69b1dcb91864ac8b1fe.png\"\/><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/141\/918\/217\/14191821758aa43a8f0399cf552cc0c7.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u044f\u0435\u043c \u043d\u0430\u0448\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0432 \u043b\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/851\/e7b\/98e\/851e7b98e4c6cfba68366ea4e59475d1.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c\u0438 \u0440\u0430\u0441\u0441\u0447\u0435\u0442\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438, \u043b\u0438\u043d\u0435\u0430\u0440\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0435\u043b\u043e\u043c, \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043c <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a1c\/748\/05c\/a1c74805c6220d78636fe5a3745ddbe8.png\"\/> \u0438 <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/8e2\/db3\/aa6\/8e2db3aa6170f874abdc8cb5c3d594f8.png\"\/>. \u0422\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u043d\u0435\u0431\u0440\u0435\u0433\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u043c\u0438\u0441\u044f \u043d\u0435\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/5df\/f7d\/4a8\/5dff7d4a8e415154986b808fab7f532a.png\"\/><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0443\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u043f\u0440\u0438\u043d\u044f\u0432 <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/38e\/7ab\/564\/38e7ab5640963328524bcafa0f288031.png\"\/>:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/459\/8b6\/f5c\/4598b6f5c4d5640dda0d25ea132639a0.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/2ff\/bbb\/2c0\/2ffbbb2c0720f2a352527801759db4d0.png\"\/><\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0441 \u044d\u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u0432\u0438\u0434, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043b\u0435\u0442\u0438 \u0434\u0432\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/f2c\/975\/def\/f2c975def96a2b36b6aed2c43da53d2e.png\"\/>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/9ba\/b05\/426\/9bab054262e9cea81b14dfd9f4607388.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/480\/859\/669\/480859669f63ac2be47a936bb2d5f59b.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0438 \u0437\u043d\u0430\u0435\u043c \u0432\u0441\u044e \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0443 \u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0435 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0439, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u043d\u043e\u043c\u043e\u043c \u041d\u044c\u044e\u0442\u043e\u043d\u0430 <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/885\/52e\/aa2\/88552eaa21c52e753a72eb16c060502a.png\"\/>, \u0433\u0434\u0435 <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/3d6\/a5e\/261\/3d6a5e261d0316a544093214fd186e20.png\"\/>. \u0417\u0434\u0435\u0441\u044c <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/795\/f17\/86b\/795f1786be8bf042f45bd2af0389295c.png\"\/> \u0442\u0430\u0431\u043b\u0438\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/e05\/bc2\/526\/e05bc2526e294d37784cd81729891109.png\"\/> \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u0440\u0438\u043d\u044f\u043b\u0438 \u0440\u0430\u0432\u043d\u044b\u043c 0.3 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0421\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c, \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0432 \u0435\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/499\/564\/b68\/499564b683c81045091a2a930b7cabd4.png\"\/>, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438 \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0410\u043a\u043a\u0435\u0440\u043c\u0430\u043d\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/51f\/f5b\/cf5\/51ff5bcf57c2187ede06992f8e54bca7.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/92c\/cef\/4d2\/92ccef4d288f42e6b0a122fd96e1c7bd.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/588\/ee6\/13f\/588ee613fcda18dcbfe341db148c716b.png\"\/><\/p>\n<p>  \u041d\u043e \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u0433\u043b\u0430\u0434\u043a\u043e, \u043a\u0430\u043a \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u043c\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u0445\u043e\u0442\u044f \u043e\u043d\u043e \u0432\u0441\u0435\u0433\u043e 7[\u0412]. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0443\u0433\u043b\u043e\u0432\u044b\u0445 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0435\u0439 \u043c\u0430\u044f\u0442\u043d\u0438\u043a\u0430 \u0438 \u043a\u043e\u043b\u0435\u0441 \u0440\u043e\u0431\u043e\u0442\u0430.<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/334\/837\/912\/3348379124a3bf6431b1e70dbee34e54.png\"\/><br \/>  \u0413\u043e\u043b\u0443\u0431\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u043f\u043e \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0440\u0435\u0433\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043b\u044f \u0440\u043e\u0431\u043e\u0442\u0430.  <\/p>\n<pre><code>#define GYRO_PORT    IN_1 #define LEFT_MOTOR   OUT_C #define RIGHT_MOTOR  OUT_B #define BOTH_MOTORS  OUT_BC #define WAIT_TIME    8.0 #define KGYROANGLE   0.487 #define KSPEED       0.024 #define KGYROSPEED   0.153 #define KPOS         0  task main(){      float time = WAIT_TIME * 0.001;     float segway_angle = 0;     float segway_speed;     float wheel_angle = 0, last_wheel_angle;     float wheel_speed;     float max_voltage;     int u;      SetSensorHTGyro(GYRO_PORT);     Wait(50);          while(true) {          max_voltage = BatteryLevel() \/ 1000;                  segway_speed = (SensorHTGyro(GYRO_PORT) + 2);         segway_angle += segway_speed * time;                  last_wheel_angle = wheel_angle;         wheel_angle = (MotorRotationCount(LEFT_MOTOR) + MotorRotationCount(RIGHT_MOTOR)) \/ 2;         wheel_speed = (wheel_angle - last_wheel_angle) \/ time;           u = KGYROANGLE * segway_angle +             KSPEED * wheel_speed +             KGYROSPEED * segway_speed +             KPOS * wheel_angle;          u = u * 100 \/ max_voltage;         if (abs(u) &gt; 100){             u = sign(u) * 100;         }          OnFwd(BOTH_MOTORS, u);                  Wait(WAIT_TIME);     } } <\/code><\/pre>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/193272\/\"> http:\/\/habrahabr.ru\/post\/193272\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c, \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u043c\u044b, \u043d\u0430\u0447\u0430\u0442\u043e\u0439 \u0432 \u043f\u043e\u0441\u0442\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/178103\/\">habrahabr.ru\/post\/178103\/<\/a>. <br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u043c \u0441 \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u044f Lego, \u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0438 \u043e\u0431\u0441\u0447\u0435\u0442\u0443 \u0440\u043e\u0431\u043e\u0442\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u044b\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0446\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 Segway. \u042d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0442\u0435\u043e\u0440\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/629\/d95\/842\/629d9584228a41fb950968a7420868bd.jpg\"\/>  <\/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-193272","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193272","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=193272"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/193272\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=193272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=193272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=193272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}