1. PX4 소스코드 설치 및 Bash 스크립트 실행

git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot
bash ./Tools/setup/ubuntu.sh

 

2. Gazebo 시뮬레이터 설치

sudo apt-get install gazebo

 

3. Gazeo SITL 시뮬레이터 실행

make px4_sitl gazebo
  • gazebo가 지원하는 기체 전체목록은 make list_config_targets 명령시 확인 가능
  • 만약 위 명령을 수행했을 때 에러가 발생한다면 sudo apt-get upgrade gazebo 명령 필요

 

4. 드론 이륙 및 착륙 명령 실행

pxh> commander takeoff
pxh > commander land

 

5. QGroundControl 설치

5.1 명령어 실행

sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager -y
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
sudo apt install libqt5gui5 -y
sudo apt install libfuse2 -y

 

5.2 QGC 바이너리 다운로드

 

5.3 QGC 바이너리 실행

chmod +x ./QGroundControl.AppImage
./QGroundControl.AppImage

 

 

PX4와 QGC가 mavlink로 연결됨을 확인: INFO [mavlink] partner IP: 127.0.0.1

 

 

6. QGC의 시작 좌표 변경

  • 아래 위치(석촌호수)를 .bashrc에 저장하여 터미널을 실행할 때 마다 설정되도록 내용 추가
export PX4_HOME_LAT=37.506700 #위도
export PX4_HOME_LON=127.097598 #경도
export PX4_HOME_ALT=15 # 고도

 

 

7. 시뮬레이션 속도 변경

  • 실제 시간 대비 시뮬레이션 속도 증감 가능 (아래는 2배)
export PX4_SIM_SPEED_FACTOR=2

 

 

8. GUI 없이 Gazebo 실행

  • 더 빠른 시뮬레이터 실행과 더 적은 리소스 사용
HEADLESS=1 make px4_sitl gazebo
  • 환경변수로 등록하고 싶을 경우 아래은 내용을 .bashrc에 추가
export HEADLESS=1

 

Reference

[1] https://docs.qgroundcontrol.com/master/ko/getting_started/download_and_install.html

[2] https://kwangpil.tistory.com/100

+ Recent posts