This commit is contained in:
Björn Ellensohn 2023-07-25 11:59:39 +02:00
parent dfeb1a7cee
commit fe19ca1207
3 changed files with 90 additions and 2 deletions

View File

@ -67,8 +67,62 @@ services:
localization: localization:
extends: overlay extends: overlay
command: > command: >
ros2 launch bot_mini_bringup rsp.launch.py & ros2 launch bot_mini_bringup robot_localization.launch.py & /localization_startup.sh
ros2 launch bot_mini_bringup robot_lidar.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
# 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: devices:
- /dev/ttyUSB0:/dev/ttyUSB0 - /dev/ttyUSB0:/dev/ttyUSB0
- /dev/ttyACM0:/dev/ttyACM0 - /dev/ttyACM0:/dev/ttyACM0

View File

@ -53,4 +53,10 @@ RUN chmod +x /entrypoint.sh
COPY ./controller_startup.sh / COPY ./controller_startup.sh /
RUN chmod +x /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" ] ENTRYPOINT [ "/entrypoint.sh" ]

28
localization_startup.sh Normal file
View File

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