메뉴 건너뛰기

그외 팁들


 

 

QGroundControl과 Gazebo 시뮬레이터 연동 방법

Windows 11, WSL2 환경 기반

 

 

 

전체 구성

 

 

스크린샷 2023-10-28 214537.png

 

 

A. WSL2 환경 설정


  1. 1. WSL2 설치 (Ubuntu 20.04.06 LTS) : 아래글을 참고하여 설치를 완료하세요.

https://velog.io/@darktrace1/%EC%9C%88%EB%8F%84%EC%9A%B011%EC%97%90-UbuntuWSL2-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0
 

  1. 2. 설치 완료 후 아래 명령 실행


sudo apt-get update
 

sudo apt-get upgrade
 

 

 

 

B. Mavlink router 설치  (WSL2 환경)


  1. 1. WSL2 콘솔 A 실행
  2.  
  3. 2. 아래와 같이 mavlink router 설치


git clone https://github.com/mavlink-router/mavlink-router.git


cd mavlink-router


git submodule update --init --recursive


sudo apt install git meson ninja-build pkg-config gcc g++ systemd


sudo apt-get install python3-pip

 

sudo -H pip3 install --target=/usr/bin --upgrade meson

 

meson setup build .

 

ninja -C build


sudo ninja -C build install


sudo DESTDIR=/tmp/root/dir ninja -C build install
 

  1.  
  2. 3. 아래와 같이 qgc.conf 파일 만들기


[UdpEndpoint QGC]

Mode = Normal

Address = 192.168.219.111  ← QGroundControl를 실행할 Windows 환경의 내부(공유기가 할당한) IP 주소

Port = 14551
 

[UdpEndpoint SIM]

Mode = Eavesdropping

Address = 127.0.0.1

Port = 14550
 

  1.  
  2. 4. 아래 명령 실행


mavlink-routerd -c qgc.conf
 

 

 

 

C. SITL - Gazebo Classic 시뮬레이션 환경 설정 (WSL2 환경)
 

  1. (https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html 참고)
  2.  
  3. 1. WSL2 콘솔 B 실행

  4. 2. 아래와 같이 SITL, gazebo 설치 실행


git clone https://github.com/PX4/PX4-Autopilot.git --recursive


bash ./PX4-Autopilot/Tools/setup/ubuntu.sh


exit


wsl --shutdown

 

wsl


cd PX4-Autopilot


make px4_sitl


sudo apt remove gz-garden


sudo apt install aptitude


sudo aptitude install gazebo libgazebo11 libgazebo-dev


sudo apt-get install net-tools
 


  1. 3. 아래 명령 실행


cd PX4-Autopilot


make px4_sitl gazebo-classic
 

 

 

 

D. Port Forwarding 설정 (Windows 환경)


  1. 1. 아래와 같이 “portfw.ps1” 파일 작성 (노트패드 등에서)


if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {  

  $arguments = "& '" + $myinvocation.mycommand.definition + "'"

  Start-Process powershell -Verb runAs -ArgumentList $arguments

  Break

}

 

$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"

$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';

 

if ( $found ) {

  $remoteport = $matches[0];

}

else {

  Write-Output "The Script Exited, the ip address of WSL 2 cannot be found";

  exit;

}

 

$ports = @(18570);

 

Invoke-Expression "netsh interface portproxy reset";

 

for ( $i = 0; $i -lt $ports.length; $i++ ) {

  $port = $ports[$i];

  Invoke-Expression "netsh interface portproxy add v4tov4 listenport=$port connectport=$port connectaddress=$remoteport";

}

 

Invoke-Expression "netsh interface portproxy show v4tov4";
 


  1. 2. Windows PowerShell 을 관리자모드로 실행 후 상기 스크립트 실행


.\portfw.ps1
 

 

 

 

 

E. QGroundControl 설정 (Windows 환경)


  1. 1. Q → 응용프로그램 설정 →  통신 링크 → 추가

  2. 2. 타입 → UDP
     
  3. 3. 포트 → 14551로 변경
     
  4. 4. 서버 주소 추가 → 172.18.56.30:18570 (여기서 IP 주소는 WSL2 Ubuntu 의 주소 - ‘ifconfig’ 명령으로 확인) → 서버 추가하기
  5. 확인

 



----------------------------------------------------------------------

- 최초 작성 및 공개 : 2023.12.01 | airpage.org | 이건우

 

 





번호 제목 날짜 조회 수
공지 [TIP] 라즈베리파이 3를 AP로 만들기 (How to make Raspberry Pi 3 to Access point device) 2018.01.22 8879
공지 [TIP] ASR 오픈소스 프로젝트 - Kaldi 로 나만의 STT 서비스 구축해 보기 2018.07.26 6974
공지 [TIP] 무슨 짓을 해도 토렌트가 동작 안 할 때 [8] 2024.08.03 6765
134 [TIP] 무슨 짓을 해도 토렌트가 동작 안 할 때 [8] 2024.08.03 6765
» [TIP] Windows 11에 QGroundControl 시뮬레이션 환경 구성 방법 file 2023.12.01 855
132 [TIP] 페이스북과 서비스 연동을 위한 권한 요청 검수 절차를 시작하기 전에 2022.10.19 319
131 [TIP] Google Cloud API 호출시 No 'Access-Control-Allow-Origin' header is present on the requested resource. 오류가 발생할 때 2021.06.13 523
130 [TIP] DJI Mobile SDK(Android)를 사용시 SDK 등록이 잘 안되거나 멈추는 등의 오류가 발생할 때 2020.10.17 488
129 [TIP] GitHub Public Page의 Hidden directory를 노출시키는 방법 2020.02.07 477
128 [TIP] 머신러닝 기반의 이상탐지(Anomaly Detection)를 위한 자료 모음 2020.01.25 2356
127 [TIP] Mac에서 /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory 오류 발생시 2019.10.16 1481
126 [TIP] 영상처리에 도움이 되는 머신러닝, 딥러닝 사이트 모음 입니다 2019.10.15 1183
125 [TIP] DJI Windows SDK의 연결이 잘 안될때 [12] 2019.10.01 1433
124 [TIP] 맥북의 스토리지에서 시스템이 차지하는 용량 줄이기 2019.04.20 3894
123 [TIP] PHP extension 모듈이 로드 되지 않거나 php.ini 파일을 변경해도 설정이 반영되지 않을때 2018.08.03 1673
122 [TIP] Raspberry Pi 3 에 파이선 SIP클라이언트 모듈- pjsua 설치하기 2018.07.27 1902
121 [TIP] ASR 오픈소스 프로젝트 - Kaldi 로 나만의 STT 서비스 구축해 보기 2018.07.26 6974
120 [TIP] 파이선 2.7에서 NAVER TTS(CSS) API 사용하기 2018.07.16 1608
119 [TIP] 호스팅중인 GitLab에 접속하면 'Forbidden' 메시지가 표시될 때 2018.06.18 4676
118 라즈베리파이에대하여질문은어디에?? [1] 2018.05.30 559
117 [TIP] Android Studio에서 DJI SDK로 안드로이드 앱 개발시 유용한 디버깅 환경 갖추기 2018.05.20 1599
116 [TIP] Raspberry Pi 3 에서 파이선으로 패킷 캡쳐해 보기 (The way to install pcapy library for capturing the packet with Python On Raspberry Pi 3) file 2018.04.12 1668
115 [TIP] Raspberry Pi 3를 위한 Android 빌드 하기 (Compile and install Android for Raspberry Pi 3) [2] 2018.03.20 4252
위로