diff --git a/Dockerfile.hardware b/Dockerfile.hardware index 98f292f..74443b3 100644 --- a/Dockerfile.hardware +++ b/Dockerfile.hardware @@ -106,6 +106,7 @@ RUN apt-get update && apt-get install -y \ python3-pip \ python3-rosdep \ stm32flash \ + gosu \ ros-$ROS_DISTRO-teleop-twist-keyboard && \ pip3 install pyftdi && \ rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && \ diff --git a/demo/compose.build.yaml b/demo/compose.build.yaml new file mode 100644 index 0000000..a958ba9 --- /dev/null +++ b/demo/compose.build.yaml @@ -0,0 +1,28 @@ +# Quick Start +# +# 1. run `docker compose up` on the robot +# 2. run `ROS_DOMAIN_ID=10 ros2 run teleop_twist_keyboard teleop_twist_keyboard` in the robot termianl + +x-common-config: + &common-config + network_mode: host + ipc: host + environment: + - FASTRTPS_DEFAULT_PROFILES_FILE=/shm-only.xml + - ROS_DOMAIN_ID=10 + - USER + +services: + + rosbot: + build: + context: .. + dockerfile: Dockerfile.hardware + <<: *common-config + devices: + - ${SERIAL_PORT:?err} + command: > + ros2 launch rosbot_bringup combined.launch.py + mecanum:=${MECANUM:-False} + serial_port:=$SERIAL_PORT + serial_baudrate:=576000 diff --git a/demo/shm-only.xml b/demo/shm-only.xml new file mode 100644 index 0000000..9b9149d --- /dev/null +++ b/demo/shm-only.xml @@ -0,0 +1,17 @@ + + + + + shm_transport + SHM + + + + + + shm_transport + + false + + + \ No newline at end of file diff --git a/ros_entrypoint.sh b/ros_entrypoint.sh index d785c50..9bbfd75 100755 --- a/ros_entrypoint.sh +++ b/ros_entrypoint.sh @@ -19,6 +19,11 @@ source "/opt/ros/$ROS_DISTRO/setup.bash" source "/ros2_ws/install/setup.bash" source "/ros2_ws_healthcheck/install/setup.bash" -ros2 run healthcheck_pkg healthcheck_node & +if [ -z "$USER" ]; then + export USER=root +elif ! id "$USER" &>/dev/null; then + useradd -ms /bin/bash "$USER" +fi -exec "$@" +gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &" +exec gosu $USER "$@"