QGroundControl과 Gazebo 시뮬레이터 연동 방법
Windows 11, WSL2 환경 기반
전체 구성

A. WSL2 환경 설정
1. WSL2 설치 (Ubuntu 20.04.06 LTS) : 아래글을 참고하여 설치를 완료하세요.
- 2. 설치 완료 후 아래 명령 실행
|
sudo apt-get upgrade |
B. Mavlink router 설치 (WSL2 환경)
1. WSL2 콘솔 A 실행- 2. 아래와 같이 mavlink router 설치
|
sudo -H pip3 install --target=/usr/bin --upgrade meson
meson setup build .
ninja -C build
|
- 3. 아래와 같이 qgc.conf 파일 만들기
|
Mode = Normal Address = 192.168.219.111 ← QGroundControl를 실행할 Windows 환경의 내부(공유기가 할당한) IP 주소 Port = 14551 [UdpEndpoint SIM] Mode = Eavesdropping Address = 127.0.0.1 Port = 14550 |
- 4. 아래 명령 실행
|
|
C. SITL - Gazebo Classic 시뮬레이션 환경 설정 (WSL2 환경)
- (https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html 참고)
- 1. WSL2 콘솔 B 실행
2. 아래와 같이 SITL, gazebo 설치 실행
|
wsl
|
3. 아래 명령 실행
|
|
D. Port Forwarding 설정 (Windows 환경)
1. 아래와 같이 “portfw.ps1” 파일 작성 (노트패드 등에서)
|
$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"; |
2. Windows PowerShell 을 관리자모드로 실행 후 상기 스크립트 실행
|
|
E. QGroundControl 설정 (Windows 환경)
1. Q → 응용프로그램 설정 → 통신 링크 → 추가
2. 타입 → UDP
- 3. 포트 → 14551로 변경
- 4. 서버 주소 추가 → 172.18.56.30:18570 (여기서 IP 주소는 WSL2 Ubuntu 의 주소 - ‘ifconfig’ 명령으로 확인) → 서버 추가하기
- 확인
----------------------------------------------------------------------
- 최초 작성 및 공개 : 2023.12.01 | airpage.org | 이건우