{"id":93080,"date":"2026-08-11T20:56:49","date_gmt":"2026-08-11T12:56:49","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/93080.html"},"modified":"2026-08-11T20:56:49","modified_gmt":"2026-08-11T12:56:49","slug":"%e9%b1%bc%e9%a6%99ros2%e5%9f%ba%e6%9c%ac%e5%8a%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/93080.html","title":{"rendered":"\u9c7c\u9999ROS2\u57fa\u672c\u529f"},"content":{"rendered":"<h4>1. ROS 2 \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>ROS 2 \u662f\u4e00\u5957\u7528\u6765\u642d\u5efa\u673a\u5668\u4eba\u8f6f\u4ef6\u7cfb\u7edf\u7684\u6846\u67b6\u548c\u5de5\u5177\u96c6\u5408\u3002<\/p>\n<p>\u5b83\u540d\u5b57\u53eb Robot Operating System&#xff0c;\u4f46\u4e0d\u8981\u628a\u5b83\u7406\u89e3\u6210 Windows\u3001Ubuntu \u90a3\u79cd\u5b8c\u6574\u64cd\u4f5c\u7cfb\u7edf\u3002ROS 2 \u662f\u8fd0\u884c\u5728 Ubuntu \u4e0a\u9762\u7684\u673a\u5668\u4eba\u8f6f\u4ef6\u5e73\u53f0\u3002<\/p>\n<p>\u673a\u5668\u4eba\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5e72\u6240\u6709\u4e8b\u60c5&#xff0c;\u800c\u662f\u5f88\u591a\u6a21\u5757&#xff1a;<\/p>\n<p>\u96f7\u8fbe\u7a0b\u5e8f<br \/>\n   \u2193<br \/>\nSLAM\u5efa\u56fe<br \/>\n   \u2193<br \/>\n\u5b9a\u4f4d<br \/>\n   \u2193<br \/>\nNav2\u5bfc\u822a<br \/>\n   \u2193<br \/>\n\u5e95\u76d8\u63a7\u5236<br \/>\n   \u2193<br \/>\nSTM32<br \/>\n   \u2193<br \/>\n\u7535\u673a<\/p>\n<p>ROS 2 \u6700\u5927\u7684\u4ef7\u503c&#xff0c;\u5c31\u662f\u8ba9\u8fd9\u4e9b\u4e0d\u540c\u7a0b\u5e8f\u53ef\u4ee5\u89c4\u8303\u5730\u901a\u4fe1\u3001\u7ec4\u5408\u548c\u8c03\u8bd5\u3002<\/p>\n<p>ROS 2 \u67b6\u6784\u5206\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u5c42\u3001DDS \u5b9e\u73b0\u5c42\u3001DDS \u63a5\u53e3\u5c42\u3001ROS 2 \u5ba2\u6237\u7aef\u5c42\u548c\u5e94\u7528\u5c42&#xff1b;C&#043;&#043;\/Python ROS 2 \u7a0b\u5e8f\u4e3b\u8981\u5c31\u5728\u5e94\u7528\u5c42&#xff0c;\u901a\u8fc7 rclcpp \u6216 rclpy \u4f7f\u7528 ROS 2\u3002<\/p>\n<p>\u901a\u4fd7\u7684\u7c7b\u6bd4&#xff1a;<\/p>\n<p>Ubuntu &#061; \u5730\u57fa<br \/>\nROS 2  &#061; \u673a\u5668\u4eba\u8f6f\u4ef6\u6846\u67b6<br \/>\n\u4f60\u7684\u4ee3\u7801 &#061; \u771f\u6b63\u5b8c\u6210\u4efb\u52a1\u7684\u7a0b\u5e8f<\/p>\n<hr \/>\n<h4>2. Node \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>Node &#061; \u8282\u70b9\u3002<\/p>\n<p>\u8282\u70b9\u5c31\u662f ROS 2 \u4e2d\u627f\u62c5\u67d0\u4e2a\u5177\u4f53\u529f\u80fd\u7684\u7a0b\u5e8f\u5355\u5143\u3002<\/p>\n<p>\u6bd4\u5982\u673a\u5668\u4eba\u53ef\u4ee5\u6709&#xff1a;<\/p>\n<p>\/lidar_node<br \/>\n\u8d1f\u8d23\u8bfb\u6fc0\u5149\u96f7\u8fbe<\/p>\n<p>\/slam_node<br \/>\n\u8d1f\u8d23\u5efa\u56fe<\/p>\n<p>\/navigation_node<br \/>\n\u8d1f\u8d23\u5bfc\u822a<\/p>\n<p>\/base_controller<br \/>\n\u8d1f\u8d23\u5e95\u76d8\u63a7\u5236<\/p>\n<p>\/imu_node<br \/>\n\u8d1f\u8d23IMU<\/p>\n<p>\u4e0d\u662f\u505a\u4e00\u4e2a\u51e0\u4e07\u884c\u4ee3\u7801\u7684\u201c\u8d85\u7ea7\u7a0b\u5e8f\u201d&#xff0c;\u800c\u662f\u628a\u673a\u5668\u4eba\u62c6\u6210\u5f88\u591a\u8282\u70b9\u3002<\/p>\n<p>\u4e66\u91cc\u7684\u6d77\u9f9f\u4f8b\u5b50\u5c31\u662f\u4e24\u4e2a\u8282\u70b9&#xff1a;<\/p>\n<p>\/teleop_turtle<br \/>\n\u952e\u76d8\u63a7\u5236\u8282\u70b9<\/p>\n<p>\/turtlesim<br \/>\n\u6d77\u9f9f\u6a21\u62df\u5668\u8282\u70b9<\/p>\n<p>\u952e\u76d8\u63a7\u5236\u8282\u70b9\u628a\u547d\u4ee4\u53d1\u7ed9\u6d77\u9f9f\u8282\u70b9&#xff0c;\u56e0\u6b64\u4f60\u6309\u65b9\u5411\u952e&#xff0c;\u6d77\u9f9f\u624d\u4f1a\u8fd0\u52a8\u3002<\/p>\n<p>\u7528 Node Graph \u663e\u793a\u4e86\u4e24\u4e2a\u8282\u70b9\u4e4b\u95f4\u7684\u901a\u4fe1\u5173\u7cfb&#xff1a;<\/p>\n<p>\u7279\u522b\u8bf4\u660e&#xff1a;\u8282\u70b9\u9664\u4e86\u53d1\u5e03\u548c\u8ba2\u9605\u8bdd\u9898&#xff0c;\u8fd8\u53ef\u4ee5\u4f7f\u7528\u670d\u52a1\u3001\u53c2\u6570\u548c\u52a8\u4f5c\u7b49\u529f\u80fd\u3002<\/p>\n<p>\u6bd4\u5982\u8bf4\u505a\u4e00\u4e2aSTM32 \u5c0f\u8f66&#xff0c;\u53ef\u4ee5\u51fa\u73b0\u4e00\u4e2a&#xff1a;<\/p>\n<p>\/base_controller_node<\/p>\n<p>\u5b83\u8d1f\u8d23&#xff1a;<\/p>\n<p>\u63a5\u6536 \/cmd_vel<br \/>\n        \u2193<br \/>\n\u8ba1\u7b97\u5de6\u53f3\u8f6e\u901f\u5ea6<br \/>\n        \u2193<br \/>\n\u53d1\u7ed9 STM32<\/p>\n<p>\u8fd9\u5c31\u662f\u4e00\u4e2a Node\u3002<\/p>\n<p>\u67e5\u7cfb\u7edf\u73b0\u5728\u6709\u54ea\u4e9b\u8282\u70b9&#xff1a;<\/p>\n<p>ros2 <span class=\"token function\">node<\/span> list<\/p>\n<p>\u67e5\u67d0\u4e2a\u8282\u70b9&#xff1a;<\/p>\n<p>ros2 <span class=\"token function\">node<\/span> info \/\u8282\u70b9\u540d<\/p>\n<p>\u68c0\u67e5\u81ea\u5df1\u521b\u5efa\u7684 Python\/C&#043;&#043; \u8282\u70b9\u662f\u5426\u6210\u529f\u542f\u52a8\u3002<\/p>\n<hr \/>\n<h4>3. Package \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>Package \u4e2d\u6587\u53eb&#xff1a;<\/p>\n<p>\u529f\u80fd\u5305<\/p>\n<p>\u8fd9\u4e2a\u6982\u5ff5\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p>Package \u4e0d\u662f Node\u3002<\/p>\n<p>\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3&#xff1a;<\/p>\n<p>Package<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 Node A<br \/>\n\u251c\u2500\u2500 Node B<br \/>\n\u251c\u2500\u2500 \u914d\u7f6e\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 launch\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 \u5934\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 \u53c2\u6570<br \/>\n\u2514\u2500\u2500 \u5176\u4ed6\u8d44\u6e90<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4&#xff1a;<\/p>\n<p>Node \u662f\u5b9e\u9645\u5e72\u6d3b\u7684\u529f\u80fd\u5355\u5143&#xff0c;Package \u662f\u7ec4\u7ec7\u8fd9\u4e9b\u7a0b\u5e8f\u548c\u8d44\u6e90\u7684\u6587\u4ef6\u5939\/\u5de5\u7a0b\u5355\u5143\u3002<\/p>\n<p>\u529f\u80fd\u5305&#xff08;Package&#xff09;\u662f ROS 2 \u4e2d\u7ec4\u7ec7\u548c\u7ba1\u7406\u8282\u70b9\u7684\u5de5\u5177&#xff0c;\u53ef\u4ee5\u628a\u76f8\u5173\u8282\u70b9\u653e\u5728\u540c\u4e00\u4e2a\u529f\u80fd\u5305\u4e2d&#xff0c;\u65b9\u4fbf\u7f16\u8bd1\u3001\u5b89\u88c5\u3001\u5206\u4eab\u548c\u4f7f\u7528\u3002<\/p>\n<p>\u6bd4\u5982\u81ea\u5df1\u505a&#xff1a;<\/p>\n<p>my_robot_base\/<\/p>\n<p>\u8fd9\u4e2a Package \u91cc\u9762\u53ef\u4ee5\u6709&#xff1a;<\/p>\n<p>my_robot_base\/<br \/>\n\u251c\u2500\u2500 src\/<br \/>\n\u2502   \u251c\u2500\u2500 base_controller.cpp<br \/>\n\u2502   \u2514\u2500\u2500 serial_node.cpp<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 launch\/<br \/>\n\u2502   \u2514\u2500\u2500 robot.launch.py<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 config\/<br \/>\n\u2502   \u2514\u2500\u2500 params.yaml<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 CMakeLists.txt<br \/>\n\u2514\u2500\u2500 package.xml<\/p>\n<p>\u5176\u4e2d&#xff1a;<\/p>\n<p>base_controller.cpp<\/p>\n<p>\u8fd0\u884c\u540e\u53ef\u80fd\u4ea7\u751f&#xff1a;<\/p>\n<p>\/base_controller<\/p>\n<p>\u8fd9\u4e2a Node\u3002<\/p>\n<p>\u6240\u4ee5&#xff1a;<\/p>\n<p>.cpp \u662f\u6e90\u4ee3\u7801 \u2192 \u7f16\u8bd1\u6210\u53ef\u6267\u884c\u7a0b\u5e8f \u2192 \u542f\u52a8\u4ee5\u540e\u6210\u4e3a ROS 2 Node\u3002<\/p>\n<hr \/>\n<h4>4. Workspace \u662f\u4ec0\u4e48&#xff1f;<\/h4>\n<p>Workspace \u4e2d\u6587\u5c31\u662f&#xff1a;<\/p>\n<p>\u5de5\u4f5c\u7a7a\u95f4<\/p>\n<p>\u8fd9\u662f\u6bd4 Package \u518d\u9ad8\u4e00\u7ea7\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u5173\u7cfb\u4e00\u5b9a\u8981\u8bb0\u4f4f&#xff1a;<\/p>\n<p>Workspace<br \/>\n    \u2502<br \/>\n    \u2514\u2500\u2500 src<br \/>\n         \u2502<br \/>\n         \u251c\u2500\u2500 Package A<br \/>\n         \u2502      \u251c\u2500\u2500 Node A<br \/>\n         \u2502      \u2514\u2500\u2500 Node B<br \/>\n         \u2502<br \/>\n         \u251c\u2500\u2500 Package B<br \/>\n         \u2502      \u2514\u2500\u2500 Node C<br \/>\n         \u2502<br \/>\n         \u2514\u2500\u2500 Package C<\/p>\n<p>\u5927\u5c0f\u5173\u7cfb&#xff1a;<\/p>\n<p>[<br \/>\nWorkspace &gt; Package &gt; Node<br \/>\n]<\/p>\n<p>\u771f\u5b9e\u673a\u5668\u4eba\u901a\u5e38\u7531\u5f88\u591a\u4e0d\u540c\u7684\u529f\u80fd\u6a21\u5757\u7ec4\u6210&#xff0c;\u56e0\u6b64\u9700\u8981\u628a\u591a\u4e2a\u529f\u80fd\u5305\u7ec4\u7ec7\u8d77\u6765&#xff0c;Workspace \u5c31\u662f ROS 2 \u63a8\u8350\u7684\u591a\u529f\u80fd\u5305\u5f00\u53d1\u7ec4\u7ec7\u65b9\u5f0f\u3002<\/p>\n<p>\u6bd4\u5982\u53ef\u4ee5\u521b\u5efa&#xff1a;<\/p>\n<p><span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> ~\/robot_ws\/src<\/p>\n<p>\u5f97\u5230&#xff1a;<\/p>\n<p>robot_ws\/<br \/>\n\u2514\u2500\u2500 src\/<\/p>\n<p>\u7136\u540e\u628a\u6240\u6709\u81ea\u5df1\u7684\u529f\u80fd\u5305\u653e\u8fdb\u53bb&#xff1a;<\/p>\n<p>robot_ws\/<br \/>\n\u2514\u2500\u2500 src\/<br \/>\n    \u251c\u2500\u2500 robot_base\/<br \/>\n    \u251c\u2500\u2500 robot_description\/<br \/>\n    \u251c\u2500\u2500 robot_bringup\/<br \/>\n    \u2514\u2500\u2500 robot_navigation\/<\/p>\n<p>\u8fdb\u5165\u5de5\u4f5c\u7a7a\u95f4&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> ~\/robot_ws<\/p>\n<p>\u7f16\u8bd1&#xff1a;<\/p>\n<p>colcon build<\/p>\n<p>\u7f16\u8bd1\u540e\u5c31\u4f1a\u51fa\u73b0&#xff1a;<\/p>\n<p>robot_ws\/<br \/>\n\u251c\u2500\u2500 src\/<br \/>\n\u251c\u2500\u2500 build\/<br \/>\n\u251c\u2500\u2500 install\/<br \/>\n\u2514\u2500\u2500 log\/<\/p>\n<p>Workspace \u4f8b\u5b50\u91c7\u7528\u7684\u7ed3\u6784&#xff1a;src \u653e\u6e90\u7801&#xff0c;build\u3001install\u3001log \u7531\u6784\u5efa\u8fc7\u7a0b\u4ea7\u751f\u3002<\/p>\n<p>\u7279\u522b\u91cd\u8981\u7684&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">source<\/span> install\/setup.bash<\/p>\n<p>\u4e3a\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u56e0\u4e3a\u4f60\u521a\u521a\u7f16\u8bd1\u51fa\u6765\u7684\u65b0 Package&#xff0c;\u5f53\u524d\u7ec8\u7aef\u4e0d\u4e00\u5b9a\u77e5\u9053\u5b83\u5728\u54ea\u91cc\u3002source install\/setup.bash \u540e&#xff0c;ROS 2 \u624d\u80fd\u627e\u5230\u4f60\u7684\u65b0\u529f\u80fd\u5305\u3002\u4f8b\u5b50\u4e5f\u662f\u5728 colcon build \u540e\u6267\u884c\u8fd9\u4e2a\u6b65\u9aa4\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u547d\u4ee4\u4ee5\u540e\u4f1a\u65e0\u6570\u6b21\u8f93\u5165&#xff1a;<\/p>\n<p>colcon build<br \/>\n<span class=\"token builtin class-name\">source<\/span> install\/setup.bash<\/p>\n<p>\u8fd9\u4e24\u4e2a\u547d\u4ee4\u53ef\u4ee5\u5148\u773c\u719f\u3002<\/p>\n<hr \/>\n<h3>\u628a\u524d\u56db\u4e2a\u4e1c\u897f\u4e00\u6b21\u4e32\u8d77\u6765<\/h3>\n<p>\u5047\u8bbe\u4ee5\u540e\u4f60\u505a\u81ea\u5df1\u7684\u673a\u5668\u4eba&#xff1a;<\/p>\n<p>robot_ws                       \u2190 Workspace<br \/>\n\u2502<br \/>\n\u2514\u2500\u2500 src<br \/>\n    \u2502<br \/>\n    \u251c\u2500\u2500 robot_base             \u2190 Package<br \/>\n    \u2502   \u251c\u2500\u2500 base_controller    \u2190 Node<br \/>\n    \u2502   \u2514\u2500\u2500 serial_bridge      \u2190 Node<br \/>\n    \u2502<br \/>\n    \u251c\u2500\u2500 robot_lidar            \u2190 Package<br \/>\n    \u2502   \u2514\u2500\u2500 lidar_node         \u2190 Node<br \/>\n    \u2502<br \/>\n    \u2514\u2500\u2500 robot_navigation       \u2190 Package<br \/>\n        \u2514\u2500\u2500 navigation_node    \u2190 Node<\/p>\n<p>\u6240\u4ee5\u4e00\u53e5\u53e3\u8bc0&#xff1a;<\/p>\n<p>ROS 2 \u662f\u6574\u4e2a\u5e73\u53f0&#xff0c;Workspace \u662f\u9879\u76ee\u5de5\u4f5c\u533a&#xff0c;Package \u662f\u529f\u80fd\u6a21\u5757&#xff0c;Node \u662f\u771f\u6b63\u8fd0\u884c\u5e72\u6d3b\u7684\u5355\u5143\u3002<\/p>\n<p>\u8fd9\u4e2a\u5173\u7cfb\u4f60\u5982\u679c\u8bb0\u4f4f&#xff0c;ROS 2 \u5df2\u7ecf\u5165\u95e8\u4e00\u534a\u4e86\u3002<\/p>\n<hr \/>\n<h2>5. Linux \u57fa\u672c\u64cd\u4f5c\u5230\u5e95\u8981\u5b66\u54ea\u4e9b&#xff1f;<\/h2>\n<p>\u4f60\u4e0d\u9700\u8981\u5148\u5b66\u6210 Linux \u8fd0\u7ef4\u5de5\u7a0b\u5e08\u3002<\/p>\n<p>\u4ece\u7ec8\u7aef\u5f00\u59cb&#xff0c;\u673a\u5668\u4eba\u5f00\u53d1\u5e38\u7528\u7684\u90a3\u4e9b\u64cd\u4f5c&#xff0c;\u5305\u62ec\u67e5\u770b\u76ee\u5f55\u3001\u5207\u6362\u76ee\u5f55\u3001\u521b\u5efa\u6587\u4ef6\u5939\u548c\u6587\u4ef6\u3001\u7f16\u8f91\u3001\u67e5\u770b\u3001\u5220\u9664\u3001\u5b89\u88c5\u8f6f\u4ef6\u3001\u73af\u5883\u53d8\u91cf\u7b49\u3002<\/p>\n<p>\u73b0\u5728\u5148\u719f\u7ec3\u8fd9\u4e9b\u5c31\u591f&#xff1a;<\/p>\n<table>\n<tr>\u547d\u4ee4\u542b\u4e49\u4f8b\u5b50<\/tr>\n<tbody>\n<tr>\n<td>pwd<\/td>\n<td>\u6211\u73b0\u5728\u5728\u54ea<\/td>\n<td>pwd<\/td>\n<\/tr>\n<tr>\n<td>ls<\/td>\n<td>\u770b\u5f53\u524d\u76ee\u5f55\u6709\u4ec0\u4e48<\/td>\n<td>ls<\/td>\n<\/tr>\n<tr>\n<td>cd<\/td>\n<td>\u5207\u6362\u76ee\u5f55<\/td>\n<td>cd ~\/robot_ws<\/td>\n<\/tr>\n<tr>\n<td>cd ..<\/td>\n<td>\u56de\u4e0a\u4e00\u7ea7<\/td>\n<td>cd ..<\/td>\n<\/tr>\n<tr>\n<td>cd ~<\/td>\n<td>\u56de\u7528\u6237\u4e3b\u76ee\u5f55<\/td>\n<td>cd ~<\/td>\n<\/tr>\n<tr>\n<td>mkdir<\/td>\n<td>\u521b\u5efa\u6587\u4ef6\u5939<\/td>\n<td>mkdir test<\/td>\n<\/tr>\n<tr>\n<td>mkdir -p<\/td>\n<td>\u8fde\u7eed\u521b\u5efa\u76ee\u5f55<\/td>\n<td>mkdir -p robot_ws\/src<\/td>\n<\/tr>\n<tr>\n<td>touch<\/td>\n<td>\u521b\u5efa\u7a7a\u6587\u4ef6<\/td>\n<td>touch test.txt<\/td>\n<\/tr>\n<tr>\n<td>cat<\/td>\n<td>\u67e5\u770b\u6587\u672c<\/td>\n<td>cat test.txt<\/td>\n<\/tr>\n<tr>\n<td>nano<\/td>\n<td>\u7f16\u8f91\u6587\u672c<\/td>\n<td>nano test.txt<\/td>\n<\/tr>\n<tr>\n<td>rm<\/td>\n<td>\u5220\u9664\u6587\u4ef6<\/td>\n<td>rm test.txt<\/td>\n<\/tr>\n<tr>\n<td>rm -r<\/td>\n<td>\u5220\u9664\u76ee\u5f55<\/td>\n<td>rm -r test<\/td>\n<\/tr>\n<tr>\n<td>cp<\/td>\n<td>\u590d\u5236<\/td>\n<td>cp a.txt b.txt<\/td>\n<\/tr>\n<tr>\n<td>mv<\/td>\n<td>\u79fb\u52a8\/\u91cd\u547d\u540d<\/td>\n<td>mv old.txt new.txt<\/td>\n<\/tr>\n<tr>\n<td>sudo<\/td>\n<td>\u7ba1\u7406\u5458\u6743\u9650\u8fd0\u884c<\/td>\n<td>sudo apt install xxx<\/td>\n<\/tr>\n<tr>\n<td>apt<\/td>\n<td>\u5b89\u88c5\u8f6f\u4ef6<\/td>\n<td>sudo apt install git<\/td>\n<\/tr>\n<tr>\n<td>source<\/td>\n<td>\u5728\u5f53\u524d\u7ec8\u7aef\u52a0\u8f7d\u73af\u5883<\/td>\n<td>source install\/setup.bash<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ece pwd \u2192 cd \u2192 ls \u2192 mkdir \u2192 touch \u2192 nano \u2192 cat \u2192 rm \u8fd9\u4e00\u5957\u5f00\u59cb\u5b66\u3002<\/p>\n<hr \/>\n<h3>\u73b0\u5728\u9a6c\u4e0a\u53ef\u4ee5\u505a\u4e00\u4e2a 5 \u5206\u949f\u7ec3\u4e60<\/h3>\n<p>\u6253\u5f00 Ubuntu \u7ec8\u7aef&#xff0c;\u4eb2\u624b\u8f93\u5165&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> ~<br \/>\n<span class=\"token builtin class-name\">pwd<\/span><\/p>\n<p><span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> ~\/ros2_test\/src<br \/>\n<span class=\"token builtin class-name\">cd<\/span> ~\/ros2_test<\/p>\n<p><span class=\"token builtin class-name\">pwd<\/span><br \/>\n<span class=\"token function\">ls<\/span><\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> src<br \/>\n<span class=\"token function\">touch<\/span> hello.txt<br \/>\n<span class=\"token function\">ls<\/span><\/p>\n<p><span class=\"token function\">nano<\/span> hello.txt<\/p>\n<p>\u8fdb\u53bb\u4ee5\u540e\u5199&#xff1a;<\/p>\n<p>hello ros2<\/p>\n<p>\u4fdd\u5b58\u9000\u51fa&#xff0c;\u518d&#xff1a;<\/p>\n<p><span class=\"token function\">cat<\/span> hello.txt<\/p>\n<p>\u5e94\u8be5\u663e\u793a&#xff1a;<\/p>\n<p>hello ros2<\/p>\n<p>\u7136\u540e&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> <span class=\"token punctuation\">..<\/span><br \/>\n<span class=\"token builtin class-name\">pwd<\/span><\/p>\n<p>\u5982\u679c\u8fd9\u4e9b\u547d\u4ee4\u4f60\u80fd\u4e0d\u770b\u7b54\u6848\u81ea\u5df1\u505a\u51fa\u6765&#xff0c;\u90a3\u4e48 Linux \u57fa\u7840\u7b2c\u4e00\u5173\u5c31\u591f\u4e86\u3002<\/p>\n<p>\u4e0b\u4e00\u6b65\u5c31\u5e94\u8be5\u6b63\u5f0f\u8fdb\u5165 Node \u2192 Topic\u3002\u5176\u4e2d Topic \u662f\u6700\u5173\u952e\u7684&#xff0c;\u56e0\u4e3a\u4f60\u4ee5\u540e\u4f1a\u76f4\u63a5\u770b\u5230&#xff1a;<\/p>\n<p>Nav2<br \/>\n  \u2502<br \/>\n  \u2502 \/cmd_vel<br \/>\n  \u25bc<br \/>\n\u5e95\u76d8\u8282\u70b9<br \/>\n  \u2502<br \/>\n  \u25bc<br \/>\nSTM32<\/p>\n<p>\u8fd9\u6b63\u662f ROS 2 \u771f\u6b63\u5f00\u59cb\u201c\u8ba9\u673a\u5668\u4eba\u5404\u90e8\u5206\u4e92\u76f8\u8bf4\u8bdd\u201d\u7684\u5730\u65b9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. ROS 2 \u662f\u4ec0\u4e48&#xff1f;ROS 2 \u662f\u4e00\u5957\u7528\u6765\u642d\u5efa\u673a\u5668\u4eba\u8f6f\u4ef6\u7cfb\u7edf\u7684\u6846\u67b6\u548c\u5de5\u5177\u96c6\u5408\u3002\u5b83\u540d\u5b57\u53eb Robot Operating System&#xff0c;\u4f46\u4e0d\u8981\u628a\u5b83\u7406\u89e3\u6210 Windows\u3001Ubuntu \u90a3\u79cd\u5b8c\u6574\u64cd\u4f5c\u7cfb\u7edf\u3002ROS 2 \u662f\u8fd0\u884c\u5728 Ubuntu \u4e0a\u9762\u7684\u673a\u5668\u4eba\u8f6f\u4ef6\u5e73\u53f0\u3002<br \/>\n\u673a\u5668\u4eba\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5e72\u6240\u6709\u4e8b\u60c5&#xff0c;\u800c\u662f\u5f88\u591a\u6a21\u5757&#xff1a;<br \/>\n\u96f7\u8fbe\u7a0b\u5e8f\u2193<br \/>\nSLAM\u5efa\u56fe\u2193<br \/>\n\u5b9a\u4f4d\u2193<br \/>\nNav2\u5bfc\u822a\u2193<br \/>\n\u5e95\u76d8\u63a7\u5236\u2193<br \/>\nSTM32\u2193<br \/>\n\u7535\u673aROS 2 \u6700\u5927\u7684\u4ef7\u503c&amp;#<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[103,384],"topic":[],"class_list":["post-93080","post","type-post","status-publish","format-standard","hentry","category-server","tag-ubuntu","tag-384"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/93080.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"1. ROS 2 \u662f\u4ec0\u4e48&#xff1f;ROS 2 \u662f\u4e00\u5957\u7528\u6765\u642d\u5efa\u673a\u5668\u4eba\u8f6f\u4ef6\u7cfb\u7edf\u7684\u6846\u67b6\u548c\u5de5\u5177\u96c6\u5408\u3002\u5b83\u540d\u5b57\u53eb Robot Operating System&#xff0c;\u4f46\u4e0d\u8981\u628a\u5b83\u7406\u89e3\u6210 Windows\u3001Ubuntu \u90a3\u79cd\u5b8c\u6574\u64cd\u4f5c\u7cfb\u7edf\u3002ROS 2 \u662f\u8fd0\u884c\u5728 Ubuntu \u4e0a\u9762\u7684\u673a\u5668\u4eba\u8f6f\u4ef6\u5e73\u53f0\u3002 \u673a\u5668\u4eba\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5e72\u6240\u6709\u4e8b\u60c5&#xff0c;\u800c\u662f\u5f88\u591a\u6a21\u5757&#xff1a; \u96f7\u8fbe\u7a0b\u5e8f\u2193 SLAM\u5efa\u56fe\u2193 \u5b9a\u4f4d\u2193 Nav2\u5bfc\u822a\u2193 \u5e95\u76d8\u63a7\u5236\u2193 STM32\u2193 \u7535\u673aROS 2 \u6700\u5927\u7684\u4ef7\u503c&amp;#\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/93080.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-11T12:56:49+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/93080.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/93080.html\",\"name\":\"\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-11T12:56:49+00:00\",\"dateModified\":\"2026-08-11T12:56:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/93080.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/93080.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/93080.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u9c7c\u9999ROS2\u57fa\u672c\u529f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/93080.html","og_locale":"zh_CN","og_type":"article","og_title":"\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"1. ROS 2 \u662f\u4ec0\u4e48&#xff1f;ROS 2 \u662f\u4e00\u5957\u7528\u6765\u642d\u5efa\u673a\u5668\u4eba\u8f6f\u4ef6\u7cfb\u7edf\u7684\u6846\u67b6\u548c\u5de5\u5177\u96c6\u5408\u3002\u5b83\u540d\u5b57\u53eb Robot Operating System&#xff0c;\u4f46\u4e0d\u8981\u628a\u5b83\u7406\u89e3\u6210 Windows\u3001Ubuntu \u90a3\u79cd\u5b8c\u6574\u64cd\u4f5c\u7cfb\u7edf\u3002ROS 2 \u662f\u8fd0\u884c\u5728 Ubuntu \u4e0a\u9762\u7684\u673a\u5668\u4eba\u8f6f\u4ef6\u5e73\u53f0\u3002 \u673a\u5668\u4eba\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5e72\u6240\u6709\u4e8b\u60c5&#xff0c;\u800c\u662f\u5f88\u591a\u6a21\u5757&#xff1a; \u96f7\u8fbe\u7a0b\u5e8f\u2193 SLAM\u5efa\u56fe\u2193 \u5b9a\u4f4d\u2193 Nav2\u5bfc\u822a\u2193 \u5e95\u76d8\u63a7\u5236\u2193 STM32\u2193 \u7535\u673aROS 2 \u6700\u5927\u7684\u4ef7\u503c&amp;#","og_url":"https:\/\/www.wsisp.com\/helps\/93080.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-11T12:56:49+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/93080.html","url":"https:\/\/www.wsisp.com\/helps\/93080.html","name":"\u9c7c\u9999ROS2\u57fa\u672c\u529f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-11T12:56:49+00:00","dateModified":"2026-08-11T12:56:49+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/93080.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/93080.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/93080.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u9c7c\u9999ROS2\u57fa\u672c\u529f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/93080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=93080"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/93080\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=93080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=93080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=93080"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=93080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}