Skip to content

Commit

Permalink
Merge pull request #161 from youtalk/upstream-to-main
Browse files Browse the repository at this point in the history
feat: upstream to main
  • Loading branch information
youtalk authored Jan 22, 2025
2 parents d80e8b0 + 2a7948a commit 7c0b3b4
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions autoware.repos
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
73 changes: 68 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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"]
Expand Down
5 changes: 5 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down Expand Up @@ -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.
Expand Down
30 changes: 26 additions & 4 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'."
}
Expand All @@ -36,6 +37,10 @@ parse_arguments() {
--devel-only)
option_devel_only=true
;;
--target)
option_target="$2"
shift
;;
*)
echo "Unknown option: $1"
print_help
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ group "default" {
"universe-planning-control",
"universe-vehicle-system-devel",
"universe-vehicle-system",
"universe-visualization-devel",
"universe-visualization",
"universe-devel",
"universe"
]
Expand All @@ -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" {}

Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions docker/scripts/build_and_clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

function build_and_clean() {
local ccache_dir=$1
Expand Down
1 change: 1 addition & 0 deletions docker/scripts/cleanup_apt.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

function cleanup_apt() {
local apt_clean=$1
Expand Down
1 change: 1 addition & 0 deletions docker/scripts/cleanup_system.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

function cleanup_system() {
local lib_dir=$1
Expand Down
5 changes: 4 additions & 1 deletion docker/scripts/resolve_rosdep_keys.sh
Original file line number Diff line number Diff line change
@@ -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' |
Expand Down

0 comments on commit 7c0b3b4

Please sign in to comment.