{"id":1199,"date":"2017-09-29T21:42:08","date_gmt":"2017-09-29T19:42:08","guid":{"rendered":"http:\/\/entropie.org\/3615\/?p=1199"},"modified":"2022-11-11T22:53:56","modified_gmt":"2022-11-11T21:53:56","slug":"poppy-ergo-jr","status":"publish","type":"post","link":"https:\/\/entropie.org\/3615\/index.php\/2017\/09\/29\/poppy-ergo-jr\/","title":{"rendered":"Poppy Ergo Jr"},"content":{"rendered":"<div style=\"width: 840px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-1199-1\" width=\"840\" height=\"472\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/entropie.org\/3615\/wp-content\/uploads\/2019\/02\/poppy.mp4?_=1\" \/><a href=\"https:\/\/entropie.org\/3615\/wp-content\/uploads\/2019\/02\/poppy.mp4\">https:\/\/entropie.org\/3615\/wp-content\/uploads\/2019\/02\/poppy.mp4<\/a><\/video><\/div>\n<pre>\r\nimport random\r\nimport time\r\nfrom pypot.dynamixel.conversion import XL320LEDColors\r\n\r\n#------------------------------------------------------\r\n# CREATION DU ROBOT\r\n#------------------------------------------------------\r\n\r\nfrom pypot.creatures import PoppyErgoJr\r\npoppy = PoppyErgoJr()\r\n\r\n#------------------------------------------------------\r\n# INITIALISATION DU ROBOT\r\n#------------------------------------------------------\r\n\r\nfor m in poppy.motors :  # Boucle sur les six moteurs\r\n    m.compliant = False\r\n    m.led = 'green'\r\nposition_1 = {'m1': 0, 'm2': -110, 'm3': 66, 'm4': 0, 'm5': 34, 'm6': 20}  # safe_power_up\r\npoppy.goto_position(position_1, 2, wait=True)  # 2 secondes pour prendre la position\r\n\r\n#------------------------------------------------------\r\n# FONCTION animation\r\n#------------------------------------------------------\r\n\r\ndef animation(moteur, angleMin, angleMax, forceMax) :\r\n    moteur.goal_position = random.randint(angleMin,angleMax)\r\n    if abs(moteur.present_load) > forceMax :\r\n        print (moteur.present_load)\r\n        for m in poppy.motors :\r\n            m.compliant = True\r\n            m.led = 'off'\r\n        for i in range(5) :\r\n            moteur.led = 'red'\r\n            time.sleep(0.5)\r\n            moteur.led = 'off'\r\n            time.sleep(0.5)\r\n        time.sleep(1)\r\n\r\n#------------------------------------------------------\r\n# BOUCLE\r\n#------------------------------------------------------\r\n\r\nwhile 1 :\r\n    for m in poppy.motors :\r\n        m.moving_speed = random.randint(5,20)  # 5,20 \u00e0 5,30\r\n        m.compliant = False\r\n        m.led = XL320LEDColors(random.randint(2,8)).name\r\n    animation(poppy.m1,-90,90,50)\r\n    animation(poppy.m2,-110,0,30)\r\n    animation(poppy.m3,0,60,30)\r\n    animation(poppy.m4,-90,90,30)\r\n    animation(poppy.m5,-40,40,20)\r\n    animation(poppy.m6,-60,60,10)\r\n    if random.randrange(4) == 1 :\r\n        time.sleep(random.randrange(5))\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>import random import time from pypot.dynamixel.conversion import XL320LEDColors #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; # CREATION DU ROBOT #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; from pypot.creatures import PoppyErgoJr poppy = PoppyErgoJr() #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; # INITIALISATION DU ROBOT #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; for m in poppy.motors : # Boucle sur les six moteurs m.compliant = False m.led = &lsquo;green&rsquo; position_1 = {&lsquo;m1&rsquo;: 0, &lsquo;m2&rsquo;: -110, &lsquo;m3&rsquo;: 66, &lsquo;m4&rsquo;: 0, &lsquo;m5&rsquo;: &hellip; <a href=\"https:\/\/entropie.org\/3615\/index.php\/2017\/09\/29\/poppy-ergo-jr\/\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Poppy Ergo Jr&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-1199","post","type-post","status-publish","format-standard","hentry","category-poppy-ergo-jr"],"_links":{"self":[{"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/posts\/1199"}],"collection":[{"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/comments?post=1199"}],"version-history":[{"count":5,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/posts\/1199\/revisions"}],"predecessor-version":[{"id":5373,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/posts\/1199\/revisions\/5373"}],"wp:attachment":[{"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/media?parent=1199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/categories?post=1199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entropie.org\/3615\/index.php\/wp-json\/wp\/v2\/tags?post=1199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}