diff --git a/docker-compose.yaml b/docker-compose.yaml index e3ff776..e4005cc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,14 +39,8 @@ services: # Controller and teleop controller: extends: overlay - entrypoint: ["/bin/sh","-c"] command: > - source install/setup.bash - && - 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 + /robot_startup.sh devices: - /dev/ttyUSB0:/dev/ttyUSB0 - /dev/ttyACM0:/dev/ttyACM0 diff --git a/docker/Dockerfile b/docker/Dockerfile index 400dd1f..3a56344 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -50,4 +50,7 @@ RUN source /bot_mini_ws/install/setup.bash \ COPY ./docker/entrypoint.sh / RUN chmod +x /entrypoint.sh +COPY ./robot_startup.sh / +RUN chmod +x /robot_startup.sh + ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/robot_startup.sh b/robot_startup.sh new file mode 100644 index 0000000..731a3ef --- /dev/null +++ b/robot_startup.sh @@ -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 + +# Start Robot ROS2 Nodes +bash -c "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" \ No newline at end of file