7. Install Gazebo Mavros and PX4 and fly drone on Ubuntu 18.04 - pineland/px4 GitHub Wiki
- 참고 : modulabs.co.kr/board_GDCH80/1886
1. Gazebo 설치
$ sudo apt install ros-melodic-gazebo-ros-pkgs
2. MAVROS 설치
# Install mavros binary packages
$ sudo apt update
$ sudo apt install ros-melodic-mavros ros-melodic-mavros-extras
# Install GeographicLib datasets
$ wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
$ ./install_geographiclib_datasets.sh
3. Pixhawk의 Firmware인 PX4 설치
$ sudo apt update
$ sudo apt install python-argparse git-core wget zip \
python-empy qtcreator build-essential genromfs -y
# simulation tools
$ sudo apt install ant protobuf-compiler libeigen3-dev libopencv-dev openjdk-8-jdk openjdk-8-jre clang-3.9 lldb-3.6 -y
$ cd ~/catkin_ws/src
$ git clone https://github.com/PX4/Firmware.git
$ cd Firmware
$ git submodule update --init --recursive
4. Iris drone gazebo test
PX4가 설치가 되었다면 PX4안의 iris drone의 model이 들어있고 그 model을 gazebo로 실행시킨다. gazebo안에 iris drone이 보이면 된다.
$ cd ~/catkin_ws/src/Firmware
$ pip3 install numpy toml empy jinja2
$ make px4_sitl_default gazebo
5. Install OFFBOARD modules for the SITL
$ cd ~/catkin_ws/src
$ git clone https://github.com/Jaeyoung-Lim/modudculab_ros.git
$ catkin_make
# setup simulator(gazebo)
$ cd ~/catkin_ws/src/modudculab_ros/launch
$ vi ctrl_pos_gazebo.launch # fcu_url 지정 : gazebo => udp://:[email protected]:14557,
Pixhawk => /dev/ttyAM0:115200
6. Fly drone
$ roscore # terminal 1
$ cd ~/catkin_ws/src/Firmware && make px4_sitl_default gazebo # terminal 2 : SITL & smulator
$ roslaunch modudculab_ros ctrl_pos_gazebo.launch <- WP: mission received 확인 # terminal 3
$ rosrun mavros mavsafety arm # terminal 4 : offboard
$ rosrun mavros mavsys mode -c OFFBOARD # terminal 4