This commit is contained in:
Björn Ellensohn 2023-07-24 12:28:21 +02:00
parent bc57176cae
commit 2a0b0fe4ce
5 changed files with 178 additions and 0 deletions

13
dependencies.repos Normal file
View File

@ -0,0 +1,13 @@
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

66
docker-compose.yaml Normal file
View File

@ -0,0 +1,66 @@
version: "3.9"
services:
# Base image containing dependencies.
base:
image: bot_mini:base
build:
context: .
dockerfile: docker/Dockerfile
args:
ROS_DISTRO: humble
target: base
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
privileged: true
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
# Overlay image containing the example source code.
overlay:
extends: base
image: bot_mini:overlay
build:
context: .
dockerfile: docker/Dockerfile
target: overlay
# Controller and teleop
controller:
extends: overlay
command: >
ros2 launch bot_mini_bringup robot_controller.launch.py
priority:=80 cpu-affinity:=4 lock-memory-size:=100 config-child-threads:=True
&&
ros2 launch bot_mini_bringup robot_twist_mux.launch.py
&&
ros2 launch bot_mini_bringup robot_joy_teleop.launch.py
# # Behavior demo using Python and py_trees
# demo-behavior-py:
# extends: overlay
# command: >
# ros2 launch tb3_autonomy tb3_demo_behavior_py.launch.py
# tree_type:=${BT_TYPE:?}
# enable_vision:=${ENABLE_VISION:?}
# target_color:=${TARGET_COLOR:?}
# # Behavior demo using C++ and BehaviorTree.CPP
# demo-behavior-cpp:
# extends: overlay
# command: >
# ros2 launch tb3_autonomy tb3_demo_behavior_cpp.launch.py
# tree_type:=${BT_TYPE:?}
# enable_vision:=${ENABLE_VISION:?}
# target_color:=${TARGET_COLOR:?}

53
docker/Dockerfile Normal file
View File

@ -0,0 +1,53 @@
ARG ROS_DISTRO=humble
ARG UNDERLAY_WS=/bot_mini_ws
########################################
# Base Image for Bot Mini Control #
########################################
FROM osrf/ros:${ROS_DISTRO}-desktop as base
ENV ROS_DISTRO=${ROS_DISTRO}
SHELL ["/bin/bash", "-c"]
# Create Colcon workspace with external dependencies
RUN mkdir -p /bot_mini_ws/src
WORKDIR /bot_mini_ws/src
COPY dependencies.repos .
RUN vcs import < dependencies.repos
# Build the base Colcon workspace, installing dependencies first.
WORKDIR /bot_mini_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 /bot_mini_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
ENTRYPOINT [ "/entrypoint.sh" ]

25
docker/entrypoint.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Basic entrypoint for ROS / Colcon Docker containers
# 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 Bot Mini base workspace"
fi
# Source the overlay workspace, if built
if [ -f /overlay_ws/install/setup.bash ]
then
source /overlay_ws/install/setup.bash
#export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(ros2 pkg prefix tb3_worlds)/share/tb3_worlds/models
echo "Sourced Bot Mini overlay workspace"
fi
# Execute the command passed into this entrypoint
exec "$@"

21
overlay.repos Normal file
View File

@ -0,0 +1,21 @@
repositories:
bot_mini_description:
type: git
url: https://github.com/bjoernellens1/bot_mini_description.git
version: main
bot_mini_bringup:
type: git
url: https://github.com/bjoernellens1/bot_mini_bringup.git
version: imu
rmp220_teleop:
type: git
url: https://github.com/bjoernellens1/rmp220_teleop.git
version: bot_mini
cam_openCV:
type: git
url: https://github.com/bjoernellens1/ros2_cam_openCV.git
version: main