diff --git a/.docker/jazzy.amd64.dockerfile b/.docker/jazzy.amd64.dockerfile index 8841efd9..d2cf4b2f 100644 --- a/.docker/jazzy.amd64.dockerfile +++ b/.docker/jazzy.amd64.dockerfile @@ -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 && \ @@ -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/ardusub_install/\ +extras/ardusub-ubuntu-install.sh install.sh +RUN bash install.sh +# Install mavros +ADD https://raw.githubusercontent.com/IOES-Lab/dave/ardusub_install/\ +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/\ @@ -62,7 +82,11 @@ 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 \ @@ -70,9 +94,44 @@ RUN sed --in-place --expression \ 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 \ No newline at end of file diff --git a/.docker/jazzy.arm64v8.dockerfile b/.docker/jazzy.arm64v8.dockerfile index 47a7cdaf..dbbc46ee 100644 --- a/.docker/jazzy.arm64v8.dockerfile +++ b/.docker/jazzy.arm64v8.dockerfile @@ -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 @@ -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 - -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 +# 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/ardusub_install/\ +extras/mavros-ubuntu-install.sh install.sh +RUN bash install.sh # Download the background image from GitHub raw content URL # hadolint ignore=DL3047 @@ -122,17 +121,42 @@ 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/ardusub_install/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 && \ @@ -140,13 +164,24 @@ RUN echo "export XDG_RUNTIME_DIR=~/.xdg_log" >> ~/.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 diff --git a/.github/workflows/docker-amd64.yml b/.github/workflows/docker-amd64.yml index c3f1d3fc..dbedda4e 100644 --- a/.github/workflows/docker-amd64.yml +++ b/.github/workflows/docker-amd64.yml @@ -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: diff --git a/.github/workflows/docker-arm64v8.yml b/.github/workflows/docker-arm64v8.yml index 206a682b..0740523b 100644 --- a/.github/workflows/docker-arm64v8.yml +++ b/.github/workflows/docker-arm64v8.yml @@ -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: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7afa14da..ad729a4f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/extras/ardusub-ubuntu-install-local.sh b/extras/ardusub-ubuntu-install-local.sh new file mode 100644 index 00000000..24c96ec3 --- /dev/null +++ b/extras/ardusub-ubuntu-install-local.sh @@ -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 \ No newline at end of file diff --git a/extras/ardusub-ubuntu-install.sh b/extras/ardusub-ubuntu-install.sh new file mode 100644 index 00000000..b3fea29e --- /dev/null +++ b/extras/ardusub-ubuntu-install.sh @@ -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 \ No newline at end of file diff --git a/extras/mavros-ubuntu-install.sh b/extras/mavros-ubuntu-install.sh new file mode 100644 index 00000000..3cfc476f --- /dev/null +++ b/extras/mavros-ubuntu-install.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Source Ros and Gazebo +# shellcheck source=/dev/null +source /opt/ros/jazzy/setup.bash + +mkdir -p "/opt/mavros/" && cd "/opt/mavros/" || exit +wget https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.52.tar.gz && \ + tar xfpz GeographicLib-1.52.tar.gz && rm GeographicLib-1.52.tar.gz && mv GeographicLib-1.52 GeographicLib +mkdir -p GeographicLib/BUILD && cd GeographicLib/BUILD || exit +../configure && make -j2 && make install +geographiclib-get-geoids egm96-5 +geographiclib-get-gravity egm96 +geographiclib-get-magnetic emm2015 +export GEOGRAPHICLIB_GEOID_PATH=/usr/local/share/GeographicLib/geoids + +# Manually install MAVROS from source +export MAVROS_RELEASE=ros2 +export MAVLINK_RELEASE=release/rolling/mavlink +mkdir -p "/opt/mavros/src" && cd "/opt/mavros" || exit +vcs import --force --shallow --retry 0 \ + --input https://raw.githubusercontent.com/IOES-Lab/dave/ardusub_install/extras/repos/mavros.jazzy.repos src + +# Install MAVROS dependencies +apt update && apt install -y libasio-dev libtinyxml2-dev python3-dev \ + python3-opencv python3-wxgtk4.0 python3-pip python3-matplotlib python3-lxml python3-pygame +pip3 install PyYAML mavproxy --break-system-packages + +# Build +MAKEFLAGS="-j2" ROS_PYTHON_VERSION=3 colcon build --cmake-args -DCMAKE_MODULE_PATH=/usr/local/share/cmake/GeographicLib:\$CMAKE_MODULE_PATH -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release + +# Source mavros +# shellcheck disable=SC1091 +source /opt/mavros/install/setup.bash \ No newline at end of file diff --git a/extras/repos/mavros.jazzy.repos b/extras/repos/mavros.jazzy.repos new file mode 100644 index 00000000..caa040a9 --- /dev/null +++ b/extras/repos/mavros.jazzy.repos @@ -0,0 +1,30 @@ +repositories: + mavros: + type: git + url: https://github.com/mavlink/mavros.git + ref: 5884e2f5010cc811398d92eddede9b0c7454e68a + + mavlink: + type: git + url: https://github.com/ros2-gbp/mavlink-gbp-release.git + version: release/jazzy/mavlink/2024.6.6-1 + + geographic_info: + type: git + url: https://github.com/ros-geographic-info/geographic_info.git + version: 1.0.6 + + angles: + type: git + url: https://github.com/ros/angles.git + version: 1.16.0 + + eigen_stl_containers: + type: git + url: https://github.com/ros/eigen_stl_containers.git + version: 1.0.0 + + diagnostics: + type: git + url: https://github.com/ros/diagnostics.git + version: ros2 \ No newline at end of file diff --git a/extras/ros-jazzy-binary-gz-harmonic-source-install.sh b/extras/ros-jazzy-binary-gz-harmonic-source-install.sh index 7fb496fb..32b3a717 100644 --- a/extras/ros-jazzy-binary-gz-harmonic-source-install.sh +++ b/extras/ros-jazzy-binary-gz-harmonic-source-install.sh @@ -100,7 +100,7 @@ sudo apt -y install $(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' echo -e "\033[34mBuilding the project with colcon...\033[0m" cd /opt/gazebo || exit # Build gz-physics with limited cores to avoid memory issues -MAKEFLAGS="-j2" colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install --packages-up-to gz-physics7 +MAKEFLAGS="-j 2" colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install --packages-up-to gz-physics7 # Full build colcon build --cmake-args -DBUILD_TESTING=OFF --merge-install