This commit is contained in:
Björn Ellensohn 2023-09-05 08:52:37 +02:00
parent 93e9cf8edc
commit 47d80e562d
11 changed files with 249 additions and 30 deletions

View File

@ -1,26 +0,0 @@
# docker-bake.hcl
group "default" {
targets = ["base", "overlay_arm64", "overlay_amd64"]
}
target "base" {
dockerfile = "docker/Dockerfile"
tags = ["ghcr.io/bjoernellens1/ros2_rmp/rmp:base"]
}
target "overlay_arm64" {
inherits = ["base"]
dockerfile = "docker/Dockerfile.arm64"
platforms = ["linux/arm64"]
}
target "overlay_amd64" {
inherits = ["base"]
dockerfile = "docker/Dockerfile.amd64"
platforms = ["linux/amd64"]
}
target "db" {
dockerfile = "Dockerfile.db"
tags = ["docker.io/username/db"]
}

View File

@ -7,6 +7,8 @@ services:
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/ros2_rmp/rmp:base
args:
ROS_DISTRO: humble
target: base
@ -286,8 +288,6 @@ services:
# Networking
ports:
- 8080:8080
profiles:
- robot
# USB Camera Stream
cam:
@ -304,4 +304,41 @@ services:
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
devices:
- /dev/video0:/dev/video0
#ROS1 Bridge
ros1bridge:
image: ghcr.io/bjoernellens1/ros2_rmp/ros1bridge
command: >
ros2 run ros1_bridge dynamic_bridge --bridge-all-2to1-topics
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/ros2_rmp/ros1bridge
args:
ROS_DISTRO: humble
target: bridge
x-bake:
platforms:
#- linux/arm64
- linux/amd64
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
- ROS_MASTER_URI=http://localhost:11311 # is configured to run roscore on the robot but could change to local ros1 machine here
#ROS1 roscore
roscore:
command: >
roscore
extends: ros1bridge
network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
- ROS_MASTER_URI=http://localhost:11311 # is configured to run roscore on the robot but could change to local ros1 machine here

View File

@ -112,4 +112,139 @@ RUN source /rmp_ws/install/setup.bash \
# Set up the entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]
LABEL org.opencontainers.image.source=https://github.com/bjoernellens1/ros2_rmp
LABEL org.opencontainers.image.source=https://github.com/bjoernellens1/ros2_rmp
### Added for bridging
# FROM ubuntu:focal as bridge
# SHELL ["/bin/bash", "-c"]
# ENV DEBIAN_FRONTEND noninteractive
# ENV ROS_DISTRO=foxy
# RUN locale
# RUN apt-get update && apt-get install -y locales
# RUN locale-gen en_US en_US.UTF-8
# RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
# ENV LANG=en_US.UTF-8
# RUN locale
# RUN apt-get update && apt-get install -y --no-install-recommends \
# curl \
# gnupg2 \
# lsb-release \
# software-properties-common \
# && add-apt-repository universe
# RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
# RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# # Install common packages
# RUN apt-get update && apt-get install -y \
# python3-flake8-docstrings \
# python3-pip \
# python3-pytest-cov \
# ros-dev-tools
# RUN mkdir -p /root/ros2_foxy/src
# WORKDIR /root/ros2_foxy
# RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/${ROS_DISTRO}/ros2.repos src
# #&& vcs import --input https://raw.githubusercontent.com/ros2/rmw_fastrtps/${ROS_DISTRO}/rmw_fastrtps.repos ~/ros2_humble/src \
# #&& vcs import --input https://raw.githubusercontent.com/ros2/rmw_cyclonedds/${ROS_DISTRO}/rmw_cyclonedds.repos ~/ros2_humble/src
# ARG RTI_NC_LICENSE_ACCEPTED=yes # must accept license agreement for RTI Connext DDS
# RUN apt-get update && apt-get upgrade -y \
# && rosdep init \
# && rosdep update \
# && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y --skip-keys "console_bridge fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers"
# RUN colcon build --symlink-install
# # 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 echo "TARGETPLATFORM is $TARGETPLATFORM"
# RUN echo "Hardware platform is: $(uname -m)"
# RUN uname -a
# RUN if [ "$(uname -m)" = "x86_64" ]; 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
# RUN vcs import < dependencies.repos;
# # Build the base Colcon workspace, installing dependencies first.
# WORKDIR /rmp_ws
# RUN source /home/root/ros2_foxy/install/setup.bash \
# && apt-get update -y \
# && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y
# RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
# && colcon build --symlink-install
# ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# # Set up the entrypoint
# COPY ./docker/entrypoint.sh /
# RUN chmod +x /entrypoint.sh
# ENTRYPOINT [ "/entrypoint.sh" ]
# This is an auto generated Dockerfile for ros:ros1-bridge
# generated from docker_images_ros2/ros1_bridge/create_ros_ros1_bridge_image.Dockerfile.em
FROM ros:eloquent-ros-base-bionic AS bridge
RUN apt update && apt install -y curl gnupg2 lsb-release
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros1-latest.list
# setup keys
# RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
ENV ROS1_DISTRO melodic
ENV ROS2_DISTRO eloquent
# install ros packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS1_DISTRO}-ros-comm \
ros-${ROS1_DISTRO}-roscpp-tutorials \
ros-${ROS1_DISTRO}-rospy-tutorials \
&& rm -rf /var/lib/apt/lists/*
# install ros2 packages
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS2_DISTRO}-ros1-bridge \
ros-${ROS2_DISTRO}-demo-nodes-cpp \
ros-${ROS2_DISTRO}-demo-nodes-py \
ros-${ROS2_DISTRO}-rmw-cyclonedds-cpp \
&& rm -rf /var/lib/apt/lists/*
# install downstream packages
RUN apt-get update && apt-get install -y --no-install-recommends \
python-rosdep \
&& rm -rf /var/lib/apt/lists/*
RUN echo "update 04.09.2023-2"
# setup entrypoint
COPY ./docker/bridge_entrypoint.sh /
RUN chmod +x /bridge_entrypoint.sh
# Set up the entrypoint
ENTRYPOINT [ "/bridge_entrypoint.sh" ]

View File

@ -0,0 +1,39 @@
#!/bin/bash
# Basic entrypoint for ROS / Colcon Docker containers
UNDERLAY_WS=/rmp_ws
# Source ROS 2
source /opt/ros/${ROS_DISTRO}/setup.bash
echo "Sourced ROS 2 ${ROS_DISTRO}"
# Source the base workspace, if built
if [ -f ${UNDERLAY_WS}/install/setup.bash ]
then
source ${UNDERLAY_WS}/install/setup.bash
#export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(ros2 pkg prefix turtlebot3_gazebo)/share/turtlebot3_gazebo/models
echo "Sourced CPS RMP 220 base workspace"
fi
# Source the overlay workspace, if built
if [ -f /overlay_ws/install/setup.bash ]
then
source /overlay_ws/install/setup.bash
echo "Sourced CPS RMP 220 Overlay workspace"
fi
# Source the bridge workspace, if built
if [ -f /opt/ros/melodic/local_setup.bash ]
then
source /opt/ros/melodic/local_setup.bash
echo "Sourced melodic distribution"
fi
if [ -f /opt/ros/eloquent/local_setup.bash ]
then
source /opt/ros/eloquent/local_setup.bash
echo "Sourced eloquent distribution"
fi
# Execute the command passed into this entrypoint
exec "$@"

View File

@ -23,5 +23,13 @@ then
echo "Sourced CPS RMP 220 Overlay workspace"
fi
# Source the bridge workspace, if built
if [ -f ~/ros2_humble/install/setup.bash ]
then
source ~/ros2_humbleinstall/setup.bash
#export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(ros2 pkg prefix turtlebot3_gazebo)/share/turtlebot3_gazebo/models
echo "Sourced CPS RMP 220 base workspace"
fi
# Execute the command passed into this entrypoint
exec "$@"

7
maps/map.yaml Normal file
View File

@ -0,0 +1,7 @@
image: map_floor_mainb_full_save.pgm
mode: trinary
resolution: 0.05
origin: [-66.2, -24.5, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25

7
maps/map.yaml.bak Normal file
View File

@ -0,0 +1,7 @@
image: map_floor_mainb_save.pgm
mode: trinary
resolution: 0.05
origin: [-20.9, -7.03, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25

Binary file not shown.

File diff suppressed because one or more lines are too long

BIN
maps/map_floor_save.pgm Normal file

Binary file not shown.

7
maps/map_floor_save.yaml Normal file
View File

@ -0,0 +1,7 @@
image: map_floor_save.pgm
mode: trinary
resolution: 0.05
origin: [-13.7, -5.57, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25