works for arm64 for now.

This commit is contained in:
Björn Ellensohn 2023-07-28 10:07:09 +02:00
parent e2ed2bdd28
commit a72b6186be
9 changed files with 129 additions and 31 deletions

18
dependencies.amd64.repos Normal file
View File

@ -0,0 +1,18 @@
repositories:
# CPS RMP lite 220 Dependencies
segwayrmp:
type: git
url: https://github.com/bjoernellens1/segwayrmp
version: x86
segway_msgs:
type: git
url: https://github.com/bjoernellens1/segway_msgs
version: main
RPlidar_ROS2:
type: git
url: https://github.com/bjoernellens1/sllidar_ros2
version: main

18
dependencies.arm64.repos Normal file
View File

@ -0,0 +1,18 @@
repositories:
# CPS RMP lite 220 Dependencies
segwayrmp:
type: git
url: https://github.com/bjoernellens1/segwayrmp
version: humble-arm64
segway_msgs:
type: git
url: https://github.com/bjoernellens1/segway_msgs
version: main
RPlidar_ROS2:
type: git
url: https://github.com/bjoernellens1/sllidar_ros2
version: main

View File

@ -1,13 +0,0 @@
repositories:
# CPS Bot Mini Dependencies
odrive_ros2_control:
type: git
url: https://github.com/bjoernellens1/odrive_ros2_control.git
version: humble-fw-v0.5.1
Lslidar_ROS2:
type: git
url: https://github.com/bjoernellens1/Lslidar_ROS2_driver
version: N10_V1.0

View File

@ -5,10 +5,14 @@ services:
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:base
build:
context: .
dockerfile: docker/Dockerfile.arm64
dockerfile: docker/Dockerfile
args:
ROS_DISTRO: humble
target: base
x-bake:
platforms:
- linux/arm64
# - linux/amd64
# Interactive shell
stdin_open: true
tty: true
@ -27,16 +31,18 @@ services:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
# Overlay image containing the example source code.
# Overlay image containing the project specific source code.
overlay:
extends: base
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:overlay
platform: linux/arm64
build:
context: .
dockerfile: docker/Dockerfile.arm64
dockerfile: docker/Dockerfile
target: overlay
x-bake:
platforms:
- linux/arm64
# - linux/amd64
# Robot State Publisher
robot_state_publisher:

78
docker/Dockerfile Normal file
View File

@ -0,0 +1,78 @@
ARG ROS_DISTRO=humble
ARG UNDERLAY_WS=/rmp_ws
ARG TARGETPLATFORM
# This file should work for both amd64 and arm64 builds. Because segway did not release some source code we must copy some binaries for the specific architectures.
# That is why we must use some conditional statements to copy over the correct files during build process.
# Variable TARGETPLATFORM should be auomatically created during build process by docker.
########################################
# Base Image for Bot Mini Control #
########################################
FROM ros:${ROS_DISTRO} as base
ENV ROS_DISTRO=${ROS_DISTRO}
SHELL ["/bin/bash", "-c"]
# Create Colcon workspace with external dependencies
RUN mkdir -p /rmp_ws/src
WORKDIR /rmp_ws/src
COPY dependencies.arm64.repos .
COPY dependencies.amd64.repos .
# Choose correct sources for architecture:
# Copy platform-specific files
# Use if condition to copy different files for different platforms
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
echo "Copying files for linux/amd64"; \
mv dependencies.amd64.repos dependencies.repos; \
else \
echo "Copying files for linux/arm64"; \
mv dependencies.arm64.repos dependencies.repos; \
fi
RUN vcs import < dependencies.repos
# Build the base Colcon workspace, installing dependencies first.
WORKDIR /rmp_ws
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
&& apt-get update -y \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
&& colcon build --symlink-install
# Use Cyclone DDS as middleware
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ENV UNDERLAY_WS=${UNDERLAY_WS}
###########################################
# Overlay Image for Bot Mini Control #
###########################################
FROM base AS overlay
# Create an overlay Colcon workspace
RUN mkdir -p /overlay_ws/src
WORKDIR /overlay_ws/src
COPY overlay.repos .
RUN vcs import < overlay.repos
WORKDIR /overlay_ws
# COPY ./tb3_autonomy/ ./src/tb3_autonomy/
# COPY ./tb3_worlds/ ./src/tb3_worlds/
RUN source /rmp_ws/install/setup.bash \
&& colcon build --symlink-install \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y
# Set up the entrypoint
COPY ./docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY ./controller_startup.sh /
RUN chmod +x /controller_startup.sh
COPY ./localization_startup.sh /
RUN chmod +x /localization_startup.sh
ENTRYPOINT [ "/entrypoint.sh" ]

View File

@ -12,7 +12,7 @@ SHELL ["/bin/bash", "-c"]
RUN mkdir -p /rmp_ws/src
WORKDIR /rmp_ws/src
COPY dependencies.repos .
RUN vcs import < dependencies.repos
RUN vcs import < dependencies.amd64.repos
# Build the base Colcon workspace, installing dependencies first.
WORKDIR /rmp_ws

View File

@ -4,7 +4,8 @@ ARG UNDERLAY_WS=/rmp_ws
########################################
# Base Image for Bot Mini Control #
########################################
FROM --platform=linux/arm64 ros:${ROS_DISTRO} as base
#FROM --platform=linux/arm64 ros:${ROS_DISTRO} as base
FROM ros:${ROS_DISTRO} as base
ENV ROS_DISTRO=${ROS_DISTRO}
SHELL ["/bin/bash", "-c"]
@ -12,7 +13,7 @@ SHELL ["/bin/bash", "-c"]
RUN mkdir -p /rmp_ws/src
WORKDIR /rmp_ws/src
COPY dependencies.repos .
RUN vcs import < dependencies.repos
RUN vcs import < dependencies.arm64.repos
# Build the base Colcon workspace, installing dependencies first.
WORKDIR /rmp_ws

View File

@ -14,13 +14,3 @@ repositories:
type: git
url: https://github.com/bjoernellens1/ros2_cam_openCV.git
version: main
segwayrmp:
type: git
url: https://github.com/bjoernellens1/segwayrmp.git
version: humble-arm64
segway_msgs:
type: git
url: https://github.com/bjoernellens1/segway_msgs.git
version: main