{"id":421,"date":"2026-03-09T11:00:33","date_gmt":"2026-03-09T03:00:33","guid":{"rendered":"https:\/\/docs.liuyaorobot.com\/?post_type=docs&#038;p=421"},"modified":"2026-03-09T11:45:01","modified_gmt":"2026-03-09T03:45:01","slug":"%e9%99%84%e5%bd%95-%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88","status":"publish","type":"docs","link":"https:\/\/docs.liuyaorobot.com\/?docs=%e5%9f%ba%e7%a1%80%e5%87%86%e5%a4%87\/%e9%99%84%e5%bd%95-%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98%e5%8f%8a%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88","title":{"rendered":"\u9644\u5f55 \u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"\n<p><strong>1. \u65e0\u4eba\u673a\u5728\u8f83\u5927\u7a7a\u95f4\u5982\u4f53\u80b2\u9986\u8bd5\u98de\u65f6\uff0c\u5931\u63a7\u76f4\u63a5\u5f80\u4e0a\u4e00\u76f4\u98de<\/strong> \u8fd9\u79cd\u60c5\u51b5\u4e00\u822c\u662f\u6fc0\u5149\u96f7\u8fbe\u5b9a\u4f4d\u5f02\u5e38\uff0c\u5f71\u54cdMID360\u6fc0\u5149\u96f7\u8fbe\u5b9a\u4f4d\u6548\u679c\u7684\u56e0\u7d20\uff1a <strong>\u2460\u98de\u884c\u573a\u5730<\/strong> px4\u5728\u878d\u5408\u6fc0\u5149\u96f7\u8fbe\u5b9a\u4f4d\u7684\u60c5\u51b5\u4e0b\uff0c\u6fc0\u5149\u96f7\u8fbe\u5728\u5f00\u9614\u573a\u5730\u83b7\u53d6\u4e0d\u5230\u8fb9\u754c\u4fe1\u606f\uff0c\u5bb9\u6613\u5bfc\u81f4\u96f7\u8fbe\u5b9a\u4f4d\u5f02\u5e38\u3002 <strong>\u2461\u73af\u5883\u5149\u7167\u6761\u4ef6<\/strong> \u6fc0\u5149\u96f7\u8fbe\u901a\u5e38\u4f7f\u7528\u6fc0\u5149\u8109\u51b2\u8fdb\u884c\u8ddd\u79bb\u6d4b\u91cf\uff0c\u5e76\u4f9d\u8d56\u53cd\u5c04\u56de\u6765\u7684\u4fe1\u53f7\u6765\u6784\u5efa\u73af\u5883\u7684\u4e09\u7ef4\u56fe\u50cf\u3002\u5728\u6781\u7aef\u7684\u5149\u7167\u6761\u4ef6\u4e0b\uff0c\u5982\u5f3a\u70c8\u7684\u9633\u5149\u6216\u591c\u95f4\u4f4e\u5149\u73af\u5883\uff0c\u6fc0\u5149\u96f7\u8fbe\u7684\u6027\u80fd\u53ef\u80fd\u4f1a\u53d7\u5230\u5f71\u54cd\u3002 <strong>\u2462\u7269\u4f53\u8868\u9762\u7684\u53cd\u5c04\u7279\u6027<\/strong> \u6fc0\u5149\u96f7\u8fbe\u7684\u5de5\u4f5c\u539f\u7406\u4f9d\u8d56\u4e8e\u4ece\u7269\u4f53\u8868\u9762\u53cd\u5c04\u56de\u6765\u7684\u6fc0\u5149\u4fe1\u53f7\uff0c\u56e0\u6b64\u7269\u4f53\u7684\u8868\u9762\u7279\u6027\u76f4\u63a5\u5f71\u54cd\u96f7\u8fbe\u7684\u63a2\u6d4b\u6548\u679c\u3002\u5149\u6ed1\u3001\u5e73\u5766\u7684\u8868\u9762\uff08\u5982\u955c\u9762\u6216\u6c34\u9762\uff09\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6fc0\u5149\u4fe1\u53f7\u7684\u53cd\u5c04\u65b9\u5411\u4e0d\u7a33\u5b9a\uff0c\u5f71\u54cd\u4f20\u611f\u5668\u7684\u4fe1\u53f7\u63a5\u6536\u548c\u5b9a\u4f4d\u7cbe\u5ea6\u3002 <strong>\u2463\u79ef\u70ed\u95ee\u9898<\/strong> MID360 \u6fc0\u5149\u96f7\u8fbe\u5728\u5de5\u4f5c\u65f6\u4f1a\u4ea7\u751f\u4e00\u5b9a\u7684\u79ef\u70ed\uff0c\u4e3b\u8981\u6765\u6e90\u4e8e\u6fc0\u5149\u53d1\u5c04\u5668\u3001\u5904\u7406\u5668\u548c\u7535\u6e90\u7cfb\u7edf\u3002\u6e29\u5ea6\u8fc7\u9ad8\u65f6\uff0c\u6fc0\u5149\u96f7\u8fbe\u7684\u7535\u5b50\u5143\u4ef6\u53ef\u80fd\u4f1a\u51fa\u73b0\u4e0d\u7a33\u5b9a\uff0c\u5bfc\u81f4\u7cfb\u7edf\u5d29\u6e83\u6216\u8fd0\u884c\u5f02\u5e38\u3002\u7279\u522b\u662f\u5728\u591a\u4f20\u611f\u5668\u878d\u5408\u7684\u7cfb\u7edf\u4e2d\uff0c\u79ef\u70ed\u53ef\u80fd\u4f1a\u5f71\u54cd\u4f20\u611f\u5668\u4e4b\u95f4\u7684\u534f\u540c\u5de5\u4f5c\uff0c\u9020\u6210\u7cfb\u7edf\u6574\u4f53\u6027\u80fd\u4e0b\u964d\u3002<\/p>\n\n\n\n<p><strong>2. \u5728\u5b9e\u673a\u4e0a\u8fd0\u884c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736914554912.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u9996\u5148\u786e\u8ba4NX\u548c\u98de\u63a7\u6570\u636e\u7ebf\u662f\u5426\u8fde\u63a5\u65e0\u8bef\uff0c\u5982\u679c\u8fde\u63a5\u6b63\u5e38\u6253\u5f00\u7ec8\u7aef\u8f93\u5165sudo chmod 777 \/dev\/ttyACM0\u3002\u5982\u679c\u90fd\u89e3\u51b3\u4e0d\u4e86\u5219\u5c06\u98de\u63a7\u8fde\u63a5\u5730\u9762\u7ad9\uff0c\u53c2\u6570\u4e2d\u641c\u7d22SYS_COMPANION\u786e\u8ba4\u6ce2\u7279\u7387\u662f\u5426\u548ctutorial_basic\/launch\/mavros.launch\u4e2d\u8bbe\u7f6e\u7684\u6ce2\u7279\u7387\u4e00\u81f4\u3002<\/p>\n\n\n\n<p><strong>3. \u5728\u5b9e\u673a\u4e0a\u8fd0\u884c\u7a0b\u5e8f\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736921815771.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u53ef\u80fd\u662f\u6587\u4ef6\u6743\u9650\u4e0d\u591f\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u4e3a\u6587\u4ef6\u6dfb\u52a0\u6267\u884c\u6743\u9650\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chmod + x \/\u6587\u4ef6\u8def\u5f84\/\u6587\u4ef6<\/pre>\n\n\n\n<p><strong>4. \u5728\u4eff\u771f\u73af\u5883\u4e2d\u8fd0\u884cgazebo\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736923324630.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u865a\u62df\u673a\u7cfb\u7edf\u5185\u5b58\u4e0d\u8db3\uff0c\u5c1d\u8bd5\u4fee\u6539\u865a\u62df\u673a\u5185\u5b58\u914d\u7f6e\u3002<\/p>\n\n\n\n<p><strong>5. \u5728\u4eff\u771f\u73af\u5883\u4e2d\u8fd0\u884cgazebo\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736923959921.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7cfb\u7edf\u68c0\u6d4b\u5230\u65f6\u95f4\u6233\u7684\u4e0d\u6b63\u5e38\u53d8\u5316\uff0c\u5bfc\u81f4\u65f6\u95f4\u540c\u6b65\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002\u53ef\u80fd\u662f\u7cfb\u7edf\u65f6\u95f4\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u4fdd\u8bc1ROS\u65f6\u95f4\u548c\u7cfb\u7edf\u65f6\u95f4\u4e00\u81f4\u3002<\/p>\n\n\n\n<p><strong>6. \u5728\u4eff\u771f\u73af\u5883\u98de\u673a\u98de\u884c\u8fc7\u7a0b\u4e2d\uff0c\u98de\u673a\u5df2\u7ecf\u98de\u5230\u7b2c\u56db\u4e2a\u70b9\uff0crqt\u4e2d\u56fe\u50cf\u8fd8\u663e\u793a\u7684\u662f\u7b2c\u4e00\u4e2a\u70b9<\/strong> \u8fd9\u79cd\u60c5\u51b5\u662f\u753b\u9762\u5ef6\u8fdf\uff0c\u5982\u679c\u6ca1\u8bc6\u522b\u98de\u673a\u4f1a\u505c\u5728\u7b2c\u4e00\u4e2a\u70b9\u800c\u4e0d\u662f\u98de\u5f80\u540e\u9762\u7684\u70b9\u3002<\/p>\n\n\n\n<p><strong>7. \u5728\u5b9e\u673a\u62c6\u6868\u8fd0\u884crun_craic_task.launch\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736924280090.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5728\u4f7f\u7528\u970d\u592b\u53d8\u6362\u65f6\uff0c\u8c03\u7528detect\u51fd\u6570\u51fa\u73b0\u4e86minRadius_ \u548c maxRadius_ \u53c2\u6570\u7684\u503c\u4e0d\u7b26\u5408\u8981\u6c42\u7684\u60c5\u51b5\u3002minRadius_&nbsp;\u5fc5\u987b\u5927\u4e8e0\uff0c\u800c\u4e14&nbsp;maxRadius_&nbsp;\u5fc5\u987b\u5927\u4e8e&nbsp;minRadius_\u3002<\/p>\n\n\n\n<p><strong>8. \u5728\u5b9e\u673a\u4e0a\u542f\u52a8\u6444\u50cf\u5934\u8282\u70b9\u65f6\uff0c\u6444\u50cf\u5934\u6253\u4e0d\u5f00\u5e76\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736924401600.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u8282\u70b9 qr_detector \u7684\u8fdb\u7a0b\u5d29\u6e83\u5e76\u9000\u51fa\uff0cqr_detector.py\u6587\u4ef6\u5185\u4ee3\u7801\u53ef\u80fd\u6709\u95ee\u9898\uff0c\u53ef\u80fd\u9700\u8c03\u51fa\u65e5\u5fd7\u67e5\u770b\u66f4\u8be6\u7ec6\u539f\u56e0\u3002<\/p>\n\n\n\n<p><strong>9. \u5b9e\u673a\u4e0a\u8fd0\u884cqr_detector.launch\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/1736924497587.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7f3a\u5c11pyzbar\u6a21\u5757\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo pip install pyzbar &amp;&amp; sudo apt install libzbar-dev<\/pre>\n\n\n\n<p><strong>10. \u4ee3\u7801\u4e2d\u6709\u4e24\u79cd\u901f\u5ea6\u63a7\u5236\u7684\u65b9\u6cd5\uff0c\u4e00\u79cd\u662f move_base_cmd_vel_cb()\uff0c\u4e00\u79cd\u662f get_pid_vel()\uff0c\u8fd9\u4e24\u79cd\u901f\u5ea6\u63a7\u5236\u6709\u4f55\u533a\u522b\uff1f<\/strong> 1\uff09\u56de\u8c03\u51fd\u6570\u63a7\u5236\uff08\u57fa\u4e8e\u5916\u90e8\u547d\u4ee4\u7684\u901f\u5ea6\u63a7\u5236\uff09 \u25cf \u5e94\u7528\u573a\u666f\uff1a\u8fd9\u662f\u57fa\u4e8e\u5916\u90e8\u8f93\u5165\u7684\u63a7\u5236\u65b9\u5f0f\uff0c\u901a\u5e38\u7528\u4e8e\u901a\u8fc7\u4f20\u611f\u5668\u3001\u7528\u6237\u8f93\u5165\u6216\u5916\u90e8\u7cfb\u7edf\u53d1\u9001\u901f\u5ea6\u547d\u4ee4\u3002 \u25cf \u5de5\u4f5c\u539f\u7406\uff1a\u901a\u8fc7\u56de\u8c03\u51fd\u6570 move_base_cmd_vel_cb \u63a5\u6536\u5916\u90e8\u53d1\u9001\u7684\u901f\u5ea6\u547d\u4ee4\uff08geometry_msgs::Twist\uff09\uff0c\u5e76\u66f4\u65b0\u673a\u5668\u4eba\u5f53\u524d\u7684\u901f\u5ea6\u6307\u4ee4\u3002 \u25cf \u63a7\u5236\u65b9\u5f0f\uff1a\u5916\u90e8\u7cfb\u7edf\u53d1\u9001\u4e00\u4e2a Twist \u6d88\u606f\uff0c\u5176\u4e2d\u5305\u542b\u673a\u5668\u4eba\u7684\u7ebf\u6027\u901f\u5ea6\uff08linear.x, linear.y, linear.z\uff09\u548c\u89d2\u901f\u5ea6\uff08angular.x, angular.y, angular.z\uff09\u3002 \u25cf \u76f4\u63a5\u8d4b\u503c\uff1a\u63a5\u6536\u5230\u901f\u5ea6\u547d\u4ee4\u540e\uff0c\u76f4\u63a5\u5c06\u5176\u8d4b\u503c\u7ed9 move_base_twist\uff0c\u63a7\u5236\u673a\u5668\u4eba\u6309\u7167\u5916\u90e8\u7cfb\u7edf\u6307\u5b9a\u7684\u901f\u5ea6\u8fdb\u884c\u8fd0\u52a8\u3002 2\uff09PID \u63a7\u5236\uff08\u57fa\u4e8e\u4f4d\u7f6e\u4e0e\u822a\u5411\u7684\u63a7\u5236\uff09 \u25cf \u5e94\u7528\u573a\u666f\uff1a\u8fd9\u662f\u7528\u4e8e\u81ea\u6211\u8c03\u6574\u7684\u63a7\u5236\u7b56\u7565\uff0c\u901a\u5e38\u7528\u4e8e\u673a\u5668\u4eba\u81ea\u52a8\u5bfc\u822a\u6216\u8005\u81ea\u4e3b\u8fd0\u52a8\u65f6\uff0c\u63a7\u5236\u673a\u5668\u4eba\u5728\u4e09\u7ef4\u7a7a\u95f4\u5185\u7684\u4f4d\u7f6e\u548c\u671d\u5411\u3002 \u25cf \u5de5\u4f5c\u539f\u7406\uff1aPID \u63a7\u5236\u5668\u4f7f\u7528\u4f4d\u7f6e\u8bef\u5dee\uff08err\uff09\u548c\u822a\u5411\u8bef\u5dee\uff08y_err\uff09\u6765\u8ba1\u7b97\u76ee\u6807\u901f\u5ea6\u3002 \u25cf \u4f4d\u7f6e\u8bef\u5dee\uff1a\u8ba1\u7b97\u76ee\u6807\u4f4d\u7f6e\u548c\u5f53\u524d\u673a\u5668\u4eba\u4f4d\u7f6e\u4e4b\u95f4\u7684\u5dee\u8ddd\uff0c\u5e76\u6839\u636e\u8bef\u5dee\u5927\u5c0f\u8ba1\u7b97\u6240\u9700\u7684\u7ebf\u6027\u901f\u5ea6\uff08ret.linear.x\u3001ret.linear.y\u3001ret.linear.z\uff09\u3002 \u25cf \u822a\u5411\u8bef\u5dee\uff1a\u8ba1\u7b97\u673a\u5668\u4eba\u5f53\u524d\u671d\u5411\u4e0e\u76ee\u6807\u671d\u5411\u4e4b\u95f4\u7684\u8bef\u5dee\uff0c\u5e76\u901a\u8fc7 PID \u63a7\u5236\u6765\u8c03\u6574\u89d2\u901f\u5ea6\uff08ret.angular.z\uff09\u3002 \u25cf PID \u8c03\u8282\uff1a\u5229\u7528\u4f4d\u7f6e\u8bef\u5dee\u548c\u822a\u5411\u8bef\u5dee\u7684\u6bd4\u4f8b\uff08P\uff09\u3001\u8bef\u5dee\u7684\u7d2f\u79ef\uff08I\uff09\u3001\u8bef\u5dee\u7684\u53d8\u5316\u901f\u7387\uff08D\uff09\u6765\u751f\u6210\u901f\u5ea6\u547d\u4ee4\u3002\u8fd9\u79cd\u65b9\u5f0f\u901a\u8fc7\u4e0d\u65ad\u4fee\u6b63\u8bef\u5dee\uff0c\u9010\u6b65\u903c\u8fd1\u76ee\u6807\u4f4d\u7f6e\u3002 \u25cf \u91cd\u7f6e\u673a\u5236\uff1a\u5982\u679c\u65f6\u95f4\u95f4\u9694\u5927\u4e8e\u67d0\u4e2a\u9608\u503c\uff08\u5982 0.2 \u79d2\uff09\uff0c\u8bef\u5dee\u548c\u8bef\u5dee\u7d2f\u79ef\u5c06\u88ab\u91cd\u7f6e\uff0c\u4ee5\u907f\u514d\u63a7\u5236\u8bef\u5dee\u8fc7\u5927\u3002<\/p>\n\n\n\n<p><strong>11. twist.twist.angular.z \u662f\u4ec0\u4e48\u542b\u4e49\uff1f<\/strong> twist.twist.angular.z \u8868\u793a\u7684\u662f\u65e0\u4eba\u673a\u7684\u89d2\u901f\u5ea6\uff0c\u5b83\u4e3b\u8981\u63a7\u5236\u65e0\u4eba\u673a\u7684\u65cb\u8f6c\uff08\u504f\u822a\u89d2\u5ea6\u7684\u53d8\u5316\uff09\u3002\u65cb\u8f6c\u7684\u76ee\u7684\u662f\u8ba9\u65e0\u4eba\u673a\u80fd\u591f\u8c03\u6574\u5176\u822a\u5411\uff0c\u786e\u4fdd\u5b83\u671d\u7740\u6b63\u786e\u7684\u65b9\u5411\u98de\u884c\u3002<\/p>\n\n\n\n<p><strong>12. std::max(-1.57, std::min(1.57, -current_rpy.z)); -1.57\u8fd9\u4e2a\u503c\u4f3c\u4e4e\u662f\u03c0\/2\uff0c\u63a7\u5236\u89d2\u5ea6\u7684\u76ee\u7684\u662f\u4ec0\u4e48\uff1f<\/strong> \u8fd9\u884c\u4ee3\u7801\u7684\u4f5c\u7528\u662f\u5c06 -current_rpy.z \u7684\u503c\u9650\u5236\u5728 -\u03c0\/2 \u5230 +\u03c0\/2\uff08\u5373 -1.57 \u5230 +1.57\uff09\u4e4b\u95f4\u3002\u8fd9\u4e2a\u8303\u56f4\u901a\u5e38\u7528\u4e8e\u9650\u5236\u65cb\u8f6c\u89d2\u5ea6\uff0c\u9632\u6b62\u65cb\u8f6c\u8fc7\u5927\uff0c\u786e\u4fdd\u8fd0\u52a8\u7cfb\u7edf\uff08\u4f8b\u5982\u673a\u5668\u4eba\u3001\u98de\u884c\u5668\u7b49\uff09\u5728\u65cb\u8f6c\u63a7\u5236\u65f6\u4e0d\u53d1\u751f\u8fc7\u5ea6\u65cb\u8f6c\u3002<\/p>\n\n\n\n<p><strong>13. \u5728\u4eff\u771f\u4e0a\u6539\u4e86yolov5\u548c\u970d\u592b\u5706\u68c0\u6d4b\u7684\u4ee3\u7801\u4ee5\u53ca\u66ff\u6362replace\uff08\u90e8\u5206\u4ee3\u7801\u7684gpu\u7248\u672c\uff09\u62a5\u4e86\u4e0b\u9762\u7684\u9519\u8bef<\/strong> \u4fee\u6539\u76f8\u5173\u4ee3\u7801\u53ca\u66ff\u6362replace\u5747\u662f\u5728\u5b9e\u673a\u5b8c\u6210\uff0c\u4ee5\u964d\u4f4e\u5b9e\u673a\u7684cpu\u6027\u80fd\u5360\u7528\uff0c\u5728\u4eff\u771f\u73af\u5883\u4e2d\u6ca1\u6709\u6027\u80fd\u9650\u5236\uff0c\u56e0\u6b64\u4e0d\u9700\u8981\u66ff\u6362\u53ca\u4fee\u6539\u3002<\/p>\n\n\n\n<p><strong>14. std::max(-0.5,std::min(0.5,working_altitude- current_pose.pose.position.z));\u8fd9\u53e5\u4ee3\u7801\u4f3c\u4e4e\u662f\u4e3a\u4e86\u63a7\u5236\u901f\u5ea6\uff0c\u4f46\u662f\uff0c\u7ebf\u901f\u5ea6\u4e3amax\uff08-0.5\uff0cmin\uff080.5,1.0-\u9ad8\u5ea6\uff09\uff09\u7684\u542b\u4e49\u7a76\u7adf\u662f\u4ec0\u4e48\uff1f<\/strong> \u8fd9\u884c\u4ee3\u7801\u7684\u542b\u4e49\u662f\u6839\u636e\u76ee\u6807\u9ad8\u5ea6 working_altitude \u548c\u5f53\u524d\u9ad8\u5ea6 current_pose.pose.position.z \u7684\u5dee\u503c\u6765\u63a7\u5236\u901f\u5ea6\uff0c\u786e\u4fdd\u901f\u5ea6\u5728 -0.5 \u5230 0.5 \u4e4b\u95f4\u3002\u5982\u679c\u5dee\u503c\u5927\u4e8e&nbsp;0.5\uff08\u76ee\u6807\u9ad8\u5ea6\u548c\u5f53\u524d\u9ad8\u5ea6\u5dee\u8ddd\u8f83\u5927\uff09\uff0c\u5219\u6700\u5927\u4e0a\u5347\u901f\u5ea6\u4e3a&nbsp;0.5\u3002\u5982\u679c\u5dee\u503c\u5c0f\u4e8e&nbsp;-0.5\uff08\u76ee\u6807\u9ad8\u5ea6\u4f4e\u4e8e\u5f53\u524d\u9ad8\u5ea6\u592a\u591a\uff09\uff0c\u5219\u6700\u5927\u4e0b\u964d\u901f\u5ea6\u4e3a&nbsp;-0.5\u3002\u901a\u8fc7\u8fd9\u4e2a\u9650\u5236\uff0c\u7cfb\u7edf\u80fd\u591f\u5e73\u7a33\u5730\u63a7\u5236\u4e0a\u5347\u548c\u4e0b\u964d\u901f\u5ea6\uff0c\u907f\u514d\u901f\u5ea6\u8fc7\u5feb\u5bfc\u81f4\u4e0d\u7a33\u5b9a\u6216\u96be\u4ee5\u63a7\u5236\u3002<\/p>\n\n\n\n<p><strong>15.twist.twist.angular.z = std::max(-1.57, std::min(1.57, -current_rpy.z)); \u4f3c\u4e4e\u662f\u901a\u8fc7\u95ed\u73af\u53cd\u9988\u8ba9UAV\u671d\u7740\u6307\u5b9a\u65b9\u5411\uff1f<\/strong> \u95ed\u73af\u63a7\u5236\uff1a\u65e0\u4eba\u673a\u901a\u8fc7\u4e0d\u65ad\u8c03\u6574\u59ff\u6001\uff08\u504f\u822a\u89d2\uff09\u6765\u671d\u7740\u76ee\u6807\u65b9\u5411\u65cb\u8f6c\uff0c\u8fd9\u901a\u5e38\u662f\u901a\u8fc7\u4e00\u4e2a\u63a7\u5236\u5668\uff08\u5982PID\u63a7\u5236\u5668\uff09\u5b9e\u73b0\u7684\u3002 \u89d2\u901f\u5ea6\u9650\u5236\uff1astd::max(-1.57,std::min(1.57, -current_rpy.z))&nbsp;\u662f\u4e00\u4e2a\u7528\u4e8e\u9650\u5236\u89d2\u901f\u5ea6\u7684\u4ee3\u7801\u7247\u6bb5\uff0c\u786e\u4fdd UAV \u7684\u65cb\u8f6c\u4e0d\u4f1a\u8fc7\u5feb\u6216\u8fc7\u6162\uff0c\u786e\u4fdd\u63a7\u5236\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u3002 \u671d\u7740\u76ee\u6807\u65b9\u5411\u8c03\u6574\uff1a\u901a\u8fc7\u53cd\u9988\u63a7\u5236\uff0cUAV \u4f1a\u9010\u6e10\u51cf\u5c0f\u8bef\u5dee\uff0c\u6700\u7ec8\u671d\u7740\u6307\u5b9a\u7684\u65b9\u5411\uff08\u76ee\u6807\u59ff\u6001\uff09\u8c03\u6574\u3002<\/p>\n\n\n\n<p><strong>16. twist.twist.linear.z = std::max(-0.5, std::min(0.5, working_altitude &#8211; current_pose.pose.position.z));\u4f3c\u4e4e\u662f\u8ba9\u65e0\u4eba\u673a\u9ad8\u5ea6\u901a\u8fc7\u95ed\u73af\u53cd\u9988\u8fbe\u5230working_altitude? <\/strong><\/p>\n\n\n\n<p>\u8fd9\u884c\u4ee3\u7801\u7684\u786e\u662f\u5728\u901a\u8fc7\u95ed\u73af\u53cd\u9988\u63a7\u5236\u673a\u5236\u8c03\u8282\u65e0\u4eba\u673a\u7684\u9ad8\u5ea6\uff0c\u4f7f\u5176\u8fbe\u5230\u76ee\u6807\u9ad8\u5ea6\uff08working_altitude\uff09\u3002\u901a\u8fc7\u95ed\u73af\u53cd\u9988\uff0c\u65e0\u4eba\u673a\u4f1a\u6839\u636e\u5f53\u524d\u7684\u9ad8\u5ea6\u548c\u76ee\u6807\u9ad8\u5ea6\u4e4b\u95f4\u7684\u8bef\u5dee\uff0c\u81ea\u52a8\u8c03\u8282\u5782\u76f4\u901f\u5ea6\uff0c\u4ee5\u786e\u4fdd\u76ee\u6807\u9ad8\u5ea6\u7684\u7a33\u5b9a\u6027\u3002\u901f\u5ea6\u7684\u9650\u5236\u786e\u4fdd\u4e86\u65e0\u4eba\u673a\u7684\u4e0a\u5347\u548c\u4e0b\u964d\u4e0d\u4f1a\u8fc7\u5feb\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u98de\u884c\u7684\u5b89\u5168\u6027\u548c\u7a33\u5b9a\u6027\u3002<\/p>\n\n\n\n<p><strong>17. \u4e0d\u4f7f\u7528GPS\u4e5f\u53ef\u4ee5\u89e3\u9501\u65e0\u4eba\u673a\u7684\u53c2\u6570\u4fee\u6539<\/strong><\/p>\n\n\n\n<p>\u5728\u5730\u9762\u7ad9\u2014\u2014\u201c\u53c2\u6570\u201d\u4e2d\u641c\u7d22\u4ee5\u4e0b\u4e24\u4e2a\u53c2\u6570\u5e76\u4fee\u6539: CBRK_IO_SAFETY\uff1a 22027 COM_PREARM_MODE\uff1a always \u6ce8\u610f\uff1a\u4fee\u6539\u540e\u65e0\u4eba\u673a\u901a\u7535\u540e\u5373\u53ef\u89e3\u9501 <strong>18. \u8fd0\u884croslaunch tutorial_catapult catapult_driver.launch\u65f6\u62a5\u9519\uff08\u7f3a\u5c11rosserial\uff09<\/strong><\/p>\n\n\n\n<p><strong>rosserial\u5e93\u7684\u4f5c\u7528\uff1a\u8ba9\u6295\u653e\u88c5\u7f6e\u56fa\u4ef6\u548c\u4e0a\u4f4d\u673a\u901a\u4fe1<\/strong> \u9010\u4e2a\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u540e\u5373\u53ef\u89e3\u51b3\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo sh -c '. \/etc\/lsb-release &amp;&amp; echo \"deb http:\/\/mirrors.ustc.edu.cn\/ros\/ubuntu\/ $DISTRIB_CODENAME main\" &gt; \/etc\/apt\/sources.list.d\/ros-latest.list'<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-key adv --keyserver 'hkp:\/\/keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install ros-noetic-rosserial-python<\/pre>\n\n\n\n<p><strong>19. \u5b9e\u673a\u4e2d\u6d4b\u8bd5\u770b\u4e0d\u5230rqt\u753b\u9762\uff1f<\/strong><\/p>\n\n\n\n<p>\u53ef\u80fd\u6709\u4ee5\u4e0b\u4e24\u4e2a\u539f\u56e0\uff1a 1\uff09\u672a\u5f00\u542f\u6444\u50cf\u5934\uff0c\u9700\u8981\u5148\u542f\u52a8\u6444\u50cf\u5934\u8282\u70b9\u518d\u6253\u5f00rqt\uff0c\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u8fd0\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">roslaunch tutorial_vision simple_camera_driver.launch<\/pre>\n\n\n\n<p>2\uff09\u4f7f\u7528\u4e86ssh\u8fdc\u7a0b\u8fde\u63a5\uff0c\u5728ssh\u8fdc\u7a0b\u8fde\u63a5\u65f6\u662f\u770b\u4e0d\u5230rqt\u7684\uff0c\u5c06\u5c4f\u5e55\u76f4\u8fde\u4e0a\u4f4d\u673a\u624d\u53ef\u770b\u5230rqt\u753b\u9762\u3002<\/p>\n\n\n\n<p><strong>20. \u5728\u5b9e\u673a\u6d4b\u8bd5\u4e2d\u65e0\u6cd5\u8bc6\u522b\u4e8c\u7ef4\u7801\uff1f<\/strong><\/p>\n\n\n\n<p>\u5b9e\u673a\u4e2d\u9700\u5728tutorial_vision\/scripts\/qr_detector.py \u4e2d\u52a0\u6ee4\u6ce2\u5904\u7406\uff1a \u4e2d\u503c\u6ee4\u6ce2\uff1acv_image = cv2.medianBlur(cv_image,5) \u9ad8\u65af\u6ee4\u6ce2\uff1acv_image = cv2.GaussianBlur(cv_image,(5,5),0) \u52a0\u5728qr_detector.py\u7684\u4e0b\u56fe\u4f4d\u7f6e\uff1a <img decoding=\"async\" width=\"80%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/qr_filtering.png\"> <\/p>\n\n\n\n<p><strong>21. \u5728gabezo\u8fd0\u884crun_2025craic\u7684launch\u6587\u4ef6\uff0c\u4ed6\u6700\u540e\u4e00\u76f4\u5361\u5728\u5706\u5708\u524d\uff0c\u4e00\u76f4\u663e\u793a\u201cBegin Calculate Ring Center Position.\u201d\u662f\u4ec0\u4e48\u60c5\u51b5\uff1f<\/strong><\/p>\n\n\n\n<p>\u4eff\u771f\u73af\u5883\u4e2d\u7684\u70b9\u4e91\u6570\u636e\u662fgazebo\u6a21\u62df\u7684\uff0c\u6ca1\u6709\u5b9e\u673a\u4e2d\u96f7\u8fbe\u70b9\u4e91\u6570\u636e\u51c6\u786e\uff0c\u56e0\u4e3a\u53ef\u80fd\u4e0d\u80fd\u6b63\u786e\u8bc6\u522b\u5706\u73af\u5706\u5fc3\uff0c\u4f46\u5728\u5b9e\u673a\u4e2d\u5b58\u5728\u771f\u5b9e\u7684\u96f7\u8fbe\u70b9\u4e91\uff0c\u56e0\u6b64\u6548\u679c\u4f1a\u6bd4\u4eff\u771f\u597d\u3002<\/p>\n\n\n\n<p><strong>22. \u8bf7\u95ee yolo \u56fe\u50cf\u8bc6\u522b\u5728\u4eff\u771f\u80fd\u6b63\u5e38\u8bc6\u522b\uff0c\u5728\u5b9e\u673a\u5c31\u662f\u8bc6\u522b\u4e0d\u4e86\u662f\u4ec0\u4e48\u60c5\u51b5\uff1f<\/strong><\/p>\n\n\n\n<p>\u5728\u73b0\u5b9e\u73af\u5883\u5b58\u5728\u8bb8\u591a\u566a\u58f0\u4e0e\u5e72\u6270\uff0c\u8bc6\u522b\u73af\u5883\u66f4\u52a0\u590d\u6742\uff0c\u9700\u8981\u8bad\u7ec3\u6548\u679c\u66f4\u597d\u7684\u6a21\u578b\u5e76\u5728\u4ee3\u7801\u4e2d\u505a\u4e07\u4e00\u8bc6\u522b\u4e0d\u4e86\u4e5f\u80fd\u7ee7\u7eed\u4efb\u52a1\u7684\u5904\u7406\u3002<\/p>\n\n\n\n<p><strong>23. \u8bad\u7ec3\u6570\u636e\u96c6\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519\uff0ccifar100\u4e5f\u653e\u5728\u6307\u5b9a\u8def\u5f84\u4e0b\u4e86\u600e\u4e48\u89e3\u51b3\uff1f<\/strong><\/p>\n\n\n\n<p><img decoding=\"async\" width=\"60%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/train.png\"> <\/p>\n\n\n\n<p>cifar100\u6570\u636e\u96c6\u672a\u5b8c\u5168\u89e3\u538b\uff08\u6587\u4ef6\u6570\u5f88\u591a\uff09\uff0c\u5efa\u8bae\u5c06zip\u653e\u5728\u6307\u5b9a\u8def\u5f84\u89e3\u538b\uff0c\u5e76\u786e\u8ba4\u5b8c\u5168\u89e3\u538b\u540e\uff08\u6587\u4ef6\u5939\u53f3\u4e0a\u89d2\u4f1a\u6709\u8f6c\u5708\u663e\u793a\uff09\u518d\u8bad\u7ec3\u3002 <\/p>\n\n\n\n<p><strong>24. tutorial\u6587\u4ef6\u7f16\u8bd1\u6253\u5f00\u540erviz\u91cc\u9762\u6ca1\u6709\u70b9\u4e91\u6570\u636e\u662f\u5565\u539f\u56e0\uff1f<\/strong><\/p>\n\n\n\n<p>\u56e0\u4e3a\u4ee3\u7801\u4e2d\u662f\u5c06\u96f7\u8fbe\u70b9\u4e91\u6570\u636e\u5728\u672c\u5730\u4e0a\u4f20\u540erviz\u4e2d\u624d\u4f1a\u51fa\u73b0\u70b9\u4e91\uff0c\u4f46\u4e0a\u4f20\u540e\u7684\u4ee3\u7801\u4e2d\u5305\u542b\u4e86\u672c\u5730ubuntu\u7528\u6237\u540d\u3002\u89e3\u51b3\u529e\u6cd5\uff1a\u5c06tutorials\/tutorial_gazebo\/models\/livox_mid360\u8def\u5f84\u4e0b\u7684model.sdf\u4e2d\u7684\u7b2c69\u884c\/home\u540e\u7684\u7528\u6237\u540d\u6539\u4e3a\u5f53\u524d\u7528\u6237\u540d\uff08jetson\uff09\u3002 <img decoding=\"async\" width=\"80%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/jetson.png\"> <\/p>\n\n\n\n<p><strong>24. \u5728\u5b9e\u673a\u4e2d\u6267\u884croslaunch tutorial_basic mavros.launch\u65f6\u51fa\u73b0\u5982\u4e0b\u62a5\u9519\u662f\u4ec0\u4e48\u95ee\u9898\uff1f<\/strong><\/p>\n\n\n\n<p><img decoding=\"async\" width=\"80%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/ttyacm0.png\"> <\/p>\n\n\n\n<p>\u98de\u63a7\u4e0e\u4e0a\u4f4d\u673a\u8fde\u63a5\u7684\u4e32\u53e3\u5931\u6548\u4e86\uff08\/dev\/ttyACM0\u4e0d\u5b58\u5728\uff09\u3002\u68c0\u67e5\u98de\u63a7\u53f3\u4e0a\u89d2\u7684\u8fde\u7ebf\u7aef\u53e3\u662f\u5426\u677e\u52a8\uff08\u5982\u4e0b\u56fe\uff09\u6216\u5c06\u6b21\u7aef\u53e3\u91cd\u65b0\u62d4\u63d2\uff0c\u7136\u540e\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\uff0c\u8f93\u5165 ls \/dev\/ttyACM0 \u770b\u4e0b\u6709\u6ca1\u6709\u6b64\u4e32\u53e3\u3002 <img decoding=\"async\" width=\"20%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/ttyacm02.png\"> <\/p>\n\n\n\n<p><strong>25. \u5728\u5b9e\u673a\u4e0a\u6267\u884c\u4ee3\u7801\u65f6\u9047\u5230\u5982\u4e0b\u62a5\u9519\uff1f<\/strong><\/p>\n\n\n\n<p><img decoding=\"async\" width=\"60%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/remake.png\"> <\/p>\n\n\n\n<p>\u5c06catkin_ws\/src\u4e0b\u7684build devel\u6587\u4ef6\u5939\u5220\u9664\u5e76\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u8f93\u5165catkin_make \u91cd\u65b0\u7f16\u8bd1\u540e\u518d\u6267\u884c\u3002 <\/p>\n\n\n\n<p><strong>26. \u5728\u5b9e\u673a\u4e0a\u7f16\u8bd1\u65f6\u78b0\u5230\u65f6\u949f\u68c0\u6d4b\u9519\u8bef\u7684\u8b66\u544a\uff1f<\/strong><\/p>\n\n\n\n<p><img decoding=\"async\" width=\"60%\" src=\"https:\/\/static.simuro.liuyaorobot.com\/archive\/tutorial2025\/img\/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20250618160115.jpg\"> <\/p>\n\n\n\n<p>\u4e0a\u4f4d\u673a\u5728\u91cd\u542f\u540e\u5982\u679c\u6ca1\u6709\u8fde\u63a5wifi\uff0c\u65f6\u95f4\u4f1a\u91cd\u7f6e\uff0c\u9020\u6210\u4e4b\u524d\u4fee\u6539\u6216\u7f16\u8bd1\u7684\u65f6\u95f4\u548c\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\u51b2\u7a81\uff0c\u5bfc\u81f4\u7f16\u8bd1\u4e0d\u80fd\u751f\u6548\u3002\u6709\u4e24\u79cd\u89e3\u51b3\u529e\u6cd5\uff1a 1\uff09\u7ed9\u4e0a\u4f4d\u673a\u8fde\u63a5wifi\uff08\u8fde\u7f51\uff09\u8ba9\u7cfb\u7edf\u65f6\u95f4\u548c\u5b9e\u9645\u65f6\u95f4\u4e00\u81f4 2\uff09\u901a\u8fc7\u547d\u4ee4\u8bbe\u7f6e\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\uff0c\u547d\u4ee4\u884c\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo date -s \"2025-06-18 15:55:00\" #\"\"\u5185\u4e3a\u5f53\u524d\u65f6\u95f4<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u65e0\u4eba\u673a\u5728\u8f83\u5927\u7a7a\u95f4\u5982\u4f53\u80b2\u9986\u8bd5\u98de\u65f6\uff0c\u5931\u63a7\u76f4\u63a5\u5f80\u4e0a\u4e00\u76f4\u98de \u8fd9\u79cd\u60c5\u51b5\u4e00\u822c\u662f\u6fc0\u5149\u96f7\u8fbe\u5b9a\u4f4d\u5f02\u5e38\uff0c\u5f71\u54cdMID360\u6fc0\u5149 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"parent":383,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","categories":[],"doc_label":[],"doc_tag":[],"class_list":["post-421","docs","type-docs","status-publish","format-standard","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/docs\/421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=421"}],"version-history":[{"count":1,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/docs\/421\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/docs\/421\/revisions\/422"}],"up":[{"embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=\/wp\/v2\/docs\/383"}],"wp:attachment":[{"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=421"},{"taxonomy":"doc_label","embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_label&post=421"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/docs.liuyaorobot.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}