Home›VS Code / Dev Env›WSL上のROS2を使ってVisual Studio CodeとGazeboでロボットを自動巡回させる
WSL上のROS2を使ってVisual Studio CodeとGazeboでロボットを自動巡回させる

WSL上のROS2を使ってVisual Studio CodeとGazeboでロボットを自動巡回させるAutonomous Robot Patrols with ROS 2 on WSL, Visual Studio Code, and Gazebo

元記事を読むRead original articleqiita.com(新しいタブで開きます)(opens in a new tab)
AI2 点サマリSummary highlight
  • 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.

  1. ポコPokoFAST-LIOで3D地図を作るのに、Nav2は別の2D固定地図を使うの?なんで分けるんだろう。FAST-LIO builds a 3D map, but Nav2 uses a separate fixed 2D map? Why are they split up?
  2. 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.
  3. ポコPokoじゃあ、WSL2でロボット開発する人が、地図作りから自動巡回まで同じ環境で試せるってこと?So robotics developers on WSL2 can test everything from mapping to autonomous patrols in one environment?
  4. 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.
  5. ポコ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.
  6. 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.
記事情報・収集記録Article details & collection record
出典Source
Qiita VSCodeコミュニティCommunity
公開日時 (JST)Published (JST)
収集日時 (JST)Collected (JST)
配信形式Format
ブログBlog
原文言語Source language
JA
重要度の位置づけImportance in this lane
MediumMedium priority(VS Code / Dev Env 58件中、同等以上 39件)(39 of 58 VS Code / Dev Env entries are equal or higher)
出典の平均重要度(掲載直近 30 件・最大 30 件)Source average (last 30 listed, up to 30)
1.7 / 31=情報 · 2=中 · 3=高1=Info · 2=Medium · 3=High
情報の寿命Half-life
中期 (チュートリアル)Medium-term (tutorial)

🔷VS Code / Dev Env の他の記事More from VS Code / Dev Envもっと見る →View more →

ページ上部へScroll to top