{"id":2043,"date":"2023-05-26T09:59:14","date_gmt":"2023-05-26T01:59:14","guid":{"rendered":"https:\/\/104.es\/?p=2043"},"modified":"2023-07-21T10:10:06","modified_gmt":"2023-07-21T02:10:06","slug":"zenbo-junior-movement","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2023\/05\/26\/zenbo-junior-movement\/","title":{"rendered":"\u8b93Zenbo Junior\u958b\u59cb\u52d5\u4e00\u52d5"},"content":{"rendered":"\n<p>\u6a5f\u5668\u4eba\u6700\u91cd\u8981\u529f\u80fd\u4e4b\u4e00\uff0c\u9664\u4e86\u8aaa\u8a71\u4e4b\u5916\uff0c\u61c9\u8a72\u5c31\u662f\u8981\u80fd\u5920\u52d5\u4e00\u52d5\u5427\u3002\u9019\u4e00\u7bc7\u6587\u7ae0\u4e2d\u5c31\u4f86\u770b\u770bZenbo Python SDK\u4e2d\u63d0\u4f9b\u4e86\u54ea\u4e9b\u53ef\u4ee5\u63a7\u5236\u79fb\u52d5\u7684\u51fd\u5f0f\u3002<\/p>\n\n\n\n<p>\u5176\u4e2d\u6700\u91cd\u8981\u7684\u5c31\u662f\u9019\u500b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1172\" height=\"266\" src=\"http:\/\/104es.nkust.org\/wp-content\/uploads\/2023\/05\/image-4.png?w=1024\" alt=\"\" class=\"wp-image-2045\" srcset=\"https:\/\/104.es\/wp-content\/uploads\/2023\/05\/image-4.png 1172w, https:\/\/104.es\/wp-content\/uploads\/2023\/05\/image-4-300x68.png 300w, https:\/\/104.es\/wp-content\/uploads\/2023\/05\/image-4-1024x232.png 1024w, https:\/\/104.es\/wp-content\/uploads\/2023\/05\/image-4-768x174.png 768w\" sizes=\"auto, (max-width: 1172px) 100vw, 1172px\" \/><\/figure>\n\n\n\n<p>\u5728SDK\u7684\u8aaa\u660e\u6587\u4ef6\u4e2d\uff0c\u63d0\u4f9b\u4e86move_body\u9019\u500b\u51fd\u5f0f\uff0c\u5b83\u53ef\u4ee5\u8b93Zenbo Junior\u79fb\u52d5\u6307\u5b9a\u7684\u8ddd\u96e2\uff0c\u4ee5x, y\u8ef8\u8a2d\u5b9a\uff0c\u53ef\u4ee5\u540c\u6642\u8a2d\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u5206\u958b\u8a2d\u5b9a\u3002\u540c\u6642\uff0c\u4e5f\u53ef\u4ee5\u8a2d\u5b9a\u8f49\u52d5\u7684\u89d2\u5ea6\u4ee5\u53ca\u79fb\u52d5\u7684\u901f\u5ea6\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u8b93Zenbo Junior\u53ef\u4ee5\u9032\u884c\u7e5e\u5708\u5708\u7684\u7a0b\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyzenbo\nimport time\nfrom pyzenbo.modules.dialog_system import RobotFace\n\nhost = '192.168.1.104'\nsdk = pyzenbo.connect(host)\nsdk.robot.speak(\"\u51fa\u767c\uff01\")\nfor i in range(4):\n    sdk.motion.move_body(0.3, 0, -90, 1, True, 10)\nsdk.robot.set_expression(RobotFace.HIDEFACE) \nsdk.release()\n<\/code><\/pre>\n\n\n\n<p>\u4e0a\u8ff0\u7684\u9019\u500b\u7a0b\u5f0f\u5229\u7528move_body\u51fd\u5f0f\u57f7\u884c\u7684\u5f80\u524d\u79fb\u52d530\u516c\u5206\uff0c\u7136\u5f8c\u5411\u53f3\u8f49\u52d590\u5ea6\u7684\u4f5c\u696d\u9023\u7e8c4\u6b21\uff0c\u5982\u6b64\u5373\u53ef\u5728\u539f\u5730\u7e5e\u8457\u4e00\u500b\u56db\u65b9\u5f62\u9032\u884c\u8d70\u52d5\u3002\u7576\u7136\uff0c\u5982\u679c\u8981\u8f49\u66f4\u591a\u89d2\u5ea6\u7684\u8a71\uff0c\u4e5f\u662f\u53ef\u4ee5\u7684\uff0c\u8acb\u53c3\u8003\u4ee5\u4e0b\u9019\u500b\u7a0b\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyzenbo\nimport time\nfrom pyzenbo.modules.dialog_system import RobotFace\n\nhost = '192.168.1.104'\nsdk = pyzenbo.connect(host)\nsdk.robot.speak(\"\u51fa\u767c\uff01\")\nfor i in range(10):\n    sdk.motion.move_body(0.1, 0, -36, 1, True, 10)\nsdk.robot.set_expression(RobotFace.HIDEFACE) \nsdk.release()<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u9019\u500b\u7a0b\u5f0f\u5728\u4e00\u5708\u4e2d\u7e3d\u5171\u8f49\u52d5\u4e8610\u6b21\u3002<\/p>\n\n\n\n<p>Zenbo\u4e5f\u6709\u4e00\u4e9b\u5167\u5efa\u7684\u9810\u8a2d\u52d5\u614b\u5c55\u793a\u53ef\u4ee5\u4f7f\u7528\uff0c\u653e\u5728utility\u6a21\u7d44\u4e2d\uff0c\u8acb\u53c3\u8003\u4ee5\u4e0b\u7684\u8868\u6f14\u7a0b\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyzenbo, time\nfrom pyzenbo.modules.dialog_system import RobotFace\n\nhost = '192.168.1.104'\nsdk = pyzenbo.connect(host)\n\nsdk.robot.set_expression(RobotFace.PLEASED, \"\u6211\u8981\u958b\u59cb\u8868\u6f14\u56c9\")\nsdk.wheelLights.start_glowing_yoyo(0, 1, True, 100)\nsdk.utility.play_action(15, True, 100)\nsdk.wheelLights.turn_off(0)\nsdk.robot.set_expression(RobotFace.PLEASED, \"\u8868\u6f14\u7d50\u675f\uff0c\u8b1d\u8b1d\u6536\u770b\")\nsdk.robot.set_expression(RobotFace.HIDEFACE) \nsdk.release()<\/code><\/pre>\n\n\n\n<p>\u9664\u4e86\u4f7f\u7528\u9810\u8a2d\u7684\u8def\u5f91\u4f86\u79fb\u52d5\u4e4b\u5916\uff0c\u6211\u5011\u4e5f\u53ef\u4ee5\u5229\u7528Python\u7684pynput\u6a21\u7d44\uff0c\u53d6\u5f97\u96fb\u8166\u7684\u6309\u9375\u8cc7\u8a0a\uff0c\u9032\u884c\u5373\u6642\u7684\u79fb\u52d5\u63a7\u5236\uff0c\u8acb\u53c3\u8003\u4ee5\u4e0b\u9019\u6bb5\u7a0b\u5f0f\u78bc\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyzenbo\nfrom pynput import keyboard\n\nfrom pyzenbo.modules.dialog_system import RobotFace\n\nhost = '192.168.1.104'\nsdk = pyzenbo.connect(host)\n\ndef on_press(key):\n    if key == keyboard.Key.esc:\n        listener.stop()\n        sdk.robot.set_expression(RobotFace.HIDEFACE) \n        sdk.release()\n\n    else:\n        if key == keyboard.Key.up:\n            sdk.motion.move_body(0.1, 0, 0, 1, True, 10)\n        elif key == keyboard.Key.down:\n            sdk.motion.move_body(-0.1, 0, 0, 1, True, 10)\n        elif key == keyboard.Key.left:\n            sdk.motion.move_body(0, 0, 10, 1, True, 10)\n        elif key == keyboard.Key.right:\n            sdk.motion.move_body(0, 0, -10, 1, True, 10)\n    \n\nlistener = keyboard.Listener(on_press=on_press)\nlistener.start()\nlistener.join()\n<\/code><\/pre>\n\n\n\n<p>\u9019\u500b\u7a0b\u5f0f\u53ef\u4ee5\u63a5\u6536\u65b9\u5411\u9375\u7528\u4f86\u63a7\u5236Zenbo\u7684\u524d\u9032\u3001\u5f8c\u9000\u3001\u4ee5\u53ca\u5de6\u8f49\u53ca\u53f3\u8f49\u3002\u4e0d\u904e\u56e0\u70ba\u6309\u9215\u7684\u901f\u5ea6\u8f03\u5feb\uff0cZenbo\u7684\u53cd\u61c9\u8f03\u6162\uff0c\u6240\u4ee5\u4e0d\u80fd\u4e00\u6b21\u6309\u8457\u6309\u9375\u4e0d\u653e\uff0c\u4e0d\u7136Zenbo\u6703\u6709\u5f88\u9577\u4e00\u6bb5\u6642\u9593\u505a\u540c\u6a23\u7684\u52d5\u4f5c\u4e0d\u518d\u7406\u4f60\u5594\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u9019\u500b\u7a0b\u5f0f\u5229\u7528remote_control_body\u4f86\u9054\u6210\u53ef\u4ee5\u9023\u7e8c\u79fb\u52d5\u7684\u63a7\u5236\uff0c\u6709\u8208\u8da3\u7684\u540c\u5b78\u4e5f\u53ef\u4ee5\u57f7\u884c\u770b\u770b\uff0c\u6bd4\u8f03\u4e0a\u4e0b\u5169\u500b\u7a0b\u5f0f\u4e0d\u540c\u7684\u5730\u65b9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import pyzenbo\nfrom pynput import keyboard\n\nfrom pyzenbo.modules.dialog_system import RobotFace\n\nhost = '192.168.1.104'\nsdk = pyzenbo.connect(host)\n\ndef on_press(key):\n    if key == keyboard.Key.esc:\n        listener.stop()\n        sdk.robot.set_expression(RobotFace.HIDEFACE) \n        sdk.release()\n\n    else:\n        if key == keyboard.Key.up:\n            sdk.motion.remote_control_body(0)\n            sdk.motion.remote_control_body(1)\n        elif key == keyboard.Key.down:\n            sdk.motion.remote_control_body(0)\n            sdk.motion.remote_control_body(2)\n        elif key == keyboard.Key.left:\n            sdk.motion.remote_control_body(0)\n            sdk.motion.remote_control_body(3)\n        elif key == keyboard.Key.right:\n            sdk.motion.remote_control_body(0)\n            sdk.motion.remote_control_body(4)\n        elif key == keyboard.Key.space:\n            sdk.motion.remote_control_body(0)\n\nlistener = keyboard.Listener(on_press=on_press)\nlistener.start()\nlistener.join()\n<\/code><\/pre>\n\n\n\n<p>\u8acb\u4f7f\u7528\u65b9\u5411\u9375\u9032\u884c\u63a7\u5236\uff0c\u4e26\u53ef\u4f7f\u7528Esc\u9375\u96e2\u958b\u63a7\u5236\u7a0b\u5f0f\u5594\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6a5f\u5668\u4eba\u6700\u91cd\u8981\u529f\u80fd\u4e4b\u4e00\uff0c\u9664\u4e86\u8aaa\u8a71\u4e4b\u5916\uff0c\u61c9\u8a72\u5c31\u662f\u8981\u80fd\u5920\u52d5\u4e00\u52d5\u5427\u3002\u9019\u4e00\u7bc7\u6587\u7ae0\u4e2d\u5c31\u4f86\u770b\u770bZenbo Python SDK\u4e2d\u63d0\u4f9b\u4e86\u54ea\u4e9b\u53ef\u4ee5\u63a7\u5236\u79fb\u52d5\u7684\u51fd\u5f0f\u3002<\/p>\n","protected":false},"author":1,"featured_media":2152,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-2043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-asus-zenbo"],"jetpack_featured_media_url":"https:\/\/104.es\/wp-content\/uploads\/2023\/05\/zenbo2.jpg","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=2043"}],"version-history":[{"count":1,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2043\/revisions"}],"predecessor-version":[{"id":2155,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/2043\/revisions\/2155"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media\/2152"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=2043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=2043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=2043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}