From 925849e05a7b5d890e825f90a7e147b92cdbf52e Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 28 Dec 2023 13:31:44 -0700 Subject: [PATCH 01/19] Add vision_msgs to demo deps (#87) --- space_robots/demo_manual_pkgs.repos | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/space_robots/demo_manual_pkgs.repos b/space_robots/demo_manual_pkgs.repos index 1170be8..1d020f8 100644 --- a/space_robots/demo_manual_pkgs.repos +++ b/space_robots/demo_manual_pkgs.repos @@ -31,4 +31,7 @@ repositories: type: git url: https://github.com/ros-planning/warehouse_ros_mongo.git version: ros2 - \ No newline at end of file + vision_msgs: + type: git + url: https://github.com/ros-perception/vision_msgs.git + version: ros2 From 4edb462544441a7e91ac5e04d6024aca4bd8c519 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 28 Dec 2023 11:26:00 -0700 Subject: [PATCH 02/19] Don't limit parallel workers in moveit2 build (#77) This is a common hack to avoid running out of memory while building a large C++ codebase. However, it's unnecessary in an era where users just need to be educated to configure `zram` on their system. --- moveit2/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index 6181fd8..1aa98ae 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -125,7 +125,7 @@ RUN cd src/octomap_msgs && git apply octomap_fix.diff # Build MoveIt2 RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \ - && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status- --parallel-workers 1' + && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-' # Add a couple sample GUI apps for testing RUN sudo apt-get install -y \ From 30f36368732c8bfa782336a423f609d1fc24558f Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 11 Jan 2024 09:12:25 -0500 Subject: [PATCH 03/19] Point users to space_robots demo at end of moveit2 README (#85) --- moveit2/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/moveit2/README.md b/moveit2/README.md index e7088f8..24fec06 100644 --- a/moveit2/README.md +++ b/moveit2/README.md @@ -68,3 +68,7 @@ ros2 launch moveit2_tutorials move_group.launch.py ![rviz2 move group window](resources/moveit2-rviz.png) Then, you can follow the [Move Group C++ Interface Demo documentation](https://moveit.picknik.ai/humble/doc/examples/move_group_interface/move_group_interface_tutorial.html). + +## Running the Space ROS Space Robots Demos + +Once you have tested that MoveIt2 works, you are ready to run some of the other [Space ROS space robot demos](../space_robots/README.md). From 8d2ee4c2059e224396510663977fef5dcbd00214 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Sun, 17 Dec 2023 15:00:05 +0100 Subject: [PATCH 04/19] Add refspec #89 --- spaceros/Earthfile | 25 +++++++++++++++++++++---- spaceros/README.md | 6 ++++++ spaceros/build.sh | 1 - 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index 442343d..7d3190d 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -14,6 +14,15 @@ VERSION 0.6 FROM ubuntu:jammy +# current git branch, prefilled by earthly +# https://docs.earthly.dev/docs/earthfile/builtin-args +ARG EARTHLY_GIT_BRANCH + +# can be overriden from cli by passing --GIT_BRANCH=... as an argument +# example -> `earthly +image --SPACEROS_REPO_URL=https://... +ARG GIT_BRANCH=${EARTHLY_GIT_BRANCH} +ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" + earthfile: COPY Earthfile Earthfile SAVE ARTIFACT Earthfile @@ -21,7 +30,7 @@ earthfile: setup: # Disable prompting during package installation ARG DEBIAN_FRONTEND=noninteractive - + # The following commands are based on the source install for ROS 2 Rolling Ridley. # See: https://docs.ros.org/en/ros2_documentation/rolling/Installation/Ubuntu-Development-Setup.html # The main variation is getting Space ROS sources instead of the Rolling sources. @@ -74,7 +83,6 @@ setup: ENV HOME_DIR=/home/${USERNAME} ENV SPACEROS_DIR=${HOME_DIR}/spaceros ARG IKOS_DIR=${HOME_DIR}/ikos - ARG REPOS_FILE_URL="https://raw.githubusercontent.com/space-ros/space-ros/main/ros2.repos" ENV ROSDISTRO=humble # Create a spaceros user @@ -94,9 +102,18 @@ setup: sources: FROM +setup - COPY github.com/space-ros/space-ros:earthly-wrapper+repos-file/ros2.repos ros2.repos + RUN mkdir spaceros_repo_dir + + IF[ -z "$(git -C spaceros_repo_dir ls-remote ${SPACEROS_REPO_URL} ${GIT_BRANCH})" ] + RUN echo "branch '${GIT_BRANCH}' does not exist in spaceros repo, cloning main branch" + GIT CLONE ${SPACEROS_REPO_URL} spaceros_repo_dir/ + ELSE + RUN echo "cloning branch '${GIT_BRANCH}' from spaceros repo" + GIT CLONE --branch ${GIT_BRANCH} ${SPACEROS_REPO_URL} spaceros_repo_dir/ + END + RUN mkdir src - RUN vcs import src < ros2.repos + RUN vcs import src < spaceros_repo_dir/ros2.repos SAVE ARTIFACT src AS LOCAL src workspace: diff --git a/spaceros/README.md b/spaceros/README.md index 1abf83e..7586866 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -15,6 +15,12 @@ $ ./build.sh The build process will take about 20 or 30 minutes, depending on the host computer. +The build process defaults to cloning the `ros2.repos` file from [spaceros](https://github.com/space-ros/space-ros) repository. It looks for a branch with the same name as the current local branch; if it doesn't find one, it falls back to cloning from the main branch. For testing purposes, you can customize both the spaceros repository URL and the branch name by modifying arguments defined in the [Earthfile](./Earthfile). +Example: +```bash +earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.git" +``` + ## Running the Space ROS Docker Image in a Container After building the image, you can see the newly-built image by running: diff --git a/spaceros/build.sh b/spaceros/build.sh index fa877b1..5a6b2e8 100755 --- a/spaceros/build.sh +++ b/spaceros/build.sh @@ -11,7 +11,6 @@ echo "##### Building Space ROS Docker Image #####" echo "" rm -rf src -earthly +sources earthly +image \ --VCS_REF="$VCS_REF" From d7c919e082c9e85586bc7cbbc3440c16fa4a629a Mon Sep 17 00:00:00 2001 From: xfiderek Date: Sun, 17 Dec 2023 15:17:57 +0100 Subject: [PATCH 05/19] simplify comments --- spaceros/Earthfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index 7d3190d..33c8a85 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -18,10 +18,10 @@ FROM ubuntu:jammy # https://docs.earthly.dev/docs/earthfile/builtin-args ARG EARTHLY_GIT_BRANCH -# can be overriden from cli by passing --GIT_BRANCH=... as an argument +# these can be overriden from cli # example -> `earthly +image --SPACEROS_REPO_URL=https://... -ARG GIT_BRANCH=${EARTHLY_GIT_BRANCH} ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" +ARG GIT_BRANCH=${EARTHLY_GIT_BRANCH} earthfile: COPY Earthfile Earthfile From 664c46e4c4f465ed47429a0782f20a800cecb3b6 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Sun, 17 Dec 2023 15:18:49 +0100 Subject: [PATCH 06/19] simplify comments further --- spaceros/Earthfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index 33c8a85..102610c 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -18,8 +18,8 @@ FROM ubuntu:jammy # https://docs.earthly.dev/docs/earthfile/builtin-args ARG EARTHLY_GIT_BRANCH -# these can be overriden from cli -# example -> `earthly +image --SPACEROS_REPO_URL=https://... +# these can be overriden from cli. Example: +# `earthly +image --SPACEROS_REPO_URL=https://...` ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" ARG GIT_BRANCH=${EARTHLY_GIT_BRANCH} From cfb2b8ba62d63115a2721ada5fd5ace6e76e1cb3 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Sun, 17 Dec 2023 15:33:43 +0100 Subject: [PATCH 07/19] revert change to build.sh --- spaceros/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/spaceros/build.sh b/spaceros/build.sh index 5a6b2e8..fa877b1 100755 --- a/spaceros/build.sh +++ b/spaceros/build.sh @@ -11,6 +11,7 @@ echo "##### Building Space ROS Docker Image #####" echo "" rm -rf src +earthly +sources earthly +image \ --VCS_REF="$VCS_REF" From cb59989356e4be6e61c9aefd3bb7e90792811827 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Mon, 18 Dec 2023 08:12:40 +0100 Subject: [PATCH 08/19] simplify git ls-remote command --- spaceros/Earthfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index 102610c..c2a77ab 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -104,7 +104,7 @@ sources: FROM +setup RUN mkdir spaceros_repo_dir - IF[ -z "$(git -C spaceros_repo_dir ls-remote ${SPACEROS_REPO_URL} ${GIT_BRANCH})" ] + IF[ -z "$(git ls-remote ${SPACEROS_REPO_URL} ${GIT_BRANCH})" ] RUN echo "branch '${GIT_BRANCH}' does not exist in spaceros repo, cloning main branch" GIT CLONE ${SPACEROS_REPO_URL} spaceros_repo_dir/ ELSE From 7335a8c67ac59a9c50aeb609487bfa80116fc166 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Mon, 18 Dec 2023 16:59:28 +0100 Subject: [PATCH 09/19] temp changes --- spaceros/Earthfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index c2a77ab..d43003d 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -21,7 +21,7 @@ ARG EARTHLY_GIT_BRANCH # these can be overriden from cli. Example: # `earthly +image --SPACEROS_REPO_URL=https://...` ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" -ARG GIT_BRANCH=${EARTHLY_GIT_BRANCH} +ARG SPACEROS_GIT_REF=${EARTHLY_GIT_BRANCH} earthfile: COPY Earthfile Earthfile @@ -104,12 +104,12 @@ sources: FROM +setup RUN mkdir spaceros_repo_dir - IF[ -z "$(git ls-remote ${SPACEROS_REPO_URL} ${GIT_BRANCH})" ] - RUN echo "branch '${GIT_BRANCH}' does not exist in spaceros repo, cloning main branch" + IF[ -z "$(git ls-remote ${SPACEROS_REPO_URL} ${SPACEROS_GIT_REF})" ] + # branch '${SPACEROS_GIT_REF}' does not exist in spaceros repo, cloning main branch GIT CLONE ${SPACEROS_REPO_URL} spaceros_repo_dir/ ELSE - RUN echo "cloning branch '${GIT_BRANCH}' from spaceros repo" - GIT CLONE --branch ${GIT_BRANCH} ${SPACEROS_REPO_URL} spaceros_repo_dir/ + # branch with the same name exists, cloning from it + GIT CLONE --branch ${SPACEROS_GIT_REF} ${SPACEROS_REPO_URL} spaceros_repo_dir/ END RUN mkdir src From 69ca1bd1961c5647c21fd435b96eff2ac223e1b4 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Tue, 19 Dec 2023 02:53:12 +0100 Subject: [PATCH 10/19] temp --- spaceros/Earthfile | 79 ++++++++++++++++++++++++++++++++++++++-------- spaceros/README.md | 2 +- 2 files changed, 66 insertions(+), 15 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index d43003d..dd834df 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -18,11 +18,6 @@ FROM ubuntu:jammy # https://docs.earthly.dev/docs/earthfile/builtin-args ARG EARTHLY_GIT_BRANCH -# these can be overriden from cli. Example: -# `earthly +image --SPACEROS_REPO_URL=https://...` -ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" -ARG SPACEROS_GIT_REF=${EARTHLY_GIT_BRANCH} - earthfile: COPY Earthfile Earthfile SAVE ARTIFACT Earthfile @@ -100,20 +95,76 @@ setup: RUN sudo add-apt-repository ppa:kisak/kisak-mesa RUN sudo apt update && sudo apt upgrade -y -sources: - FROM +setup - RUN mkdir spaceros_repo_dir +clone-spaceros-artifacts: + # we must run it in a separate container, so that downstream tasks can be cached if vcs file does not change + FROM ubuntu:jammy + RUN apt-get update && apt-get install -y git wget + + # main purpose of this command is to make sure that the git ls-remote results are not cached + RUN --no-cache echo "Cloning spaceros repo artifacts" + + ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" + # set default spaceros git ref to current branch in local repo + ARG SPACEROS_GIT_REF=${EARTHLY_GIT_BRANCH} # EARTHLY_GIT_BRANCH is populated by earthly + + # if SPACEROS_GIT_REF branch does not exist, artifacts will be cloned from fallback branch + ARG _FALLBACK_BRANCH = "main" + + ARG _GIT_REF_EXISTS = $([ -z $(git ls-remote ${SPACEROS_REPO_URL} ${SPACEROS_GIT_REF}) ] && echo false || echo true) + ARG _MAIN_SPACEROS_REPO_IS_USED = $([ ${SPACEROS_REPO_URL} = "https://github.com/space-ros/space-ros.git" ] && echo true || echo false) + ARG _GIT_REF_OVERRIDEN_BY_USER = $([ ${SPACEROS_GIT_REF} != ${EARTHLY_GIT_BRANCH} ] && echo true || echo false) + + # If main spaceros repo is used then do it using wget to avoid unneccessary file copies + IF [ ${_MAIN_SPACEROS_REPO_IS_USED} ] && [ ${_GIT_REF_EXISTS} ] + RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${SPACEROS_GIT_REF}/ros2.repos + ELSE IF [ $_MAIN_SPACEROS_REPO_IS_USED ] && [ !$_GIT_REF_EXISTS ] && [ !$_GIT_REF_OVERRIDEN_BY_USER ] + RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${_FALLBACK_BRANCH}/ros2.repos + ELSE IF [ !$_MAIN_SPACEROS_REPO_IS_USED ] && [ $_GIT_REF_EXISTS ] + GIT CLONE --branch ${SPACEROS_GIT_REF} ${SPACEROS_REPO_URL} + ELSE IF [ !$_MAIN_SPACEROS_REPO_IS_USED ] && [ !$_GIT_REF_EXISTS ] && [ !$_GIT_REF_OVERRIDEN_BY_USER ] + GIT CLONE --branch ${_FALLBACK_BRANCH} ${SPACEROS_REPO_URL} + ELSE + RUN exit 1; + END + + - IF[ -z "$(git ls-remote ${SPACEROS_REPO_URL} ${SPACEROS_GIT_REF})" ] - # branch '${SPACEROS_GIT_REF}' does not exist in spaceros repo, cloning main branch - GIT CLONE ${SPACEROS_REPO_URL} spaceros_repo_dir/ + # ARG _ + + # if branch with the same name does not exist in the spaceros repo, clone from main + # ARG _SPACEROS_GIT_REF_SUBSTITUTED="$( + # if + # then + # echo 'main' + # else + # echo '${SPACEROS_GIT_REF}' + # fi + # ) + # " + + # RUN --no-cache echo $_SPACEROS_GIT_REF_SUBSTITUTED + # $( then echo 'main'; else echo)" + + # we run this command primarily to call `git ls-remote` without caching + + # if branch ${SPACEROS_GIT_REF} does not exist in `spaceros` repo, default to main branch + + # download latest commit. + IF [ ${SPACEROS_REPO_URL} = "https://github.com/space-ros/space-ros.git" ] + + RUN ELSE - # branch with the same name exists, cloning from it - GIT CLONE --branch ${SPACEROS_GIT_REF} ${SPACEROS_REPO_URL} spaceros_repo_dir/ + # otherwise clone whole commit (git clone handles authentication etc) + GIT CLONE --branch ${LATEST_GIT_REF} ${SPACEROS_REPO_URL} . END + SAVE ARTIFACT ros2.repos + +sources: + FROM +setup + COPY +clone-spaceros-artifacts/ros2.repos ros2.repos RUN mkdir src - RUN vcs import src < spaceros_repo_dir/ros2.repos + RUN vcs import src < ros2.repos SAVE ARTIFACT src AS LOCAL src workspace: diff --git a/spaceros/README.md b/spaceros/README.md index 7586866..4cae5ab 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -18,7 +18,7 @@ The build process will take about 20 or 30 minutes, depending on the host comput The build process defaults to cloning the `ros2.repos` file from [spaceros](https://github.com/space-ros/space-ros) repository. It looks for a branch with the same name as the current local branch; if it doesn't find one, it falls back to cloning from the main branch. For testing purposes, you can customize both the spaceros repository URL and the branch name by modifying arguments defined in the [Earthfile](./Earthfile). Example: ```bash -earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.git" +earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.git" --SPACEROS_GIT_REF="my-branch-name" ``` ## Running the Space ROS Docker Image in a Container From 6d7cf7493819eaeba2d195f4f69b8c3e42b69768 Mon Sep 17 00:00:00 2001 From: xfiderek Date: Wed, 20 Dec 2023 20:18:15 +0100 Subject: [PATCH 11/19] push working version --- spaceros/Earthfile | 73 +++++++++++----------------------------------- 1 file changed, 17 insertions(+), 56 deletions(-) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index dd834df..6f55344 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -14,10 +14,6 @@ VERSION 0.6 FROM ubuntu:jammy -# current git branch, prefilled by earthly -# https://docs.earthly.dev/docs/earthfile/builtin-args -ARG EARTHLY_GIT_BRANCH - earthfile: COPY Earthfile Earthfile SAVE ARTIFACT Earthfile @@ -95,73 +91,38 @@ setup: RUN sudo add-apt-repository ppa:kisak/kisak-mesa RUN sudo apt update && sudo apt upgrade -y -clone-spaceros-artifacts: +spaceros-artifacts: # we must run it in a separate container, so that downstream tasks can be cached if vcs file does not change FROM ubuntu:jammy RUN apt-get update && apt-get install -y git wget # main purpose of this command is to make sure that the git ls-remote results are not cached RUN --no-cache echo "Cloning spaceros repo artifacts" - - ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" - # set default spaceros git ref to current branch in local repo - ARG SPACEROS_GIT_REF=${EARTHLY_GIT_BRANCH} # EARTHLY_GIT_BRANCH is populated by earthly - - # if SPACEROS_GIT_REF branch does not exist, artifacts will be cloned from fallback branch - ARG _FALLBACK_BRANCH = "main" - - ARG _GIT_REF_EXISTS = $([ -z $(git ls-remote ${SPACEROS_REPO_URL} ${SPACEROS_GIT_REF}) ] && echo false || echo true) - ARG _MAIN_SPACEROS_REPO_IS_USED = $([ ${SPACEROS_REPO_URL} = "https://github.com/space-ros/space-ros.git" ] && echo true || echo false) - ARG _GIT_REF_OVERRIDEN_BY_USER = $([ ${SPACEROS_GIT_REF} != ${EARTHLY_GIT_BRANCH} ] && echo true || echo false) - - # If main spaceros repo is used then do it using wget to avoid unneccessary file copies - IF [ ${_MAIN_SPACEROS_REPO_IS_USED} ] && [ ${_GIT_REF_EXISTS} ] - RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${SPACEROS_GIT_REF}/ros2.repos - ELSE IF [ $_MAIN_SPACEROS_REPO_IS_USED ] && [ !$_GIT_REF_EXISTS ] && [ !$_GIT_REF_OVERRIDEN_BY_USER ] - RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${_FALLBACK_BRANCH}/ros2.repos - ELSE IF [ !$_MAIN_SPACEROS_REPO_IS_USED ] && [ $_GIT_REF_EXISTS ] - GIT CLONE --branch ${SPACEROS_GIT_REF} ${SPACEROS_REPO_URL} - ELSE IF [ !$_MAIN_SPACEROS_REPO_IS_USED ] && [ !$_GIT_REF_EXISTS ] && [ !$_GIT_REF_OVERRIDEN_BY_USER ] - GIT CLONE --branch ${_FALLBACK_BRANCH} ${SPACEROS_REPO_URL} - ELSE - RUN exit 1; - END - - - # ARG _ + # current git branch, prefilled by earthly: https://docs.earthly.dev/docs/earthfile/builtin-args + ARG EARTHLY_GIT_BRANCH - # if branch with the same name does not exist in the spaceros repo, clone from main - # ARG _SPACEROS_GIT_REF_SUBSTITUTED="$( - # if - # then - # echo 'main' - # else - # echo '${SPACEROS_GIT_REF}' - # fi - # ) - # " - - # RUN --no-cache echo $_SPACEROS_GIT_REF_SUBSTITUTED - # $( then echo 'main'; else echo)" - - # we run this command primarily to call `git ls-remote` without caching - - # if branch ${SPACEROS_GIT_REF} does not exist in `spaceros` repo, default to main branch + ARG SPACEROS_REPO_URL="https://github.com/space-ros/space-ros.git" + # if current local branch does not exist in target repo then use main. note that branch supplied from CLI overrides this behavior. + ARG SPACEROS_GIT_REF="$( [ -n \"$(git ls-remote $SPACEROS_REPO_URL $EARTHLY_GIT_BRANCH)\" ] && echo $EARTHLY_GIT_BRANCH || echo 'main' )" + # get exact commit hash. this makes sure that build will be re-triggered when new commit is pushed + ARG _GIT_COMMIT_HASH = "$(git ls-remote $SPACEROS_REPO_URL $SPACEROS_GIT_REF | cut -f 1)" + + # this means that branch specified by user from CLI does not exist + IF [ -z ${_GIT_COMMIT_HASH} ] + RUN echo "Specified branch ${SPACEROS_GIT_REF} does not exist" && exit 1 + END - # download latest commit. - IF [ ${SPACEROS_REPO_URL} = "https://github.com/space-ros/space-ros.git" ] - - RUN + IF [ $SPACEROS_REPO_URL = "https://github.com/space-ros/space-ros.git" ] + RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${_GIT_COMMIT_HASH}/ros2.repos ELSE - # otherwise clone whole commit (git clone handles authentication etc) - GIT CLONE --branch ${LATEST_GIT_REF} ${SPACEROS_REPO_URL} . + GIT CLONE --branch ${_GIT_COMMIT_HASH} ${SPACEROS_REPO_URL} . END SAVE ARTIFACT ros2.repos sources: FROM +setup - COPY +clone-spaceros-artifacts/ros2.repos ros2.repos + COPY +spaceros-artifacts/ros2.repos ros2.repos RUN mkdir src RUN vcs import src < ros2.repos From 3790bdc40582d301a20b5eb5292f94060db3717c Mon Sep 17 00:00:00 2001 From: xfiderek Date: Wed, 20 Dec 2023 20:20:44 +0100 Subject: [PATCH 12/19] add clarification to wget --- spaceros/Earthfile | 1 + 1 file changed, 1 insertion(+) diff --git a/spaceros/Earthfile b/spaceros/Earthfile index 6f55344..192078d 100644 --- a/spaceros/Earthfile +++ b/spaceros/Earthfile @@ -114,6 +114,7 @@ spaceros-artifacts: END IF [ $SPACEROS_REPO_URL = "https://github.com/space-ros/space-ros.git" ] + # run wget because main repo's host is known + it is public RUN wget https://raw.githubusercontent.com/space-ros/space-ros/${_GIT_COMMIT_HASH}/ros2.repos ELSE GIT CLONE --branch ${_GIT_COMMIT_HASH} ${SPACEROS_REPO_URL} . From 13056f8339fcd1844dd71a20a025157bb530118f Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 14 Dec 2023 15:37:23 -0500 Subject: [PATCH 13/19] Improve style of shell code blocks in README (#110). This commit styles the READMEs to not include the dollar prompt in code blocks denoting commands to type, to make it easier to copy-and-paste those in a terminal. This also adds bash as the language of the code blocks, so that github styles those correctly. --- moveit2/README.md | 16 ++++----- renode_rcc/README.md | 6 ++-- rtems/README.md | 12 +++---- space_robots/README.md | 74 +++++++++++++++++++++--------------------- spaceros/README.md | 18 +++++----- zynq_rtems/README.md | 20 ++++++++---- 6 files changed, 76 insertions(+), 70 deletions(-) diff --git a/moveit2/README.md b/moveit2/README.md index 24fec06..b690997 100644 --- a/moveit2/README.md +++ b/moveit2/README.md @@ -6,8 +6,8 @@ The MoveIt2 Docker image uses the Space ROS docker image (*openrobotics/spaceros To build the docker image, run: -``` -$ ./build.sh +```bash +./build.sh ``` The build process will take about 30 minutes, depending on the host computer. @@ -16,8 +16,8 @@ The build process will take about 30 minutes, depending on the host computer. After building the image, you can see the newly-built image by running: -``` -$ docker image list +```bash +docker image list ``` The output will look something like this: @@ -33,8 +33,8 @@ The new image is named **openrobotics/moveit2:latest**. There is a run.sh script provided for convenience that will run the spaceros image in a container. -``` -$ ./run.sh +```bash +./run.sh ``` Upon startup, the container automatically runs the entrypoint.sh script, which sources the MoveIt2 and Space ROS environment files. You'll now be running inside the container and should see a prompt similar to this: @@ -47,7 +47,7 @@ spaceros-user@8e73b41a4e16:~/moveit2# Run the following command to launch the MoveIt2 tutorials demo launch file: -``` +```bash ros2 launch moveit2_tutorials demo.launch.py rviz_tutorial:=true ``` @@ -61,7 +61,7 @@ You can now following the [MoveIt2 Tutorial documentation](https://moveit.pickni To run the Move Group C++ Interface Demo, execute the following command: -``` +```bash ros2 launch moveit2_tutorials move_group.launch.py ``` diff --git a/renode_rcc/README.md b/renode_rcc/README.md index 99e46ca..27c2c18 100644 --- a/renode_rcc/README.md +++ b/renode_rcc/README.md @@ -3,15 +3,15 @@ Building [RTEMS Cross Compilation System (RCC)](https://www.gaisler.com/index.ph ## Usage To run the simulator in docker container -``` -$ renode +```bash +renode ``` > If you face GTK protocol error then exit the container, run `xhost + local:` and restart the conatiner to allow other users (including root) run programs in the current session. In the renode window, run -``` +```bash start s @renode-rtems-leon3/leon3_rtems.resc ``` diff --git a/rtems/README.md b/rtems/README.md index 4eba0f4..94c4215 100644 --- a/rtems/README.md +++ b/rtems/README.md @@ -10,16 +10,16 @@ example is an hello world example build using `sparc-rtems5-gcc` tool. tinyxml2 is modified to work with RTEMS build using `sparc-rtems5-gcc` tool.. ## Compile -``` -$ cd /root/tinxyxml2 -$ ./doit +```bash +cd /root/tinxyxml2 +./doit ``` ## Save build artefacts After compiling the binaries for the target, save the binaries and test payload for later use in renode. -``` -$ docker cp containerId:/root/tinyxml2/tinyxml2.o /docker/renode_rcc/build/ +```bash +docker cp containerId:/root/tinyxml2/tinyxml2.o /docker/renode_rcc/build/ -$ docker cp containerId:/root/tinyxml2/xmltest.exe /docker/renode_rcc/build/ +docker cp containerId:/root/tinyxml2/xmltest.exe /docker/renode_rcc/build/ ``` diff --git a/space_robots/README.md b/space_robots/README.md index b994dba..e171cae 100644 --- a/space_robots/README.md +++ b/space_robots/README.md @@ -8,25 +8,25 @@ This is for Curiosity Mars rover and Canadarm demos. The demo image builds on top of the `spaceros` and `moveit2` images. To build the docker image, first build both required images, then the `space_robots` demo image: -``` -$ cd docker/spaceros -$ ./build.sh -$ cd ../moveit2 -$ ./build.sh -$ cd ../space_robots -$ ./build.sh +```bash +cd docker/spaceros +./build.sh +cd ../moveit2 +./build.sh +cd ../space_robots +./build.sh ``` ## Running the Demo Docker run the following to allow GUI passthrough: -``` -$ xhost +local:docker +```bash +xhost +local:docker ``` Then run: -``` -$ ./run.sh +```bash +./run.sh ``` Depending on the host computer, you might need to remove ```--gpus all``` flag in ```run.sh```, which uses your GPUs. @@ -35,8 +35,8 @@ Depending on the host computer, you might need to remove ```--gpus all``` flag i ### Curiosity Mars rover demo Launch the demo: -``` -$ ros2 launch mars_rover mars_rover.launch.py +```bash +ros2 launch mars_rover mars_rover.launch.py ``` On the top left corner, click on the refresh button to show camera feed. @@ -47,72 +47,72 @@ On the top left corner, click on the refresh button to show camera feed. Open a new terminal and attach to the currently running container: -``` -$ docker exec -it bash +```bash +docker exec -it bash ``` Make sure packages are sourced: -``` -$ source ~/spaceros/install/setup.bash +```bash +source ~/spaceros/install/setup.bash ``` -``` -$ source ~/demos_ws/install/setup.bash +```bash +source ~/demos_ws/install/setup.bash ``` #### Available Commands Drive the rover forward -``` -$ ros2 service call /move_forward std_srvs/srv/Empty +```bash +ros2 service call /move_forward std_srvs/srv/Empty ``` Stop the rover -``` -$ ros2 service call /move_stop std_srvs/srv/Empty +```bash +ros2 service call /move_stop std_srvs/srv/Empty ``` Turn left -``` -$ ros2 service call /turn_left std_srvs/srv/Empty +```bash +ros2 service call /turn_left std_srvs/srv/Empty ``` Turn right -``` -$ ros2 service call /turn_right std_srvs/srv/Empty +```bash +ros2 service call /turn_right std_srvs/srv/Empty ``` Open the tool arm: -``` -$ ros2 service call /open_arm std_srvs/srv/Empty +```bash +ros2 service call /open_arm std_srvs/srv/Empty ``` Close the tool arm: -``` -$ ros2 service call /close_arm std_srvs/srv/Empty +```bash +ros2 service call /close_arm std_srvs/srv/Empty ``` Open the mast (camera arm) -``` -$ ros2 service call /mast_open std_srvs/srv/Empty +```bash +ros2 service call /mast_open std_srvs/srv/Empty ``` Close the mast (camera arm) -``` -$ ros2 service call /mast_close std_srvs/srv/Empty +```bash +ros2 service call /mast_close std_srvs/srv/Empty ``` #### Canadarm demo -``` -$ ros2 launch canadarm canadarm.launch.py +```bash +ros2 launch canadarm canadarm.launch.py ``` diff --git a/spaceros/README.md b/spaceros/README.md index 4cae5ab..16420ae 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -9,8 +9,8 @@ The [Earthly](https://earthly.dev/get-earthly) utility is required to build this To build the image, run: -``` -$ ./build.sh +```bash +./build.sh ``` The build process will take about 20 or 30 minutes, depending on the host computer. @@ -25,8 +25,8 @@ earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.g After building the image, you can see the newly-built image by running: -``` -$ docker image list +```bash +docker image list ``` The output will look something like this: @@ -43,8 +43,8 @@ The new image is named **osrf/space-ros:latest**. The `rocker` library is required to run the built image, install it by `sudo apt-get install python3-rocker`. There is a run.sh script provided for convenience that will run the spaceros image in a container. -``` -$ ./run.sh +```bash +./run.sh ``` Upon startup, the container automatically runs the entrypoint.sh script, which sources the Space ROS environment file (setup.bash). You'll now be running inside the container and should see a prompt similar to this: @@ -169,8 +169,8 @@ Sometimes it may be convenient to attach additional terminals to a running Docke With the Space ROS Docker container running, open a second host terminal and then run the following command to determine the container ID: -``` -$ docker container list +```bash +docker container list ``` The output will look something like this: @@ -182,7 +182,7 @@ d10d85c68f0e openrobotics/spaceros "/entrypoint.sh …" 28 minutes ago U The container ID in this case, is *d10d85c68f0e*. So, run the following command in the host terminal: -``` +```bash docker exec -it d10d85c68f0e /bin/bash --init-file "install/setup.bash" ``` diff --git a/zynq_rtems/README.md b/zynq_rtems/README.md index f3dc5dd..de8f878 100644 --- a/zynq_rtems/README.md +++ b/zynq_rtems/README.md @@ -18,7 +18,7 @@ To simplify collecting and compiling dependencies on a wide range of systems, we You will need to install Docker on your system first, for example, using `sudo apt install docker.io` Then, run this [script](https://github.com/space-ros/docker/blob/main/zynq_rtems/build_dependencies.sh): -``` +```bash cd /path/to/zynq_rtems ./build_dependencies.sh ``` @@ -28,7 +28,7 @@ This will typically take at least 10 minutes, and can take much longer if either Next, we will use this "container full of dependencies" to compile a sample application. -``` +```bash cd /path/to/zynq_rtems ./compile_demos.sh ``` @@ -41,7 +41,8 @@ The build products will land in `zynq_rtems/hello_zenoh/build`. The emulated system that will run inside QEMU needs to have a way to talk to a virtual network segment on the host machine. We'll create a TAP device for this. The following script will set this up, creating a virtual `10.0.42.x` subnet for a device named `tap0`: -``` + +```bash ./start_network_tap.sh ``` @@ -51,7 +52,8 @@ We will need three terminals for this demo: * Zenoh-Pico publisher (in RTEMS in QEMU) First, we will start a Zenoh router: -``` + +```bash cd /path/to/zynq_rtems cd hello_zenoh ./run_zenoh_router @@ -59,7 +61,8 @@ cd hello_zenoh This will print a bunch of startup information and then continue running silently, waiting for inbound Zenoh traffic. Leave this terminal running. In the second terminal, we'll run the Zenoh subscriber example: -``` + +```bash cd /path/to/zynq_rtems cd hello_zenoh ./run_zenoh_subscriber @@ -67,7 +70,8 @@ cd hello_zenoh In the third terminal, we will run the RTEMS-based application, which will communicate with the Zenoh router and thence to the Zenoh subscriber. The following script will run QEMU inside the container, with a volume-mount of the `hello_zenoh` demo application so that the build products from the previous step are made available to the QEMU that was built inside the container. -``` + +```bash cd /path/to/zynq_rtems cd hello_zenoh ./run_rtems.sh @@ -75,6 +79,7 @@ cd hello_zenoh The terminal should print a bunch of information about the various emulated Zynq network interfaces and their routing information. After that, it should contact the `zenohd` instance running in the other terminal. It should print something like this: + ``` Opening zenoh session... Zenoh session opened. @@ -127,6 +132,7 @@ This is a good thing. # Clean up If you would like, you can now remove the network tap device that we created in the previous step: -``` + +```bash zynq_rtems/stop_network_tap.sh ``` From 726c3dd7a1cddd740e63a13eec0acb19bc5ec90c Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 11 Jan 2024 04:55:11 -0800 Subject: [PATCH 14/19] Fix style of command name (#114). This commit alters a mention of the `ros2` tool that doesn't use backticks, so it's not correctly formatted. --- spaceros/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spaceros/README.md b/spaceros/README.md index 16420ae..bd953c3 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -53,7 +53,7 @@ Upon startup, the container automatically runs the entrypoint.sh script, which s spaceros-user@d10d85c68f0e:~/spaceros$ ``` -At this point, you can run the 'ros2' command line utility to make sure everything is working OK: +At this point, you can run the `ros2` command line utility to make sure everything is working OK: ``` spaceros-user@d10d85c68f0e:~/spaceros$ ros2 From a4bd229c5cc5d0328dfed249aa4f792e543b4e23 Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Thu, 11 Jan 2024 04:58:02 -0800 Subject: [PATCH 15/19] Fix style of command name, command options (#114). This commit alters a mention of the `colcon` tool and an option for it that don't use backticks, so it's not correctly formatted. --- spaceros/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spaceros/README.md b/spaceros/README.md index bd953c3..55066c5 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -106,7 +106,7 @@ spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --ctest-args -LE "(ikos|xfail The tests include running the static analysis tools clang_tidy and cppcheck (which has the MISRA 2012 add-on enabled). -You can use colcon's --packages-select option to run a subset of packages. For example, to run tests only for the rcpputils package and display the output directly to the console (as well as saving it to a log file), you can run: +You can use colcon's `--packages-select` option to run a subset of packages. For example, to run tests only for the rcpputils package and display the output directly to the console (as well as saving it to a log file), you can run: ``` spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --event-handlers console_direct+ --packages-select rcpputils @@ -221,10 +221,8 @@ To generate a JUnit XML file for a specific package only, you can add the *--pac spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --build-base build_ikos --install-base install_ikos --packages-select rcpputils ``` -The 'colcon test' command runs various tests, including IKOS report generation, which reads the IKOS database generated in the previous analysis step and generates a JUnit XML report file. After running 'colcon test', you can view the JUnit XML files. For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: +The `colcon test` command runs various tests, including IKOS report generation, which reads the IKOS database generated in the previous analysis step and generates a JUnit XML report file. After running `colcon test`, you can view the JUnit XML files. For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: ``` spaceros-user@d10d85c68f0e:~/spaceros$ more build_ikos/rcpputils/test_results/rcpputils/ikos.xunit.xml - ``` - From c954c342641275c1e91933ce76b95b8240438c6b Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 11 Jan 2024 05:04:07 -0800 Subject: [PATCH 16/19] Fix typos in READMEs (#111). Fix two typos (wrong word, missing article). --- moveit2/README.md | 2 +- space_robots/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/moveit2/README.md b/moveit2/README.md index b690997..3e366be 100644 --- a/moveit2/README.md +++ b/moveit2/README.md @@ -55,7 +55,7 @@ You should see lots of console output and the rviz2 window appear: ![rviz2 tutorial window](resources/moveit2-rviz-tutorial.png) -You can now following the [MoveIt2 Tutorial documentation](https://moveit.picknik.ai/main/doc/tutorials/quickstart_in_rviz/quickstart_in_rviz_tutorial.html). +You can now follow the [MoveIt2 Tutorial documentation](https://moveit.picknik.ai/main/doc/tutorials/quickstart_in_rviz/quickstart_in_rviz_tutorial.html). ## Running the MoveIt2 Move Group C++ Interface Demo diff --git a/space_robots/README.md b/space_robots/README.md index e171cae..ccf7ce6 100644 --- a/space_robots/README.md +++ b/space_robots/README.md @@ -29,7 +29,7 @@ Then run: ./run.sh ``` -Depending on the host computer, you might need to remove ```--gpus all``` flag in ```run.sh```, which uses your GPUs. +Depending on the host computer, you might need to remove the ```--gpus all``` flag in ```run.sh```, which uses your GPUs. ## Running the Demos From 211d91e62395d854dcbb32f5cede93eba2291673 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Thu, 11 Jan 2024 05:09:23 -0800 Subject: [PATCH 17/19] Place sentences in separate lines in READMEs (#113). Having long sentences in READMEs makes them harder to change, and also makes processing the diffs harder (among other disadvantages). This commit implements the one-sentence-per-line principle, by placing different sentences in separate lines in the README. --- moveit2/README.md | 6 ++++-- space_robots/README.md | 7 +++++-- spaceros/README.md | 8 +++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/moveit2/README.md b/moveit2/README.md index 3e366be..665d620 100644 --- a/moveit2/README.md +++ b/moveit2/README.md @@ -1,6 +1,7 @@ # MoveIt2 Docker Image -The MoveIt2 Docker image uses the Space ROS docker image (*openrobotics/spaceros:latest*) as its base image. The MoveIt2 Dockerfile installs all of the prerequisite system dependencies to build MoveIt2 (and Moveit2 tutorials) and then pulls and builds the latest MoveIt2 and Moveit2 tutorials source code. +The MoveIt2 Docker image uses the Space ROS docker image (*openrobotics/spaceros:latest*) as its base image. +The MoveIt2 Dockerfile installs all of the prerequisite system dependencies to build MoveIt2 (and Moveit2 tutorials) and then pulls and builds the latest MoveIt2 and Moveit2 tutorials source code. ## Building the MoveIt2 Image @@ -37,7 +38,8 @@ There is a run.sh script provided for convenience that will run the spaceros ima ./run.sh ``` -Upon startup, the container automatically runs the entrypoint.sh script, which sources the MoveIt2 and Space ROS environment files. You'll now be running inside the container and should see a prompt similar to this: +Upon startup, the container automatically runs the entrypoint.sh script, which sources the MoveIt2 and Space ROS environment files. +You'll now be running inside the container and should see a prompt similar to this: ``` spaceros-user@8e73b41a4e16:~/moveit2# diff --git a/space_robots/README.md b/space_robots/README.md index ccf7ce6..2928caa 100644 --- a/space_robots/README.md +++ b/space_robots/README.md @@ -1,12 +1,15 @@ # Space ROS Space Robots Demo Docker Image -The Space ROS Space Robots Demo docker image uses the moveit2 docker image (*openrobotics/moveit2:latest*) as its base image. Build instructions for that image can be found at [docker/moveit2/README.md](https://github.com/space-ros/docker/blob/main/moveit2/README.md). The Dockerfile installs all of the prerequisite system dependencies along with the demos source code, then builds the Space ROS Space Robots Demo. +The Space ROS Space Robots Demo docker image uses the moveit2 docker image (*openrobotics/moveit2:latest*) as its base image. +Build instructions for that image can be found in [this README](../moveit2/README.md). +The Dockerfile installs all of the prerequisite system dependencies along with the demos source code, then builds the Space ROS Space Robots Demo. This is for Curiosity Mars rover and Canadarm demos. ## Building the Demo Docker -The demo image builds on top of the `spaceros` and `moveit2` images. To build the docker image, first build both required images, then the `space_robots` demo image: +The demo image builds on top of the `spaceros` and `moveit2` images. +To build the docker image, first build both required images, then the `space_robots` demo image: ```bash cd docker/spaceros diff --git a/spaceros/README.md b/spaceros/README.md index 55066c5..52bfb85 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -19,7 +19,7 @@ The build process defaults to cloning the `ros2.repos` file from [spaceros](http Example: ```bash earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.git" --SPACEROS_GIT_REF="my-branch-name" -``` +``` ## Running the Space ROS Docker Image in a Container @@ -47,7 +47,8 @@ There is a run.sh script provided for convenience that will run the spaceros ima ./run.sh ``` -Upon startup, the container automatically runs the entrypoint.sh script, which sources the Space ROS environment file (setup.bash). You'll now be running inside the container and should see a prompt similar to this: +Upon startup, the container automatically runs the entrypoint.sh script, which sources the Space ROS environment file (setup.bash). +You'll now be running inside the container and should see a prompt similar to this: ``` spaceros-user@d10d85c68f0e:~/spaceros$ @@ -221,7 +222,8 @@ To generate a JUnit XML file for a specific package only, you can add the *--pac spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --build-base build_ikos --install-base install_ikos --packages-select rcpputils ``` -The `colcon test` command runs various tests, including IKOS report generation, which reads the IKOS database generated in the previous analysis step and generates a JUnit XML report file. After running `colcon test`, you can view the JUnit XML files. For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: +The `colcon test` command runs various tests, including IKOS report generation, which reads the IKOS database generated in the previous analysis step and generates a JUnit XML report file. +After running `colcon test`, you can view the JUnit XML files. For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: ``` spaceros-user@d10d85c68f0e:~/spaceros$ more build_ikos/rcpputils/test_results/rcpputils/ikos.xunit.xml From 7764129684f7509769bb6068a9db50280fb16c2f Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Thu, 11 Jan 2024 05:13:11 -0800 Subject: [PATCH 18/19] Place sentences in separate lines in READMEs (#113). Having long sentences in READMEs makes them harder to change, and also makes processing the diffs harder (among other disadvantages). This commit implements the one-sentence-per-line principle, by placing different sentences in separate lines in the README. --- renode_rcc/README.md | 3 ++- spaceros/README.md | 16 +++++++++++----- zynq_rtems/README.md | 9 ++++++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/renode_rcc/README.md b/renode_rcc/README.md index 27c2c18..6137aaf 100644 --- a/renode_rcc/README.md +++ b/renode_rcc/README.md @@ -1,5 +1,6 @@ # renode-RCC -Building [RTEMS Cross Compilation System (RCC)](https://www.gaisler.com/index.php/products/operating-systems/rtems), has a different directory structure compare to building RTEMS from source (might not be true). This will run RTEMS on leon3 in a renode simulation. +Building [RTEMS Cross Compilation System (RCC)](https://www.gaisler.com/index.php/products/operating-systems/rtems), has a different directory structure compare to building RTEMS from source (might not be true). +This will run RTEMS on leon3 in a renode simulation. ## Usage To run the simulator in docker container diff --git a/spaceros/README.md b/spaceros/README.md index 52bfb85..ad84631 100644 --- a/spaceros/README.md +++ b/spaceros/README.md @@ -15,7 +15,9 @@ To build the image, run: The build process will take about 20 or 30 minutes, depending on the host computer. -The build process defaults to cloning the `ros2.repos` file from [spaceros](https://github.com/space-ros/space-ros) repository. It looks for a branch with the same name as the current local branch; if it doesn't find one, it falls back to cloning from the main branch. For testing purposes, you can customize both the spaceros repository URL and the branch name by modifying arguments defined in the [Earthfile](./Earthfile). +The build process defaults to cloning the `ros2.repos` file from [spaceros](https://github.com/space-ros/space-ros) repository. +It looks for a branch with the same name as the current local branch; if it doesn't find one, it falls back to cloning from the main branch. +For testing purposes, you can customize both the spaceros repository URL and the branch name by modifying arguments defined in the [Earthfile](./Earthfile). Example: ```bash earthly +image --SPACEROS_REPO_URL="https://github.com/my-org/my-spaceros-fork.git" --SPACEROS_GIT_REF="my-branch-name" @@ -107,7 +109,8 @@ spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --ctest-args -LE "(ikos|xfail The tests include running the static analysis tools clang_tidy and cppcheck (which has the MISRA 2012 add-on enabled). -You can use colcon's `--packages-select` option to run a subset of packages. For example, to run tests only for the rcpputils package and display the output directly to the console (as well as saving it to a log file), you can run: +You can use colcon's `--packages-select` option to run a subset of packages. +For example, to run tests only for the rcpputils package and display the output directly to the console (as well as saving it to a log file), you can run: ``` spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --event-handlers console_direct+ --packages-select rcpputils @@ -115,7 +118,8 @@ spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --event-handlers console_dire ## Viewing Test Output - The output from the tests are stored in XUnit XML files, named *\*.xunit.xml. After running the unit tests, you can scan the build directory for the various *\*.xunit.xml* files. + The output from the tests are stored in XUnit XML files, named *\*.xunit.xml. +After running the unit tests, you can scan the build directory for the various *\*.xunit.xml* files. For example, a clang_tidy.xunit.xml file looks like this: @@ -181,7 +185,8 @@ CONTAINER ID IMAGE COMMAND CREATED d10d85c68f0e openrobotics/spaceros "/entrypoint.sh …" 28 minutes ago Up 28 minutes inspiring_moser ``` -The container ID in this case, is *d10d85c68f0e*. So, run the following command in the host terminal: +The container ID in this case, is *d10d85c68f0e*. +So, run the following command in the host terminal: ```bash docker exec -it d10d85c68f0e /bin/bash --init-file "install/setup.bash" @@ -223,7 +228,8 @@ spaceros-user@d10d85c68f0e:~/spaceros$ colcon test --build-base build_ikos --ins ``` The `colcon test` command runs various tests, including IKOS report generation, which reads the IKOS database generated in the previous analysis step and generates a JUnit XML report file. -After running `colcon test`, you can view the JUnit XML files. For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: +After running `colcon test`, you can view the JUnit XML files. +For example, to view the JUnit XML file for IKOS scan of the rcpputils binaries you can use the following command: ``` spaceros-user@d10d85c68f0e:~/spaceros$ more build_ikos/rcpputils/test_results/rcpputils/ikos.xunit.xml diff --git a/zynq_rtems/README.md b/zynq_rtems/README.md index de8f878..89ed0d9 100644 --- a/zynq_rtems/README.md +++ b/zynq_rtems/README.md @@ -4,7 +4,8 @@ The goal is to create an hard real-time embedded application that runs on a Xilinx Zynq SoC FPGA which will communicate with Space-ROS. -This demonstration will be on [QEMU](https://www.qemu.org), the open-source CPU and system emulator. This is for several reasons: +This demonstration will be on [QEMU](https://www.qemu.org), the open-source CPU and system emulator. +This is for several reasons: * Development cycles in QEMU are much faster and less painful than hardware. * Given the state of the semiconductor industry at time of writing (late 2022), it is nearly impossible to obtain Zynq development boards. * QEMU-based work requires no upfront hardware costs or purchasing delays @@ -58,7 +59,8 @@ cd /path/to/zynq_rtems cd hello_zenoh ./run_zenoh_router ``` -This will print a bunch of startup information and then continue running silently, waiting for inbound Zenoh traffic. Leave this terminal running. +This will print a bunch of startup information and then continue running silently, waiting for inbound Zenoh traffic. +Leave this terminal running. In the second terminal, we'll run the Zenoh subscriber example: @@ -78,7 +80,8 @@ cd hello_zenoh ``` The terminal should print a bunch of information about the various emulated Zynq network interfaces and their routing information. -After that, it should contact the `zenohd` instance running in the other terminal. It should print something like this: +After that, it should contact the `zenohd` instance running in the other terminal. +It should print something like this: ``` Opening zenoh session... From b307544c8ab5a15d4c4d5776b599839d70424240 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Thu, 28 Dec 2023 11:05:02 -0700 Subject: [PATCH 19/19] Use Docker cache mounts for Apt lists (#81) --- moveit2/Dockerfile | 26 ++++++++++++++++++++------ renode_rcc/Dockerfile | 10 ++++++++-- rtems/Dockerfile | 6 +++++- space_robots/Dockerfile | 18 ++++++++++++++---- zynq_rtems/Dockerfile | 6 +++++- 5 files changed, 52 insertions(+), 14 deletions(-) diff --git a/moveit2/Dockerfile b/moveit2/Dockerfile index 1aa98ae..301cf32 100644 --- a/moveit2/Dockerfile +++ b/moveit2/Dockerfile @@ -46,12 +46,20 @@ RUN mkdir ${SPACEROS_DIR}/src \ ENV MOVEIT2_DIR=${HOME_DIR}/moveit2 # Make sure the latest versions of packages are installed -RUN sudo apt-get update -RUN sudo apt-get dist-upgrade -y +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get dist-upgrade -y RUN rosdep update # Install the various build and test tools -RUN sudo apt install -y \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt install -y \ build-essential \ clang-format \ cmake \ @@ -92,7 +100,9 @@ RUN cd ${MOVEIT2_DIR}/src \ RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR} # Get rosinstall_generator -RUN sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator # Generate repos file for moveit2 dependencies, excluding packages from Space ROS core. COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/ @@ -116,7 +126,9 @@ RUN vcs import src < /tmp/moveit2_tutorials.repos RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR} # Install system dependencies -RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \ && rosdep install --from-paths ../spaceros/src src --ignore-src --rosdistro ${ROSDISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" # Apply a patch to octomap_msgs to work around a build issue @@ -128,7 +140,9 @@ RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-' # Add a couple sample GUI apps for testing -RUN sudo apt-get install -y \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get install -y \ firefox \ glmark2 \ libcanberra-gtk3-0 \ diff --git a/renode_rcc/Dockerfile b/renode_rcc/Dockerfile index 91a3429..41b2f59 100644 --- a/renode_rcc/Dockerfile +++ b/renode_rcc/Dockerfile @@ -2,7 +2,11 @@ FROM ubuntu:20.04 WORKDIR /root ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update -y && \ +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update -y && \ apt-get install -y automake \ autoconf \ ca-certificates \ @@ -18,7 +22,9 @@ RUN apt-get update -y && \ ARG RENODE_VERSION=1.13.0 USER root -RUN wget https://github.com/renode/renode/releases/download/v${RENODE_VERSION}/renode_${RENODE_VERSION}_amd64.deb && \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + wget https://github.com/renode/renode/releases/download/v${RENODE_VERSION}/renode_${RENODE_VERSION}_amd64.deb && \ apt-get update && \ apt-get install -y --no-install-recommends ./renode_${RENODE_VERSION}_amd64.deb python3-dev && \ rm ./renode_${RENODE_VERSION}_amd64.deb diff --git a/rtems/Dockerfile b/rtems/Dockerfile index 740631c..a1a394e 100644 --- a/rtems/Dockerfile +++ b/rtems/Dockerfile @@ -2,7 +2,11 @@ FROM ubuntu:20.04 WORKDIR /root ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update \ +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update \ && apt-get install -y \ apt-utils \ bison \ diff --git a/space_robots/Dockerfile b/space_robots/Dockerfile index 84a94d7..561802c 100644 --- a/space_robots/Dockerfile +++ b/space_robots/Dockerfile @@ -44,7 +44,11 @@ ENV GZ_VERSION fortress ARG DEBIAN_FRONTEND=noninteractive # Get rosinstall_generator -RUN sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator # TODO(anyone): remove demo-pkgs.txt, no packages left after exclusions # Generate repos file for demo dependencies, excluding packages from Space ROS core. @@ -64,10 +68,14 @@ WORKDIR ${DEMO_DIR} # Install libmongoc for development -RUN sudo apt install libmongoc-dev -y +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get install libmongoc-dev -y # Compile mongo cxx driver https://mongocxx.org/mongocxx-v3/installation/linux/ -RUN sudo apt install libssl-dev build-essential devscripts debian-keyring fakeroot debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get install libssl-dev build-essential devscripts debian-keyring fakeroot debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz RUN tar -xzf mongo-cxx-driver-r3.6.7.tar.gz RUN cd mongo-cxx-driver-r3.6.7/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local && sudo cmake --build . --target EP_mnmlstc_core && cmake --build . && sudo cmake --build . --target install @@ -77,7 +85,9 @@ RUN cd mongo-cxx-driver-r3.6.7/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCM COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/ RUN vcs import src < /tmp/demo_manual_pkgs.repos && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' -RUN sudo apt-get update -y \ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update -y \ && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \ && /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \ && rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO} diff --git a/zynq_rtems/Dockerfile b/zynq_rtems/Dockerfile index 7767e99..fb625ab 100644 --- a/zynq_rtems/Dockerfile +++ b/zynq_rtems/Dockerfile @@ -2,7 +2,11 @@ FROM ubuntu:20.04 WORKDIR /root ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update \ +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + apt-get update \ && apt-get install -y \ apt-utils \ bison \