MacOS 개발 환경
아래에서 macOS용 PX4 개발 환경 설정 방법을 설명합니다. PX4 빌드에 사용되어 집니다.
- Pixhawk와 기타 NuttX 기반 하드웨어
- jMAVSim 시뮬레이션
- Gazebo Classic Simulation
TIP
이 설정은 PX4 개발 팀에서 지원합니다. To build other targets you will need to use a different OS (or an unsupported development environment).
영상 가이드
@유투브
Base Setup
The "base" macOS setup installs the tools needed for building firmware, and includes the common tools that will be needed for installing/using the simulators.
Environment Setup
Details
애플 M1 맥북 사용자 Apple M1 Macbook이 있는 경우 x86 터미널을 설정하여 터미널을 x86으로 실행해야 합니다.
- 유틸리티 폴더(Finder > 이동 메뉴 > 유틸리티)에서 터미널 애플리케이션을 찾습니다.
- Select Terminal.app and right-click on it, then choose Duplicate.
- Rename the duplicated Terminal app, e.g. to x86 Terminal
- Now select the renamed x86 Terminal app and right-click and choose *Get Info
- Rosetta를 사용하여 열기 확인란을 선택하고, 창을 닫습니다.
- Run the x86 Terminal as usual, which will fully support the current PX4 toolchain
First set up the environment
Enable more open files by appending the following line to the
~/.zshenv
file (creating it if necessary):shecho ulimit -S -n 2048 >> ~/.zshenv
If you don't do this, the build toolchain may report the error:
"LD: too many open files"
:::
Enforce Python 3 by appending the following lines to
~/.zshenv
sh# Point pip3 to MacOS system python 3 pip alias pip3=/usr/bin/pip3
공통 도구
To setup the environment to be able to build for Pixhawk/NuttX hardware (and install the common tools for using simulators):
Install Homebrew by following these installation instructions.
Run these commands in your shell to install the common tools:
shbrew tap PX4/px4 brew install px4-dev
Install the required Python packages:
sh# install required packages using pip3 python3 -m pip install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging kconfiglib future jsonschema # if this fails with a permissions error, your Python install is in a system path - use this command instead: sudo -H python3 -m pip install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging kconfiglib future jsonschema
Gazebo Classic Simulation
To setup the environment for Gazebo Classic simulation:
Run the following commands in your shell:
shbrew unlink tbb sed -i.bak '/disable! date:/s/^/ /; /disable! date:/s/./#/3' $(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula/[email protected] brew install tbb@2020 brew link tbb@2020
jMAVSim과 함께 SITL 시뮬레이션을 사용하려면, 최신 버전의 Java(예: Java 15)를 설치합니다. They can be removed once it is fixed (along with this note). :::
To install SITL simulation with Gazebo Classic:
shbrew install --cask temurin brew install --cask xquartz brew install px4-sim-gazebo
Run the macOS setup script:
PX4-Autopilot/Tools/setup/macos.sh
The easiest way to do this is to clone the PX4 source, and then run the script from the directory, as shown:shgit clone https://github.com/PX4/PX4-Autopilot.git --recursive cd PX4-Autopilot/Tools/setup sh macos.sh
jMAVSim 시뮬레이션
To setup the environment for jMAVSim simulation:
Install a recent version of Java (e.g. Java 15). You can download Java 15 (or later) from Oracle or use Eclipse Temurin:
shbrew install --cask temurin
Install jMAVSim:
shbrew install px4-sim-jmavsim
PX4 v1.11 and beyond require at least JDK 15 for jMAVSim simulation.
For earlier versions, macOS users might see the error
Exception in thread "main" java.lang.UnsupportedClassVersionError:
. You can find the fix in the jMAVSim with SITL > Troubleshooting).
:::
다음 단계
Once you have finished setting up the command-line toolchain:
- VSCode를 설치합니다(명령줄에 IDE 사용을 선호하는 경우).
- Install the QGroundControl Daily Build
TIP
The daily build includes development tools that are hidden in release builds. 또한, 릴리스 빌드에서 아직 지원되지 않는 새로운 PX4 기능에 대한 액세스를 제공할 수도 있습니다.
- 빌드 지침을 계속 진행합니다.