Skip to content

Instantly share code, notes, and snippets.

@pulak-gautam
Last active March 9, 2024 06:12
Show Gist options
  • Save pulak-gautam/8f9fcf563d13eb9ca0d287766618840d to your computer and use it in GitHub Desktop.
Save pulak-gautam/8f9fcf563d13eb9ca0d287766618840d to your computer and use it in GitHub Desktop.
Bash script to create debian installs for ArduPilot Tools
export root_dir=`pwd`
export tag="0.0.0"
# install necessary packages
pip install -U bloom
sudo apt-get install fakeroot dpkg-dev debhelper rapidjson-dev -y
# clone/install dependencies
cat <<EOF > ros2_ap.repos
repositories:
ardupilot:
type: git
url: https://github.com/ArduPilot/ardupilot.git
version: master
depth: 1
ardupilot_gazebo:
type: git
url: https://github.com/ArduPilot/ardupilot_gazebo.git
version: ros2
depth: 1
ardupilot_gz:
type: git
url: https://github.com/ArduPilot/ardupilot_gz.git
version: main
depth: 1
ardupilot_sitl_models:
type: git
url: https://github.com/ArduPilot/SITL_Models.git
version: main
depth: 1
EOF
vcs import --recursive < ros2_ap.repos
# install micro_ros vulcanexus binary
sudo curl -sSL https://raw.githubusercontent.com/eProsima/vulcanexus/main/vulcanexus.key -o /usr/share/keyrings/vulcanexus-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/vulcanexus-archive-keyring.gpg] http://repo.vulcanexus.org/debian $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/vulcanexus.list > /dev/null
sudo apt -y update
sudo apt-get install -y vulcanexus-humble-micro
# source vulcanexus packages
source /opt/vulcanexus/humble/setup.bash
# binary install for gz-garden binaries for humble
sudo apt-get install ros-humble-ros-gzgarden -y
sudo apt-get install ros-humble-topic-tools-interfaces ros-humble-topic-tools ros-humble-topic-tools-interfaces -y
sudo bash -c 'wget https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list -O /etc/ros/rosdep/sources.list.d/00-gazebo.list'
rosdep update
rosdep resolve gz-garden
## updating rosdistro
# creating custom rosdep.yaml
cat <<EOF > rosdep.yaml
ardupilot_msgs:
ubuntu: [ros-humble-ardupilot-msgs]
micro_ros_agent:
ubuntu: [vulcanexus-humble-micro-ros-agent]
ardupilot_gazebo:
ubuntu: [ros-humble-ardupilot-gazebo]
ardupilot_sitl:
ubuntu: [ros-humble-ardupilot-sitl]
ardupilot_gz_gazebo:
ubuntu: [ros-humble-ardupilot-gz-gazebo]
ardupilot_sitl_models:
ubuntu: [ros-humble-ardupilot-sitl-models]
ardupilot_gz_description:
ubuntu: [ros-humble-ardupilot-gz-description]
ros_gz_bridge:
ubuntu: [ros-humble-ros-gzgarden-bridge]
ros_gz_sim:
ubuntu: [ros-humble-ros-gzgarden-sim]
EOF
# adding url to track this yaml
sudo touch /etc/ros/rosdep/sources.list.d/50-my-packages.list
sudo bash -c 'echo "yaml file://`pwd`/rosdep.yaml" > /etc/ros/rosdep/sources.list.d/50-my-packages.list'
# updating rosdep
rosdep update
## building and generating debian binaries
export dir=$root_dir #cwd
mkdir -p $dir/debs
cd ardupilot_gz/ardupilot_gz_description && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-gz-description_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot_gz/ardupilot_gz_gazebo && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-gz-gazebo_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot_gazebo && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-gazebo_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot/Tools/ros2/ardupilot_msgs && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-msgs_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot_sitl_models/Gazebo && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-sitl-models_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot/Tools/ros2/ardupilot_sitl && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-sitl_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
cd ardupilot_gz/ardupilot_gz_bringup && bloom-generate rosdebian --ros-distro humble && fakeroot debian/rules binary && \
cd .. && sudo dpkg -i "ros-humble-ardupilot-gz-bringup_${tag}-0jammy_amd64.deb" && mv *.deb $root_dir/debs && cd $root_dir
## the binaries are generated under ./debs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment