From a026bee8a1657b9e6b52eb37efd249144757b2b2 Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Wed, 18 Sep 2024 15:22:46 +0900 Subject: [PATCH 1/6] fix ardupilot install path attempt --- .docker/jazzy.arm64v8.dockerfile | 12 +++---- extras/ardusub-ubuntu-install-local.sh | 47 ++++++++++++++++++++++++++ extras/mavros-ubuntu-install.sh | 4 ++- 3 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 extras/ardusub-ubuntu-install-local.sh diff --git a/.docker/jazzy.arm64v8.dockerfile b/.docker/jazzy.arm64v8.dockerfile index ac7cef67..6faf95c8 100644 --- a/.docker/jazzy.arm64v8.dockerfile +++ b/.docker/jazzy.arm64v8.dockerfile @@ -106,7 +106,7 @@ RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pk && rm -rf /var/lib/apt/lists/ # Install Ardupilot - Ardusub ADD https://raw.githubusercontent.com/IOES-Lab/dave/ardusub_install/\ -extras/ardusub-ubuntu-install.sh install.sh +extras/ardusub-ubuntu-install-local.sh install.sh RUN bash install.sh # Install mavros ADD https://raw.githubusercontent.com/IOES-Lab/dave/ardusub_install/\ @@ -156,11 +156,11 @@ RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \ echo "source /opt/mavros/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=/opt/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH" >> ~/.bashrc && \ - echo "export PATH=/opt/ardupilot_dave/ardupilot/Tools/autotest:\$PATH" >> ~/.bashrc && \ - echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH" >> ~/.bashrc && \ - echo "export GZ_SIM_RESOURCE_PATH=/opt/ardupilot_dave/ardupilot_gazebo/models:/opt/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH" >> ~/.bashrc && \&& \ - echo "\n\n" >> ~/.bashrc && echo "if [ -d ~/HOST ]; then chown docker:docker ~/HOST; fi" >> ~/.bashrc && \ + echo "export PATH=/home/$USER/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH" >> ~/.bashrc && \ + echo "export PATH=/home/$USER/ardupilot_dave/ardupilot/Tools/autotest:\$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 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/mavros-ubuntu-install.sh b/extras/mavros-ubuntu-install.sh index 9ddbb205..3cfc476f 100644 --- a/extras/mavros-ubuntu-install.sh +++ b/extras/mavros-ubuntu-install.sh @@ -22,7 +22,9 @@ 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 libasio-dev libtinyxml2-dev -y +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 From 4950c7aa1111cbc1f48e0c71985f9208778b97e5 Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Wed, 18 Sep 2024 17:22:18 +0900 Subject: [PATCH 2/6] amd update --- .docker/jazzy.amd64.dockerfile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.docker/jazzy.amd64.dockerfile b/.docker/jazzy.amd64.dockerfile index 82f7adce..d41691f2 100644 --- a/.docker/jazzy.amd64.dockerfile +++ b/.docker/jazzy.amd64.dockerfile @@ -102,17 +102,4 @@ sed --in-place --expression \ 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 - -# Set User as user -USER $USER -RUN echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc && \ - echo "source /opt/gazebo/install/setup.bash" >> ~/.bashrc && \ - echo "source /opt/mavros/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=/opt/ardupilot_dave/ardupilot/build/sitl/bin:\$PATH" >> ~/.bashrc && \ - echo "export PATH=/opt/ardupilot_dave/ardupilot/Tools/autotest:\$PATH" >> ~/.bashrc && \ - echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/ardupilot_dave/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH" >> ~/.bashrc && \ - echo "export GZ_SIM_RESOURCE_PATH=/opt/ardupilot_dave/ardupilot_gazebo/models:/opt/ardupilot_dave/ardupilot_gazebo/worlds:\$GZ_SIM_RESOURCE_PATH" >> ~/.bashrc - +'$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 \ No newline at end of file From f533ff0f8fd3034b3235fcf8ec4b03493a092fe0 Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Wed, 18 Sep 2024 17:32:29 +0900 Subject: [PATCH 3/6] amd update --- .docker/jazzy.amd64.dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.docker/jazzy.amd64.dockerfile b/.docker/jazzy.amd64.dockerfile index d41691f2..5ad17a3d 100644 --- a/.docker/jazzy.amd64.dockerfile +++ b/.docker/jazzy.amd64.dockerfile @@ -82,7 +82,9 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" && \ # source entrypoint setup RUN touch /ros_entrypoint.sh && sed --in-place --expression \ - '$i source "/opt/dave_ws/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 # Source ROS and Gazebo RUN sed --in-place --expression \ From 254f3f820a6d6a16670d231f0790d785cd2da9ac Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Wed, 18 Sep 2024 17:33:02 +0900 Subject: [PATCH 4/6] arm update --- .docker/jazzy.arm64v8.dockerfile | 51 +++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/.docker/jazzy.arm64v8.dockerfile b/.docker/jazzy.arm64v8.dockerfile index 6faf95c8..b62f8475 100644 --- a/.docker/jazzy.arm64v8.dockerfile +++ b/.docker/jazzy.arm64v8.dockerfile @@ -104,35 +104,11 @@ RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pk 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 Ardupilot - Ardusub -ADD https://raw.githubusercontent.com/IOES-Lab/dave/ardusub_install/\ -extras/ardusub-ubuntu-install-local.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 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/dave_ws/dave.repos -RUN vcs import --shallow --input "/home/$USER/dave_ws/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 - # Download the background image from GitHub raw content URL # hadolint ignore=DL3047 RUN wget -O /usr/share/backgrounds/custom-background.png -q \ @@ -145,15 +121,36 @@ 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" + +RUN sudo rosdep init && \ + sudo rosdep update --rosdistro $ROS_DISTRO + +# hadolint ignore=DL3027 +RUN sudo apt update && sudo apt --fix-broken install && \ + sudo 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 "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/build/sitl/bin:\$PATH" >> ~/.bashrc && \ From 485ccc059a484c61cd964e2ebbaa8d2899f0a77e Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Thu, 12 Sep 2024 17:47:05 +0900 Subject: [PATCH 5/6] -j flag fix --- extras/ros-jazzy-binary-gz-harmonic-source-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e7c0879fcde65b159d75e43541672e6dd4824ca6 Mon Sep 17 00:00:00 2001 From: Woen-Sug Choi Date: Thu, 19 Sep 2024 07:32:07 +0900 Subject: [PATCH 6/6] fix rosdep --- .docker/jazzy.arm64v8.dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.docker/jazzy.arm64v8.dockerfile b/.docker/jazzy.arm64v8.dockerfile index b62f8475..b3321221 100644 --- a/.docker/jazzy.arm64v8.dockerfile +++ b/.docker/jazzy.arm64v8.dockerfile @@ -133,12 +133,10 @@ RUN wget -O /home/$USER/dave_ws/dave.repos -q https://raw.githubusercontent.com/ extras/repos/dave.$ROS_DISTRO.repos RUN vcs import --shallow --input "/home/$USER/dave_ws/dave.repos" -RUN sudo rosdep init && \ - sudo rosdep update --rosdistro $ROS_DISTRO - # hadolint ignore=DL3027 RUN sudo apt update && sudo apt --fix-broken install && \ - sudo rosdep install --rosdistro $ROS_DISTRO -iy --from-paths . && \ + 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