{"id":345386,"date":"2024-02-29T10:39:49","date_gmt":"2024-02-29T01:39:49","guid":{"rendered":"https:\/\/techshare.co.jp\/faq\/?p=345386"},"modified":"2024-10-30T13:40:15","modified_gmt":"2024-10-30T04:40:15","slug":"go2_obstacle_avoidance_sdk","status":"publish","type":"post","link":"https:\/\/techshare.co.jp\/faq\/unitree\/go2_obstacle_avoidance_sdk.html","title":{"rendered":"\u3010Unitree Go2\u3011 SDK,ROS\u304b\u3089\u969c\u5bb3\u7269\u691c\u77e5ON\/OFF\u306b\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<h3>\u521d\u3081\u306b<\/h3>\n<hr \/>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u306e\u969c\u5bb3\u7269\u691c\u77e5\u6a5f\u80fd\u3092\uff12\u6b21\u958b\u767a\u3067\u6d3b\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3054\u6848\u5185\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u74b0\u5883<\/h3>\n<hr \/>\n<p>\u74b0\u5883\u306f\u3001\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u6a5f\u7a2e: Go2 <strong>R&amp;D(Edu), R&amp;D+(Edu+)<\/strong>\uff08AIR\/PRO\u3067\u306f\u306a\u3044\u3082\u306e\uff09<\/li>\n<li>\u5916\u90e8PC or Docking Staion\u306eOrin\u3092\u4f7f\u7528\u3059\u308b<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>\uff11\uff0e\u969c\u5bb3\u7269\u691c\u77e5\u6a5f\u80fd\u3092\u4f7f\u3048\u308b\u6761\u4ef6<\/h3>\n<hr \/>\n<p>\u7d50\u8ad6\u304b\u3089\u66f8\u304f\u3068\u3001ROS2\u30c8\u30d4\u30c3\u30af\u306b\u306f\u969c\u5bb3\u7269\u691c\u77e5\u306eON\/OFF\u3092\u5236\u5fa1\u3067\u304d\u308b\u30c8\u30d4\u30c3\u30af\u306f\u306a\u304f\u3001SDK\u304b\u3089\u306e\u307f\u969c\u5bb3\u7269\u691c\u77e5\u306eON\/OFF\u304c\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u901a\u5e38\u306e\u901f\u5ea6\u6307\u4ee4\u306e\u65b9\u6cd5\u3060\u3068\u969c\u5bb3\u7269\u691c\u77e5\u3092ON\u306b\u3057\u3066\u3044\u3066\u3082\u3001\u969c\u5bb3\u7269\u691c\u77e5\u306f\u6a5f\u80fd\u3057\u3066\u304f\u308c\u307e\u305b\u3093\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u6d41\u308c\u3066\u3044\u308bDDS\u30c8\u30d4\u30c3\u30afrt\/wirelesscontroller\u304c\u3001joystick controller\u3068\u540c\u7b49\u306e\u3053\u3068\u3092\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304b\u3089\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u3053\u3061\u3089\u3092\u4f7f\u3048\u3070\u969c\u5bb3\u7269\u56de\u907f\u3092\u4f7f\u3063\u3066\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u95a2\u9023FAQ\uff1a<br \/>\n<a href=\"https:\/\/techshare.co.jp\/faq\/unitree\/unitree-go2_unitree_sdk2.html\">\u3010Unitree Go2\u3011SDK\u306e\u6982\u8981\u306b\u3064\u3044\u3066\u3010unitree_sdk2\u3011<\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>\uff12\uff0e\u969c\u5bb3\u7269\u56de\u907f\u306e\u5b9f\u88c5<\/h3>\n<hr \/>\n<h5>2-1. unitree_sdk2\u3092\u5165\u308c\u308b<\/h5>\n<p>\u5916\u90e8PC or Docking Station\u306e\u9069\u5f53\u306a\u5834\u6240\u306b\u3001<a href=\"https:\/\/github.com\/unitreerobotics\/unitree_sdk2\">unitree_sdk2<\/a>\u3092\u5165\u308c\u307e\u3059\u3002<br \/>\n\u305d\u306e\u5f8c\u3001README\u306e\u624b\u9806\u901a\u308a\u306bbuild\u3092\u884c\u3044\u3001\u6b63\u5e38\u306b\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"prism lang-plain\"><code>$ cd \/path\/to\/unitree_sdk2\r\n$ sudo .\/install.sh\r\n$ mkdir build\r\n$ cd build\r\n$ cmake ..\r\n$ make<\/code><\/pre>\n<p>\u95a2\u9023FAQ\uff1a<br \/>\n<a href=\"https:\/\/techshare.co.jp\/faq\/unitree\/unitree-go2_pc_lan.html\">\u3010Unitree Go2\u3011\u5916\u90e8PC\u304b\u3089SDK or ROS\u3092\u4f7f\u3046\u65b9\u6cd5<\/a><\/p>\n<h5>2-2. \u969c\u5bb3\u7269\u56de\u907f\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3059\u308b<\/h5>\n<p>\u969c\u5bb3\u7269\u56de\u907f\u3092\u4f7f\u3046\u305f\u3081\u306b\u306fobstacle_avoid_client.hpp\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3057\u3001\u305d\u306eAPI\u3092\u4f7f\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u5f0a\u793e\u3067\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u308c\u3092unitree_sdk2\u5185\u306e\u9069\u5f53\u306a\u5834\u6240\u306b\u7f6e\u304d\u307e\u3059\u3002<br \/>\n\u305d\u306e\u5f8c\u3001\u9069\u5207\u306aCMakeLists.txt\u3092\u4f5c\u6210\u3057\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"prism lang-cpp\"><code>#include &lt;unitree\/robot\/go2\/obstacles_avoid\/obstacles_avoid_client.hpp&gt;\r\n#include &lt;iostream&gt;\r\n#include &lt;cstdlib&gt; \/\/ \u8ffd\u52a0: atoi\u95a2\u6570\u306e\u305f\u3081\r\n \r\nint main(int argc, char* argv[]) \/\/ \u5f15\u6570\u3092\u53d7\u3051\u53d6\u308b\u3088\u3046\u306b\u5909\u66f4\r\n{\r\n    \/*\r\n     * Initialize ChannelFactory\r\n     *\/\r\n    unitree::robot::ChannelFactory::Instance()->Init(0);\r\n    unitree::robot::go2::ObstaclesAvoidClient oac;\r\n \r\n    std::cout << std::boolalpha;\r\n \r\n    oac.SetTimeout(5.0f);\r\n    oac.Init();\r\n \r\n    bool is_avoid;\r\n    bool set_avoid = true; \/\/ \u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f true \u306b\u8a2d\u5b9a\r\n \r\n    \/\/ \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u5f15\u6570\u304b\u3089\u969c\u5bb3\u7269\u56de\u907f\u306e\u8a2d\u5b9a\u3092\u8aad\u307f\u53d6\u308b\r\n    if (argc > 1) { \/\/ \u5f15\u6570\u304c\u4e0e\u3048\u3089\u308c\u305f\u5834\u5408\r\n        set_avoid = atoi(argv[1]) != 0; \/\/ 0 \u4ee5\u5916\u306e\u5024\u306a\u3089 true\u30010 \u306a\u3089 false\r\n    }\r\n \r\n    int32_t ret = oac.Get(is_avoid);\r\n    std::cout << \"\u969c\u5bb3\u7269\u56de\u907f\u6a5f\u80fd\u306e\u72b6\u614b\u53d6\u5f97\u7d50\u679c: \u623b\u308a\u5024 = \" << ret << \", \u73fe\u5728\u306e\u8a2d\u5b9a = \" << (is_avoid ? \"\u6709\u52b9\" : \"\u7121\u52b9\") << std::endl;\r\n \r\n    ret = oac.Set(set_avoid);\r\n    std::cout << \"\u969c\u5bb3\u7269\u56de\u907f\u6a5f\u80fd\u3092\" << (set_avoid ? \"\u6709\u52b9\" : \"\u7121\u52b9\") << \"\u306b\u8a2d\u5b9a: \u623b\u308a\u5024 = \" << ret << std::endl;\r\n \r\n    ret = oac.Get(is_avoid);\r\n    std::cout << \"\u8a2d\u5b9a\u5f8c\u306e\u969c\u5bb3\u7269\u56de\u907f\u6a5f\u80fd\u306e\u72b6\u614b\u53d6\u5f97\u7d50\u679c: \u623b\u308a\u5024 = \" << ret << \", \u73fe\u5728\u306e\u8a2d\u5b9a = \" << (is_avoid ? \"\u6709\u52b9\" : \"\u7121\u52b9\") << std::endl;\r\n \r\n    usleep(1000);\r\n \r\n    return 0;\r\n}<\/code><\/pre>\n<h5>2-3. \u5b9f\u884c\u3059\u308b<\/h5>\n<p>\u4e0a\u3067\u4f5c\u3063\u305f\u969c\u5bb3\u7269\u56de\u907f\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u56de\u3059\u3068\u3001\u969c\u5bb3\u7269\u691c\u77e5\u306eON\/OFF\u3092\u5207\u308a\u66ff\u3048\u305f\u5834\u5408\u3001go2\u304c\u3057\u3083\u3079\u3063\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066ON\u306e\u72b6\u614b\u3067\u3001sdk\u306eexample\u306ewireless\u3068\u3044\u3046\u3082\u306e\u3092\u52d5\u304b\u3059\u3068\u969c\u5bb3\u7269\u56de\u907f\u304cON\u306e\u72b6\u614b\u3067\u305d\u306e\u5834\u3067\u65cb\u56de\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/techshare.co.jp\/faq\/wp-content\/uploads\/2024\/02\/go2_obstacle_avoid.png\" alt=\"\" width=\"100%\" \/><\/p>\n<p>\u306a\u304a\u52d5\u304d\u3092\u6b62\u3081\u308b\u5834\u5408\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u6b62\u3081\u305f\u5f8c\u306b\u3001joystick\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u9069\u5f53\u306b\u52d5\u304b\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>\u304a\u308f\u308a\u306b<\/h3>\n<p>Go2\u306e\u969c\u5bb3\u7269\u56de\u907f\u306e\uff12\u6b21\u958b\u767a\u5229\u7528\u65b9\u6cd5\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u8a18\u4e8b\u304c\u5c11\u3057\u3067\u3082\u5f79\u306b\u7acb\u3066\u305f\u306e\u306a\u3089\u5e78\u3044\u3067\u3059\u3002<\/p>\n<p>\u203b\u8aa4\u5b57\u8131\u5b57\u3001\u4e0d\u660e\u70b9\u7b49\u3054\u3056\u3044\u307e\u3057\u305f\u3089\u9060\u616e\u306a\u304f\u554f\u3044\u5408\u308f\u305b\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521d\u3081\u306b \u672c\u8a18\u4e8b\u3067\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u6a5f\u80fd\u306e\u969c\u5bb3\u7269\u691c\u77e5\u6a5f\u80fd\u3092\uff12\u6b21\u958b\u767a\u3067\u6d3b\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3054\u6848\u5185\u3057\u307e\u3059\u3002 &nbsp; \u74b0\u5883 \u74b0\u5883\u306f\u3001\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002 \u6a5f\u7a2e: Go2 R&amp;D(Edu), R&amp;D+ &hellip;<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72,26,51],"tags":[],"class_list":["post-345386","post","type-post","status-publish","format-standard","hentry","category-go2","category-unitree","category-unitree-tips"],"_links":{"self":[{"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/posts\/345386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/comments?post=345386"}],"version-history":[{"count":9,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/posts\/345386\/revisions"}],"predecessor-version":[{"id":345457,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/posts\/345386\/revisions\/345457"}],"wp:attachment":[{"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/media?parent=345386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/categories?post=345386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techshare.co.jp\/faq\/wp-json\/wp\/v2\/tags?post=345386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}