
WSL上のROS2を使ってVisual Studio CodeとGazeboでロボットを自動巡回させるAutonomous Robot Patrols with ROS 2 on WSL, Visual Studio Code, and Gazebo
匿名の公開いいねです。記事の保存・お気に入りではなく、Featured、Top 3、重要度、掲載順位には影響しません。仕組みとプライバシーAnonymous public likes are reactions, not saved articles or bookmarks. They do not affect Featured, Top 3, importance, or listing order.How it works and privacy
- ROS 2とGazeboでUnitree Go2にLiDARを搭載し、FAST-LIOの3D地図作成からNav2とCHAMPによる自動巡回までを構築します。
- WSL2とVisual Studio Codeで開発と検証を完結したい技術者に役立ちます。
ROS 2 and Gazebo power a LiDAR-equipped Unitree Go2, using FAST-LIO for 3D mapping and Nav2 with CHAMP for autonomous patrols, benefiting robotics developers on WSL2.
本ページの本文と要約は AI による自動生成です。日本語版と英語版は言語ごとに独立して生成されるため、表現や詳しさが異なる場合があります。正確性は元記事 (qiita.com) をご確認ください。The body and summaries are AI-generated independently for each language, so wording and detail may differ. Verify accuracy at the original source (qiita.com).
要約と収集メタデータに基づく AI 解説。元記事全文の転載・翻訳ではありません。AI explainer based on the summaries and collected metadata, not a copy or translation of the full source article.
WSLとVS Code
WSL上のROS 2とGazeboを使い、LiDARを搭載したUnitree Go2で3D点群地図の保存から自律走行までを試す構成です。Visual Studio Code内で設定変更、ビルド、状態確認、デバッグを進められる点が中心となります。
ROS 2ワークスペースは、Visual Studio CodeのRemote - WSL接続から直接開けます。Linux側にあるlaunch、YAML、Python、C++を編集し、統合ターミナルでビルドやトピック、TFを確認できるため、シミュレーションに関する作業を同じ環境で完結できます。
3D点群地図
Gazebo上のUnitree Go2には、Livox MID360相当のLiDARを搭載します。3D点群地図の保存にはFAST-LIOを使用しますが、Nav2が自律走行に使う地図はこの3D地図ではありません。
Nav2向けの2D occupancy gridには、Gazeboワールド内に配置した障害物の座標から生成した固定地図を使用します。自己位置にはGazeboのground-truthオドメトリを用いるため、Gazebo画面とRViz2に表示されるGo2の位置を同じ座標系で扱えます。
Nav2とCHAMP
自律走行では、Nav2とCHAMPが役割を分担します。Nav2が経路を計画し、速度指令を/cmd_velとしてCHAMPへ渡します。CHAMPはその指令を歩容計算と関節軌道へ変換し、各脚を動かして、計画された経路に沿うようGo2を歩行させます。
前提環境
実験環境はWSL2のUbuntu 22.04 LTSとROS 2 Humbleを前提とします。Unitree Go2のCHAMPコントローラ、FAST-LIO、Livox-SDK2がセットアップ済みで、~/ros2_ws/src配下にはunitree_ros2、unitree-go2-ros2-gazebo、livox_ros_driver2、fast_lioの各リポジトリが配置されている構成です。
Visual Studio Code Environment
This workflow builds an autonomous patrol system for a LiDAR-equipped Unitree Go2 using ROS 2 and Gazebo. It is useful for robotics developers who want to complete development and verification within WSL2 and Visual Studio Code.
A ROS 2 workspace running on WSL can be opened directly through Visual Studio Code’s Remote - WSL connection. Developers can edit Linux-side launch files, YAML, Python, and C++ while using the integrated terminal to build the workspace and inspect topics and TF. This keeps simulation configuration changes and debugging in the same environment.
FAST-LIO and 3D Mapping
In Gazebo, the Unitree Go2 is equipped with the equivalent of a Livox MID360 LiDAR. FAST-LIO is used to create and save a 3D point-cloud map before the robot proceeds to autonomous navigation.
The 3D map is separate from the map used by Nav2 in this simulation. Nav2 uses a fixed 2D occupancy grid generated from the coordinates of obstacles placed in the Gazebo world. For localization, the setup uses Gazebo ground-truth odometry. This allows the Go2 positions shown in Gazebo and RViz2 to be handled in the same coordinate frame.
Nav2 and CHAMP
Nav2 plans the robot’s route and sends velocity commands through /cmd_vel. CHAMP, a control framework for quadruped robots, is responsible for Go2 locomotion.
CHAMP converts the velocity commands received from Nav2 into gait calculations and joint trajectories, then moves each leg to make the robot walk. The division of responsibilities is therefore explicit: Nav2 calculates the path, while CHAMP makes the Go2 physically follow it in the simulation.
WSL2 Setup
The procedure assumes WSL2 with Ubuntu 22.04 LTS, ROS 2 Humble, a Unitree Go2 with a CHAMP controller, FAST-LIO, and Livox-SDK2 are already configured. It also assumes the unitree_ros2, unitree-go2-ros2-gazebo, livox_ros_driver2, and fast_lio repositories are present under ~/ros2_ws/src.
ポコとTECHガイドPoko & TECH Guide
ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.
- ポコPokoFAST-LIOで3D地図を作るのに、Nav2は別の2D固定地図を使うの?なんで分けるんだろう。FAST-LIO builds a 3D map, but Nav2 uses a separate fixed 2D map? Why are they split up?
- TECHガイドTECH Guideこの実験では、3D点群はFAST-LIOで保存し、Nav2には障害物の座標から作った固定地図を使う構成なんだ。自己位置はGazeboのオドメトリで合わせているよ。In this experiment, FAST-LIO saves the 3D point cloud, while Nav2 uses a fixed map generated from obstacle coordinates. Gazebo odometry provides the robot’s position.
- ポコPokoじゃあ、WSL2でロボット開発する人が、地図作りから自動巡回まで同じ環境で試せるってこと?So robotics developers on WSL2 can test everything from mapping to autonomous patrols in one environment?
- TECHガイドTECH Guideうん。VS CodeでLinux側の設定やコードを編集し、ビルドや確認まで進められる。Nav2が経路を決め、CHAMPがGo2を歩かせる役割分担だよ。Yes. They can edit Linux-side settings and code in VS Code, then build and inspect the system there. Nav2 plans the route, and CHAMP makes the Go2 walk it.
- ポコPoko3D地図の保存と巡回用の2D地図は別で、VS Codeの中から設定やデバッグまで進められるんだね。Got it: the saved 3D map and patrol’s 2D map are separate, while setup and debugging can stay inside VS Code.
- TECHガイドTECH Guideそうだね。ただし、ROS 2 HumbleやCHAMP、FAST-LIOなどがセットアップ済みのWSL2環境が前提だよ。Right. One caveat: it assumes a prepared WSL2 environment with ROS 2 Humble, CHAMP, FAST-LIO, and the other listed components already set up.





