From fe19ca1207e441105a5fd8097e1cb9178d3922b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Tue, 25 Jul 2023 11:59:39 +0200 Subject: [PATCH] update --- docker-compose.yaml | 58 +++++++++++++++++++++++++++++++++++++++-- docker/Dockerfile | 6 +++++ localization_startup.sh | 28 ++++++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 localization_startup.sh diff --git a/docker-compose.yaml b/docker-compose.yaml index 34c0b02..96e0fd1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -67,8 +67,7 @@ services: localization: extends: overlay command: > - ros2 launch bot_mini_bringup rsp.launch.py & ros2 launch bot_mini_bringup robot_localization.launch.py & - ros2 launch bot_mini_bringup robot_lidar.launch.py + /localization_startup.sh devices: - /dev/ttyUSB0:/dev/ttyUSB0 - /dev/ttyACM0:/dev/ttyACM0 @@ -90,6 +89,61 @@ services: # Allows graphical programs in the container. - /tmp/.X11-unix:/tmp/.X11-unix:rw - ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority + + # mapping + mapping: + extends: overlay + command: > + ros2 launch bot_mini_bringup robot_mapper.launch.py + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 + - /dev/ttyACM0:/dev/ttyACM0 + - /dev/input/js0:/dev/input/js0 + # 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 + + # navigation + navigation: + extends: overlay + command: > + ros2 launch bot_mini_bringup robot_navigation.launch.py + map_subscribe_transient_local:=true + devices: + - /dev/ttyUSB0:/dev/ttyUSB0 + - /dev/ttyACM0:/dev/ttyACM0 + - /dev/input/js0:/dev/input/js0 + # 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 # # Behavior demo using Python and py_trees # demo-behavior-py: diff --git a/docker/Dockerfile b/docker/Dockerfile index 47ec9ce..215dc9c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -53,4 +53,10 @@ RUN chmod +x /entrypoint.sh COPY ./controller_startup.sh / RUN chmod +x /controller_startup.sh +COPY ./mapping_startup.sh / +RUN chmod +x /mapping_startup.sh + +COPY ./localization_startup.sh / +RUN chmod +x /localization_startup.sh + ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/localization_startup.sh b/localization_startup.sh new file mode 100644 index 0000000..5f6475a --- /dev/null +++ b/localization_startup.sh @@ -0,0 +1,28 @@ +#!/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 + +# Start Robot ROS2 Nodes +ros2 launch bot_mini_bringup robot_lidar.launch.py & +ros2 launch bot_mini_bringup robot_localization.launch.py + +wait \ No newline at end of file