diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48a97c13ef..9d7c0531a4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,7 +74,7 @@ repos: args: [--line-length=100] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v19.1.5 + rev: v19.1.6 hooks: - id: clang-format types_or: [c++, c, cuda] diff --git a/autoware.repos b/autoware.repos index e8ada00d82..770bb5bbb9 100644 --- a/autoware.repos +++ b/autoware.repos @@ -12,7 +12,7 @@ repositories: core/autoware_internal_msgs: type: git url: https://github.com/autowarefoundation/autoware_internal_msgs.git - version: 1.3.0 + version: 1.4.0 core/autoware_cmake: type: git url: https://github.com/autowarefoundation/autoware_cmake.git @@ -37,7 +37,7 @@ repositories: universe/external/tier4_ad_api_adaptor: # TODO(TIER IV): Migrate to AD API and remove this repository entry. type: git url: https://github.com/tier4/tier4_ad_api_adaptor.git - version: tier4/universe + version: v0.40.0 universe/external/tier4_autoware_msgs: type: git url: https://github.com/tier4/tier4_autoware_msgs.git @@ -103,7 +103,7 @@ repositories: sensor_kit/sample_sensor_kit_launch: type: git url: https://github.com/autowarefoundation/sample_sensor_kit_launch.git - version: 0.39.0 + version: 0.40.0 sensor_kit/external/awsim_sensor_kit_launch: # TODO: Integrate into sample_sensor_kit_launch type: git url: https://github.com/tier4/awsim_sensor_kit_launch.git diff --git a/docker/Dockerfile b/docker/Dockerfile index 8857e43bc9..b4b56698a9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,18 @@ RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-common-depend-packages.txt \ && cat /rosdep-universe-common-depend-packages.txt +FROM rosdep-depend AS rosdep-universe-visualization-depend +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO + +COPY src/universe/autoware.universe/visualization /autoware/src/universe/autoware.universe/visualization +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ + > /rosdep-universe-visualization-depend-packages.txt \ + && cat /rosdep-universe-visualization-depend-packages.txt +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ + > /rosdep-universe-visualization-exec-depend-packages.txt \ + && cat /rosdep-universe-visualization-exec-depend-packages.txt + FROM rosdep-depend AS rosdep-universe-sensing-perception-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -44,7 +56,7 @@ COPY src/universe/autoware.universe/sensing /autoware/src/universe/autoware.univ RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-sensing-perception-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-depend-packages.txt -RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ > /rosdep-universe-sensing-perception-exec-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-exec-depend-packages.txt @@ -57,7 +69,7 @@ COPY src/universe/autoware.universe/map /autoware/src/universe/autoware.universe RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-localization-mapping-depend-packages.txt \ && cat /rosdep-universe-localization-mapping-depend-packages.txt -RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ > /rosdep-universe-localization-mapping-exec-depend-packages.txt \ && cat /rosdep-universe-localization-mapping-exec-depend-packages.txt @@ -75,7 +87,7 @@ COPY src/universe/autoware.universe/sensing/autoware_pointcloud_preprocessor /au RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-planning-control-depend-packages.txt \ && cat /rosdep-universe-planning-control-depend-packages.txt -RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ > /rosdep-universe-planning-control-exec-depend-packages.txt \ && cat /rosdep-universe-planning-control-exec-depend-packages.txt @@ -90,7 +102,7 @@ COPY src/universe/autoware.universe/localization/autoware_pose2twist /autoware/s RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-vehicle-system-depend-packages.txt \ && cat /rosdep-universe-vehicle-system-depend-packages.txt -RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ > /rosdep-universe-vehicle-system-exec-depend-packages.txt \ && cat /rosdep-universe-vehicle-system-exec-depend-packages.txt @@ -108,7 +120,7 @@ RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-depend-packages.txt \ && cat /rosdep-universe-depend-packages.txt -RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} --dependency-types=exec \ > /rosdep-exec-depend-packages.txt \ && cat /rosdep-exec-depend-packages.txt @@ -314,6 +326,30 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-common-devel AS universe-visualization-devel +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Install rosdep dependencies +COPY --from=rosdep-universe-visualization-depend /rosdep-universe-visualization-depend-packages.txt /tmp/rosdep-universe-visualization-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + apt-get update \ + && cat /tmp/rosdep-universe-visualization-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && /autoware/cleanup_apt.sh + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/visualization,target=/autoware/src/universe/autoware.universe/visualization \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -332,6 +368,7 @@ COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware COPY --from=universe-planning-control-devel /opt/autoware /opt/autoware COPY --from=universe-vehicle-system-devel /opt/autoware /opt/autoware +COPY --from=universe-visualization-devel /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ @@ -494,6 +531,32 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +# hadolint ignore=DL3006 +FROM $AUTOWARE_BASE_IMAGE AS universe-visualization +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up runtime environment +COPY --from=rosdep-universe-visualization-depend /rosdep-universe-visualization-exec-depend-packages.txt /tmp/rosdep-universe-visualization-exec-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get update \ + && cat /tmp/rosdep-universe-visualization-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO + +COPY --from=universe-visualization-devel /opt/autoware /opt/autoware + +# Copy bash aliases +COPY docker/etc/.bash_aliases /root/.bash_aliases +RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + # hadolint ignore=DL3006 FROM $AUTOWARE_BASE_IMAGE AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/docker/README.md b/docker/README.md index 7128e578a3..c5bdf3a7fc 100644 --- a/docker/README.md +++ b/docker/README.md @@ -135,6 +135,10 @@ This stage is an Autoware Universe Sensing/Perception runtime container. It only This stage installs the CUDA runtime environment and copies the binaries built in the `universe-sensing-perception-devel-cuda` stage. +### `universe-visualization` + +This stage is a Autoware Universe Visualization runtime container. It only includes the dependencies given by `/rosdep-universe-visualization-exec-depend-packages.txt` and the binaries built in the `universe-visualization-devel` stage. + ### `universe-localization-mapping-devel` This stage installs the dependency packages based on `/rosdep-universe-localization-mapping-depend-packages.txt` and builds the packages under the following directories of `autoware.repos`: @@ -187,6 +191,7 @@ Then it builds the remaining packages of `autoware.repos`: - `universe/autoware.universe/launch` - `universe/autoware.universe/simulator` - `universe/autoware.universe/tools` +- `universe/autoware.universe/visualization` - `vehicle` This stage provides an all-in-one development container to Autoware developers. By running the host's source code with volume mounting, it allows for easy building and debugging of Autoware. diff --git a/docker/build.sh b/docker/build.sh index d0d8b8976e..4d23941763 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -11,6 +11,7 @@ print_help() { echo " --no-cuda Disable CUDA support" echo " --platform Specify the platform (default: current platform)" echo " --devel-only Build devel image only" + echo " --target Specify the target image (default: universe or universe-devel if --devel-only is set)" echo "" echo "Note: The --platform option should be one of 'linux/amd64' or 'linux/arm64'." } @@ -36,6 +37,10 @@ parse_arguments() { --devel-only) option_devel_only=true ;; + --target) + option_target="$2" + shift + ;; *) echo "Unknown option: $1" print_help @@ -58,10 +63,15 @@ set_cuda_options() { # Set build options set_build_options() { - if [ "$option_devel_only" = "true" ]; then - target="universe-devel" + if [ -n "$option_target" ]; then + target="$option_target" + image_name_suffix="" else - target="universe" + if [ "$option_devel_only" = "true" ]; then + target="universe-devel" + else + target="universe" + fi fi } @@ -144,9 +154,21 @@ build_images() { --set "*.args.AUTOWARE_BASE_CUDA_IMAGE=$autoware_base_cuda_image" \ --set "*.args.SETUP_ARGS=$setup_args" \ --set "*.args.LIB_DIR=$lib_dir" \ + --set "universe-sensing-perception-devel.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel" \ + --set "universe-sensing-perception.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception" \ + --set "universe-localization-mapping-devel.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping-devel" \ + --set "universe-localization-mapping.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping" \ + --set "universe-planning-control-devel.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control-devel" \ + --set "universe-planning-control.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control" \ + --set "universe-vehicle-system-devel.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system-devel" \ + --set "universe-vehicle-system.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system" \ + --set "universe-visualization-devel.tags=ghcr.io/autowarefoundation/autoware:universe-visualization-devel" \ + --set "universe-visualization.tags=ghcr.io/autowarefoundation/autoware:universe-visualization" \ --set "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel" \ - --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ --set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \ + --set "universe-sensing-perception-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel-cuda" \ + --set "universe-sensing-perception-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-cuda" \ + --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ "$target$image_name_suffix" set +x diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index dcf79ffc11..600b47108b 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -9,6 +9,8 @@ group "default" { "universe-planning-control", "universe-vehicle-system-devel", "universe-vehicle-system", + "universe-visualization-devel", + "universe-visualization", "universe-devel", "universe" ] @@ -24,6 +26,8 @@ target "docker-metadata-action-universe-planning-control-devel" {} target "docker-metadata-action-universe-planning-control" {} target "docker-metadata-action-universe-vehicle-system-devel" {} target "docker-metadata-action-universe-vehicle-system" {} +target "docker-metadata-action-universe-visualization-devel" {} +target "docker-metadata-action-universe-visualization" {} target "docker-metadata-action-universe-devel" {} target "docker-metadata-action-universe" {} @@ -81,6 +85,18 @@ target "universe-vehicle-system" { target = "universe-vehicle-system" } +target "universe-visualization-devel" { + inherits = ["docker-metadata-action-universe-visualization-devel"] + dockerfile = "docker/Dockerfile" + target = "universe-visualization-devel" +} + +target "universe-visualization" { + inherits = ["docker-metadata-action-universe-visualization"] + dockerfile = "docker/Dockerfile" + target = "universe-visualization" +} + target "universe-devel" { inherits = ["docker-metadata-action-universe-devel"] dockerfile = "docker/Dockerfile" diff --git a/docker/scripts/build_and_clean.sh b/docker/scripts/build_and_clean.sh index e9d5ec6168..f5f383f156 100755 --- a/docker/scripts/build_and_clean.sh +++ b/docker/scripts/build_and_clean.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e function build_and_clean() { local ccache_dir=$1 diff --git a/docker/scripts/cleanup_apt.sh b/docker/scripts/cleanup_apt.sh index ad03c1f39e..f3a47e5829 100755 --- a/docker/scripts/cleanup_apt.sh +++ b/docker/scripts/cleanup_apt.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e function cleanup_apt() { local apt_clean=$1 diff --git a/docker/scripts/cleanup_system.sh b/docker/scripts/cleanup_system.sh index 0833be2b3a..72127927ec 100755 --- a/docker/scripts/cleanup_system.sh +++ b/docker/scripts/cleanup_system.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e function cleanup_system() { local lib_dir=$1 diff --git a/docker/scripts/resolve_rosdep_keys.sh b/docker/scripts/resolve_rosdep_keys.sh index 1615e9f68f..1b3f5839bd 100755 --- a/docker/scripts/resolve_rosdep_keys.sh +++ b/docker/scripts/resolve_rosdep_keys.sh @@ -1,10 +1,13 @@ #!/bin/bash +set -e function resolve_rosdep_keys() { local src_path=$1 local ros_distro=$2 + local rosdep_keys_args=$3 - rosdep keys --ignore-src --from-paths "$src_path" | + # shellcheck disable=SC2086 + rosdep keys $rosdep_keys_args --ignore-src --from-paths "$src_path" | xargs rosdep resolve --rosdistro "$ros_distro" | grep -v '^#' | sed 's/ \+/\n/g' |