{"id":2199,"date":"2018-02-16T14:20:31","date_gmt":"2018-02-16T13:20:31","guid":{"rendered":"https:\/\/www.macerobotics.com\/?p=2199"},"modified":"2018-02-25T10:11:08","modified_gmt":"2018-02-25T09:11:08","slug":"dance-de-robots-mrpiz","status":"publish","type":"post","link":"http:\/\/www.macerobotics.com\/?p=2199","title":{"rendered":"Dance de robots MRPiZ"},"content":{"rendered":"<div class=\"ttfmake-embed-wrapper aligncenter\" style=\"max-width: 960px;\"><iframe loading=\"lazy\" title=\"MRPiZ - raspberry pi robot - dance\" width=\"960\" height=\"540\" src=\"https:\/\/www.youtube.com\/embed\/GPm05Cwns4g?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/div>\n<p>&nbsp;<\/p>\n<p>La gestion des robots en parall\u00e8le est g\u00e9rer par fabric (<a href=\"http:\/\/www.fabfile.org\/\">www.fabfile.org<\/a>). Un outil SSH permettant d&#8217;envoyer plusieurs commandes SSH en parall\u00e8le. Chaques robots MRPiZ est identifi\u00e9 par une adresse IP unique:<\/p>\n<ul>\n<li>IP du robot n\u00b01: 192.168.1.41<\/li>\n<li>IP du robot n\u00b02: 192.168.1.37<\/li>\n<li>IP du robot n\u00b03: 192.168.1.47<\/li>\n<\/ul>\n<p>Le script de contr\u00f4le des robots :<\/p>\n<pre><strong><span style=\"color: #008000;\">#!\/usr\/bin\/env python<\/span><\/strong>\r\n<strong>import fabric<\/strong>\r\n<strong>from fabric.api import run, env, task<\/strong>\r\n<strong>from fabric.api import *<\/strong>\r\n<strong>import time<\/strong>\r\n\r\n\r\n<strong>env.hosts = ['192.168.1.41', '192.168.1.37', '192.168.1.47']<\/strong>\r\n\r\n<strong>env.user = 'pi'<\/strong>\r\n<strong>env.password = 'raspberry'<\/strong>\r\n\r\n<strong>@parallel<\/strong>\r\n<strong>def hello():<\/strong>\r\n<strong> run('python \/home\/pi\/MRPiZ\/Dance.py')<\/strong><\/pre>\n<p>Le script python pour les robots :<\/p>\n<pre><span style=\"color: #008000;\">#<strong>!\/usr\/bin\/env python<\/strong><\/span>\r\n\r\n<strong><span style=\"color: #0000ff;\">import<\/span> sys<\/strong>\r\n<strong><span style=\"color: #0000ff;\">from<\/span> mrpiZ_lib <span style=\"color: #0000ff;\">import<\/span> *<\/strong>\r\n<strong>import time<\/strong>\r\n\r\n<strong>controlEnable()<\/strong>\r\n<strong><span style=\"color: #0000ff;\">while<\/span> 1:<\/strong>\r\n<strong> forward_mm(13,120)<\/strong>\r\n<strong> back_mm(11,100)<\/strong>\r\n<strong> forward_mm(11,100)<\/strong>\r\n<strong> turnRight_degree(25,360)<\/strong>\r\n<strong> time.sleep(1)<\/strong>\r\n<strong> turnRight_degree(15,90)<\/strong>\r\n<strong> turnLeft_degree(15,180)<\/strong>\r\n<strong> turnRight_degree(15,90)<\/strong>\r\n<strong> back_mm(12,90)<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; La gestion des robots en parall\u00e8le est g\u00e9rer par fabric (www.fabfile.org). Un outil SSH permettant d&#8217;envoyer plusieurs commandes SSH en parall\u00e8le. Chaques robots MRPiZ est identifi\u00e9 par une adresse IP unique: IP du robot n\u00b01: 192.168.1.41 IP du robot n\u00b02: 192.168.1.37 IP du robot n\u00b03: 192.168.1.47 Le script de contr\u00f4le des robots : #!\/usr\/bin\/env &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55,45,46],"tags":[],"class_list":["post-2199","post","type-post","status-publish","format-standard","hentry","category-mrpiz","category-raspberry-pi","category-robot"],"_links":{"self":[{"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/2199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2199"}],"version-history":[{"count":3,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/2199\/revisions"}],"predecessor-version":[{"id":2218,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=\/wp\/v2\/posts\/2199\/revisions\/2218"}],"wp:attachment":[{"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2199"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.macerobotics.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}