step1_install_depenences.sh
#!/bin/bash
#install gazebo 11
#install protobuf 3.19.6
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
# 將 empy 的版本調整爲3.3.4
pip3 uninstall empy
pip3 install empy==3.3.4
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install aptitude
sudo apt install git
step2_install_gazebo_ros.sh
#!/bin/bash
# 雖然已經安裝裏gazebo 11 但是報錯找不到gazeboConfig.cmake 依照網上的建議安裝
sudo apt install ros-$ROS_DISTRO-gazebo*
step3_install_GStreamer1.0.sh
# 需要安裝 GStreamer1.0
#https://github.com/PX4/PX4-Autopilot/issues/13117
sudo apt install libgstreamer1.0-dev
sudo apt install gstreamer1.0-plugins-good
sudo apt install gstreamer1.0-plugins-bad
sudo apt install gstreamer1.0-plugins-ugly
step4_git_clone.sh
#!/bin/bash
export WS_DIR="/home/hao/Documents/wks_third_party"
export GIT_DIR=$WS_DIR/resource_source/PX4/v1_13_3
rm $GIT_DIR
mkdir $GIT_DIR -p
cd $GIT_DIR
git clone https://github.com/PX4/PX4-Autopilot.git --recursive -b v1.13.3
step5_git_version.sh
#!/bin/bash
export WS_DIR="/home/hao/Documents/wks_third_party"
export Autopilot_DIR=$WS_DIR/resource_source/PX4/v1_13_3/PX4-Autopilot
cd $Autopilot_DIR
git status
git branch -r | grep "release"
echo "----------------before check out--------------------------------------------------------"
git checkout origin/release/1.13
echo "----------------after check out--------------------------------------------------------"
git status
step6_config_ubuntu.sh
#!/bin/bash
set -o errexit
set -o verbose
export WS_DIR="/home/hao/Documents/wks_third_party"
export Autopilot_DIR=$WS_DIR/resource_source/PX4/v1_13_3/PX4-Autopilot
cd $Autopilot_DIR/Tools/setup
bash $Autopilot_DIR/Tools/setup/ubuntu.sh --fix-missing
step7_build_gazebo.sh
#!/bin/bash
export WS_DIR="/home/hao/Documents/wks_third_party"
export Autopilot_DIR=$WS_DIR/resource_source/PX4/v1_13_3/PX4-Autopilot
cd $Autopilot_DIR
make px4_sitl_default gazebo
step8_run_with_launch.sh
export WS_DIR="/home/hao/Documents/wks_third_party"
export Autopilot_DIR=$WS_DIR/resource_source/PX4/v1_13_3/PX4-Autopilot
source $Autopilot_DIR/Tools/setup_gazebo.bash $Autopilot_DIR $Autopilot_DIR/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$Autopilot_DIR
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$Autopilot_DIR/Tools/sitl_gazebo
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$Autopilot_DIR/Tools/simulation-ignition
roslaunch px4 mavros_posix_sitl.launch