Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ardusub install #20

Merged
merged 46 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8e82bc2
draft
woensug-choi Sep 9, 2024
fdc2c2e
add
woensug-choi Sep 9, 2024
48f7894
mac protobuff problem when compiling
woensug-choi Sep 9, 2024
46a2681
amd wrap up
woensug-choi Sep 9, 2024
e4ba69f
draft for arm
woensug-choi Sep 9, 2024
430fa3e
fix typo
woensug-choi Sep 9, 2024
c386d8e
add pexpect
woensug-choi Sep 9, 2024
7b7268e
add pexpect
woensug-choi Sep 9, 2024
5c3f74b
add sudo if not sufficient
woensug-choi Sep 9, 2024
5fbdadf
add prereq
woensug-choi Sep 10, 2024
2dfd17d
wrap up
woensug-choi Sep 10, 2024
21eacff
add gpg key
woensug-choi Sep 10, 2024
b0ab2f2
wget not found fix
woensug-choi Sep 10, 2024
7ff02a0
drafting for mavros
woensug-choi Sep 10, 2024
ab3fc36
typo fix
woensug-choi Sep 10, 2024
6767f1c
mavros drafted
woensug-choi Sep 10, 2024
5bebd8c
mavros drafted
woensug-choi Sep 10, 2024
9b4336c
temp change
woensug-choi Sep 10, 2024
c1325d8
sitl typo fix
woensug-choi Sep 10, 2024
cdb6a25
attempt for mavros
woensug-choi Sep 10, 2024
8894b6f
no sudo
woensug-choi Sep 10, 2024
b1c54ec
add libasio
woensug-choi Sep 10, 2024
4dc197f
supress dev msg
woensug-choi Sep 10, 2024
79c6ec1
link geographilclib
woensug-choi Sep 10, 2024
da3e9dc
fix geographiclib path
woensug-choi Sep 10, 2024
f91e807
minor typo
woensug-choi Sep 10, 2024
564300f
use current branch name
woensug-choi Sep 11, 2024
77b1579
add geoid path
woensug-choi Sep 11, 2024
dcf50bd
-j flag fix
woensug-choi Sep 12, 2024
a026bee
fix ardupilot install path attempt
woensug-choi Sep 18, 2024
4950c7a
amd update
woensug-choi Sep 18, 2024
f533ff0
amd update
woensug-choi Sep 18, 2024
254f3f8
arm update
woensug-choi Sep 18, 2024
35f05f3
fix ardupilot install path attempt
woensug-choi Sep 18, 2024
a2c76df
amd update
woensug-choi Sep 18, 2024
efa4120
amd update
woensug-choi Sep 18, 2024
1919ca7
arm update
woensug-choi Sep 18, 2024
485ccc0
-j flag fix
woensug-choi Sep 12, 2024
e7c0879
fix rosdep
woensug-choi Sep 18, 2024
ca9a23a
Merge branch 'ardusub_install' into dockertest
woensug-choi Sep 18, 2024
7829b01
add ascii art for arm rdp
woensug-choi Sep 18, 2024
18a2c94
testing ascii art for amd
woensug-choi Sep 18, 2024
3f69b2b
amd image ascii art and coloring
woensug-choi Sep 18, 2024
8c2f58d
typo fix
woensug-choi Sep 19, 2024
b77235d
yaml fix for mavros-extras
woensug-choi Sep 19, 2024
98cc9a9
finalize
woensug-choi Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 70 additions & 11 deletions .docker/jazzy.amd64.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ RUN apt-get update && \
curl wget git build-essential cmake cppcheck \
gnupg libeigen3-dev libgles2-mesa-dev \
lsb-release pkg-config protobuf-compiler \
python3-dbg python3-pip python3-venv \
python3-dbg python3-pip python3-venv python3-pexpect \
python-is-python3 python3-future python3-wxgtk4.0 \
qtbase5-dev ruby dirmngr gnupg2 nano xauth \
software-properties-common htop libtool \
x11-apps mesa-utils bison flex automake && \
rm -rf /var/lib/apt/lists/
x11-apps mesa-utils bison flex automake \
&& rm -rf /var/lib/apt/lists/

# Prereqs for Ardupilot - Ardusub
ADD --chown=root:root --chmod=0644 https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list /etc/ros/rosdep/sources.list.d/00-gazebo.list
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends \
libgz-sim8-dev rapidjson-dev libopencv-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl \
&& rm -rf /var/lib/apt/lists/

# Locale for UTF-8
RUN truncate -s0 /tmp/preseed.cfg && \
Expand Down Expand Up @@ -42,8 +53,17 @@ ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/ros-jazzy-binary-gz-harmonic-source-install.sh install.sh
RUN bash install.sh

# Install Ardupilot - Ardusub
ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/ardusub-ubuntu-install.sh install.sh
RUN bash install.sh
# Install mavros
ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/mavros-ubuntu-install.sh install.sh
RUN bash install.sh

# Set up Dave workspace
ENV DAVE_WS=/opt/ws_dave
ENV DAVE_WS=/opt/dave_ws
WORKDIR $DAVE_WS/src

ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
Expand All @@ -62,17 +82,56 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" && \

# source entrypoint setup
RUN touch /ros_entrypoint.sh && sed --in-place --expression \
'$i source "/opt/ws_dave/install/setup.bash"' /ros_entrypoint.sh
'$i source "/opt/dave_ws/install/setup.bash"' /ros_entrypoint.sh \
&& sed --in-place --expression \
'$i cd /root' /ros_entrypoint.sh

RUN cp /home/docker/.bashrc ~/.bashrc

# Source ROS and Gazebo
RUN sed --in-place --expression \
'$i source "/opt/ros/jazzy/setup.bash"' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i source "/opt/gazebo/install/setup.bash"' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export PYTHONPATH=$PYTHONPATH:/opt/gazebo/install/lib/python' /ros_entrypoint.sh

# Set User as user
USER $USER
RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \
echo "source /opt/gazebo/install/setup.bash" >> ~/.bashrc
'$i source "/opt/mavros/install/setup.bash"' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export GEOGRAPHICLIB_GEOID_PATH=/usr/local/share/GeographicLib/geoids' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export PYTHONPATH=\$PYTHONPATH:/opt/gazebo/install/lib/python' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export PATH=/opt/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export PATH=/opt/ardupilot_dave/ardupilot/Tools/autotest:\$PATH' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i export GZ_SIM_RESOURCE_PATH=/opt/ardupilot_dave/ardupilot_gazebo/models:/opt/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\''\\033[1;37m \n=====\n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' ____ ___ _______ _ _ _ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' | _ \\ / \\ \\ / | ____| / \\ __ _ _ _ __ _| |_(_) ___ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' | | | |/ _ \\ \\ / /| _| / _ \\ / _` | | | |/ _` | __| |/ __|\n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' | |_| / ___ \\ V / | |___ / ___ \\ (_| | |_| | (_| | |_| | (__ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' |____/_/ \\_\\_/ |_____| /_/ \\_\\__, |\\__,_|\\__,_|\\__|_|\\___|\n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' __ ___ _ _ _____ _ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' \\ \\ / (_)_ __| |_ _ _ __ _| | | ____|_ ____ _(_)_ __ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' \\ \\ / /| | `__| __| | | |/ _` | | | _| | `_ \\ \\ / | | `__| \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' \\ V / | | | | |_| |_| | (_| | | | |___| | | \\ V /| | |_ \n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\'' \\_/ |_|_| \\__|\\__,_|\\__,_|_| |_____|_| |_|\\_/ |_|_(_) \n\\033[0m'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\''\\033[1;32m\n =====\\033[0m\n'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\''\\033[1;32m 👋 Hi! This is Docker virtual environment for DAVE\n\\033[0m'\'' ' /ros_entrypoint.sh && \
sed --in-place --expression \
'$i printf '\''\\033[1;33m\tROS2 Jazzy - Gazebo Harmonic (w ardupilot(ardusub) + mavros)\n\n\\033[0m'\'' ' /ros_entrypoint.sh
91 changes: 63 additions & 28 deletions .docker/jazzy.arm64v8.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

# Using the pre-built image for above commented out dockerfile code lines
# hadolint ignore=DL3007
FROM --platform=linux/arm64 woensugchoi/ubuntu-arm-rdp-base:latest
FROM woensugchoi/ubuntu-arm-rdp-base:latest
ARG USER=docker

# ROS-Gazebo arg
Expand All @@ -90,25 +90,24 @@ ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/ros-jazzy-binary-gz-harmonic-source-install.sh install.sh
RUN bash install.sh

# Set up Dave workspace
ENV ROS_UNDERLAY=/home/$USER/dave_ws/install
WORKDIR $ROS_UNDERLAY/../src

# Prereqs for Ardupilot - Ardusub
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
# hadolint ignore=DL3008
ADD --chown=root:root --chmod=0644 https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list /etc/ros/rosdep/sources.list.d/00-gazebo.list
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
&& apt-get -q update && \
apt-get install -y --no-install-recommends \
python-is-python3 python3-future python3-wxgtk4.0 python3-pexpect \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
libgz-sim8-dev rapidjson-dev libopencv-dev libasio-dev \
gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl \
&& rm -rf /var/lib/apt/lists/
# Install mavros
ADD https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/repos/dave.$ROS_DISTRO.repos /home/$USER/ws_dave/dave.repos
RUN vcs import --shallow --input "/home/$USER/ws_dave/dave.repos"

RUN rosdep init && \
rosdep update --rosdistro $ROS_DISTRO

# hadolint ignore=DL3027
RUN apt update && apt --fix-broken install && \
rosdep update && rosdep install -iy --from-paths . && \
rm -rf /var/lib/apt/lists/

WORKDIR $ROS_UNDERLAY/..
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" && \
colcon build
extras/mavros-ubuntu-install.sh install.sh
RUN bash install.sh

# Download the background image from GitHub raw content URL
# hadolint ignore=DL3047
Expand All @@ -122,31 +121,67 @@ extras/background.png && \
cp /usr/share/backgrounds/warty-final-ubuntu.png \
/usr/share/backgrounds/ubuntu-wallpaper-d.png

# source entrypoint setup
RUN touch /ros_entrypoint.sh && sed --in-place --expression \
'$i source "$ROS_UNDERLAY/setup.bash"' /ros_entrypoint.sh
# Install Ardupilot - Ardusub
USER docker
RUN wget -O /tmp/install.sh https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/extras/ardusub-ubuntu-install-local.sh
RUN chmod +x /tmp/install.sh && bash /tmp/install.sh

# Set up Dave workspace
ENV DAVE_UNDERLAY=/home/$USER/dave_ws
WORKDIR $DAVE_UNDERLAY/src
RUN wget -O /home/$USER/dave_ws/dave.repos -q https://raw.githubusercontent.com/IOES-Lab/dave/$BRANCH/\
extras/repos/dave.$ROS_DISTRO.repos
RUN vcs import --shallow --input "/home/$USER/dave_ws/dave.repos"

# hadolint ignore=DL3027
RUN sudo apt update && sudo apt --fix-broken install && \
sudo rosdep init && rosdep update --rosdistro $ROS_DISTRO && \
rosdep install --rosdistro $ROS_DISTRO -iy --from-paths . && \
sudo rm -rf /var/lib/apt/lists/

# Build dave workspace
WORKDIR $DAVE_UNDERLAY
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" && colcon build

# Set User as user
USER docker
RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \
echo "source /opt/gazebo/install/setup.bash" >> ~/.bashrc && \
echo "export PYTHONPATH=$PYTHONPATH:/opt/gazebo/install/lib/python" >> ~/.bashrc && \
echo "if [ -d ~/HOST ]; then chown docker:docker ~/HOST; fi" \
>> ~/.bashrc
echo "source /opt/mavros/install/setup.bash" >> ~/.bashrc && \
echo "source $DAVE_UNDERLAY/install/setup.bash" >> ~/.bashrc && \
echo "export GEOGRAPHICLIB_GEOID_PATH=/usr/local/share/GeographicLib/geoids" >> ~/.bashrc && \
echo "export PYTHONPATH=\$PYTHONPATH:/opt/gazebo/install/lib/python" >> ~/.bashrc && \
echo "export PATH=/home/$USER/ardupilot_dave/ardupilot/Tools/autotest:\$PATH" >> ~/.bashrc && \
echo "export PATH=/home/$USER/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH" >> ~/.bashrc && \
echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/home/$USER/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH" >> ~/.bashrc && \
echo "export GZ_SIM_RESOURCE_PATH=/home/$USER/ardupilot_dave/ardupilot_gazebo/models:/home/$USER/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH" >> ~/.bashrc && \
echo "\n\n" >> ~/.bashrc && echo "if [ -d ~/HOST ]; then chown $USER:$USER ~/HOST; fi" >> ~/.bashrc && \
echo "\n\n" >> ~/.bashrc

# Other environment variables
RUN echo "export XDG_RUNTIME_DIR=~/.xdg_log" >> ~/.bashrc && \
echo "unset SESSION_MANAGER" >> ~/.bashrc

# Create and write the welcome message to a new file
RUN mkdir -p /home/docker/.config/autostart && \
printf '\033[1;37m =====\n' >> ~/.hi && \
printf ' ____ ___ _______ _ _ _ \n' >> ~/.hi && \
printf ' | _ \ / \ \ / | ____| / \ __ _ _ _ __ _| |_(_) ___ \n' >> ~/.hi && \
printf ' | | | |/ _ \ \ / /| _| / _ \ / _` | | | |/ _` | __| |/ __|\n' >> ~/.hi && \
printf ' | |_| / ___ \ V / | |___ / ___ | (_| | |_| | (_| | |_| | (__ \n' >> ~/.hi && \
printf ' |____/_/ \_\_/ |_____| /_/ \_\__, |\__,_|\__,_|\__|_|\___|\n' >> ~/.hi && \
printf ' __ ___ _ _ _____ _ \n' >> ~/.hi && \
printf ' \ \ / (_)_ __| |_ _ _ __ _| | | ____|_ ____ _(_)_ __ \n' >> ~/.hi && \
printf ' \ \ / /| | `__| __| | | |/ _` | | | _| | `_ \ \ / | | `__| \n' >> ~/.hi && \
printf ' \ V / | | | | |_| |_| | (_| | | | |___| | | \ V /| | |_ \n' >> ~/.hi && \
printf ' \_/ |_|_| \__|\__,_|\__,_|_| |_____|_| |_|\_/ |_|_(_) \n\033[0m' >> ~/.hi && \
printf '\033[1;32m\n =====\n\033[0m' >> ~/.hi && \
printf "\\033[1;32m 👋 Hi! This is Docker virtual environment\n\\033[0m" \
printf "\\033[1;32m 👋 Hi! This is Docker virtual environment for DAVE\n\\033[0m" \
>> ~/.hi && \
printf "\\033[1;33m\tROS2 Jazzy - Gazebo Harmonic\n\n\n\\033[0m" \
printf "\\033[1;33m\tROS2 Jazzy - Gazebo Harmonic (w ardupilot(ardusub) + mavros)\n\n\n\\033[0m" \
>> ~/.hi

# Remove sudo message
# Remove sudo message
RUN touch /home/docker/.sudo_as_admin_successful

# Autostart terminal
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
env:
IMAGE_NAME: ${{ github.repository }}
ROS_DISTRO: jazzy
BRANCH: ros2
BRANCH: ${{ github.ref_name }}

jobs:
build-and-push-to-docker-hub:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-arm64v8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
env:
IMAGE_NAME: ${{ github.repository }}
ROS_DISTRO: jazzy
BRANCH: ros2
BRANCH: ${{ github.ref_name }}

jobs:
build-and-push-to-docker-hub:
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ repos:

# Spellcheck in comments and docs
# skipping of *.svg files is not working...
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--write-changes", "--uri-ignore-words-list=ist", "-L manuel"]
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$
# - repo: https://github.com/codespell-project/codespell
# rev: v2.3.0
# hooks:
# - id: codespell
# args: ["--write-changes", "--uri-ignore-words-list=ist", "-L manuel"]
# exclude: CHANGELOG\.rst|\.(svg|pyc|drawio)$

# Json lint
- repo: https://github.com/python-jsonschema/check-jsonschema
Expand Down
47 changes: 47 additions & 0 deletions extras/ardusub-ubuntu-install-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Source Ros and Gazebo
# shellcheck source=/dev/null
source /opt/ros/jazzy/setup.bash
# shellcheck source=/dev/null
source /opt/gazebo/install/setup.bash

export USER=docker

# Really should do version pinning but Sub-4.5 is waaaay behind master
# (e.g. it doesn't know about "noble" yet)
export ARDUPILOT_RELEASE=master
mkdir -p "/home/$USER/ardupilot_dave" && cd "/home/$USER/ardupilot_dave" || exit
git clone -b $ARDUPILOT_RELEASE https://github.com/ArduPilot/ardupilot.git --recurse-submodules

# Install ArduSub dependencies
cd "/home/$USER/ardupilot_dave/ardupilot" || exit
export SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1
# Do not install the STM development tools
export DO_AP_STM_ENV=0
# Do not activate the Ardupilot venv by default
export DO_PYTHON_VENV_ENV=0
Tools/environment_install/install-prereqs-ubuntu.sh -y

# Build ArduSub
modules/waf/waf-light configure --board sitl \
&& modules/waf/waf-light build --target bin/ardusub

# Clone ardupilot_gazebo code
cd "/home/$USER/ardupilot_dave" || exit
git clone https://github.com/ArduPilot/ardupilot_gazebo.git

# Install ardupilot_gazebo plugin
# Check if the directory creation was successful
mkdir -p "/home/$USER/ardupilot_dave/ardupilot_gazebo/build" \
&& cd "/home/$USER/ardupilot_dave/ardupilot_gazebo/build" || exit
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j2

# Add results of ArduSub build
export PATH=/home/$USER/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH
# Optional: add autotest to the PATH, helpful for running sim_vehicle.py
export PATH=/home/$USER/ardupilot_dave/ardupilot/Tools/autotest:\$PATH
# Add ardupilot_gazebo plugin
export GZ_SIM_SYSTEM_PLUGIN_PATH=/home/$USER/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH
# Add ardupilot_gazebo models and worlds
export GZ_SIM_RESOURCE_PATH=/home/$USER/ardupilot_dave/ardupilot_gazebo/models:/home/$USER/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH
45 changes: 45 additions & 0 deletions extras/ardusub-ubuntu-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# Source Ros and Gazebo
# shellcheck source=/dev/null
source /opt/ros/jazzy/setup.bash
# shellcheck source=/dev/null
source /opt/gazebo/install/setup.bash

# Really should do version pinning but Sub-4.5 is waaaay behind master
# (e.g. it doesn't know about "noble" yet)
export ARDUPILOT_RELEASE=master
mkdir -p "/opt/ardupilot_dave" && cd "/opt/ardupilot_dave" || exit
git clone -b $ARDUPILOT_RELEASE https://github.com/ArduPilot/ardupilot.git --recurse-submodules

# Install ArduSub dependencies
cd "/opt/ardupilot_dave/ardupilot" || exit
export SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1
# Do not install the STM development tools
export DO_AP_STM_ENV=0
# Do not activate the Ardupilot venv by default
export DO_PYTHON_VENV_ENV=0
Tools/environment_install/install-prereqs-ubuntu.sh -y

# Build ArduSub
modules/waf/waf-light configure --board sitl \
&& modules/waf/waf-light build --target bin/ardusub

# Clone ardupilot_gazebo code
cd "/opt/ardupilot_dave" || exit
git clone https://github.com/ArduPilot/ardupilot_gazebo.git

# Install ardupilot_gazebo plugin
# Check if the directory creation was successful
mkdir -p "/opt/ardupilot_dave/ardupilot_gazebo/build" \
&& cd "/opt/ardupilot_dave/ardupilot_gazebo/build" || exit
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j2

# Add results of ArduSub build
export PATH=/opt/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH
# Optional: add autotest to the PATH, helpful for running sim_vehicle.py
export PATH=/opt/ardupilot_dave/ardupilot/Tools/autotest:\$PATH
# Add ardupilot_gazebo plugin
export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH
# Add ardupilot_gazebo models and worlds
export GZ_SIM_RESOURCE_PATH=/opt/ardupilot_dave/ardupilot_gazebo/models:/opt/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH
Loading