xhost +local:docker
./rocker.sh
Start gazebo once
gazebo
Close gazebo.
Start the simulation
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
docker exec -it turtlebot2 /entrypoint.sh bash
docker build -t turtlebot3 . |
# https://ros.org/reps/rep-2001.html#simulation | |
FROM osrf/ros:humble-simulation | |
# https://answers.ros.org/question/411908/running-humble-on-turtlebot3/ | |
# Install colcon_cd | |
RUN apt update | |
RUN apt install -y python3-colcon-common-extensions | |
# Set up colcon_cd for future bash sessions | |
RUN echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc | |
RUN echo "export _colcon_cd_root=/opt/ros/humble/" >> ~/.bashrc | |
RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc | |
# Install turtlebot2 dependencies | |
RUN sudo apt install -y ros-humble-navigation2 | |
RUN sudo apt install -y ros-humble-nav2-bringup | |
RUN sudo apt install -y ros-humble-turtlebot3* | |
#RUN sudo apt install -y ros-humble-turtle* | |
ENV TURTLEBOT3_MODEL=waffle | |
ENV GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models | |
# Workspace and Kobuki | |
RUN mkdir -p "/tb2_ros2_nav2/ros2_ws/src" | |
WORKDIR "/tb2_ros2_nav2/ros2_ws/src" | |
RUN git clone https://github.com/kobuki-base/kobuki_core.git | |
RUN git clone https://github.com/kobuki-base/velocity_smoother.git | |
RUN git clone https://github.com/kobuki-base/cmd_vel_mux.git | |
RUN git clone https://github.com/kobuki-base/kobuki_ros_interfaces.git | |
RUN git clone https://github.com/kobuki-base/kobuki_ros.git | |
RUN git clone https://github.com/stonier/ecl_core.git | |
RUN git clone https://github.com/stonier/ecl_lite.git | |
RUN git clone https://github.com/stonier/sophus.git | |
RUN sudo apt install -y ros-humble-action-msgs | |
# Change permissions | |
RUN sudo chmod 777 -R /tb2_ros2_nav2 | |
WORKDIR "/tb2_ros2_nav2/ros2_ws" | |
# Install dependencies | |
## Disable ecl_cxx_warnings in kobuki_core | |
RUN sed -i 's/ecl_enable_cxx_warnings()/#ecl_enable_cxx_warnings()/g' src/kobuki_core/CMakeLists.txt | |
## Rosdep | |
RUN /bin/bash -c 'source /opt/ros/humble/setup.bash \ | |
&& rosdep update && rosdep install -i --from-path src --rosdistro humble -y' | |
# Build | |
RUN /bin/bash -c 'source /opt/ros/humble/setup.bash \ | |
&& colcon build --symlink-install' | |
# Entrypoint | |
COPY entrypoint.sh / | |
RUN chmod +x /entrypoint.sh | |
ENTRYPOINT ["/entrypoint.sh"] | |
# Interactive bash shell | |
CMD ["/bin/bash"] |
#!/bin/bash | |
set -e | |
# Setup the Demo environment | |
cd /tb2_ros2_nav2/ros2_ws/ | |
source /opt/ros/humble/setup.bash | |
source install/local_setup.bash | |
exec "$@" |
ROCKER_ARGS="--devices /dev/dri/ --dev-helpers --x11 --user-override-name spaceros-user --network host" | |
IMG_NAME=turtlebot3 | |
# Replace `/` with `_` to comply with docker container naming | |
# And append `_runtime` | |
CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")" | |
ROCKER_ARGS="${ROCKER_ARGS} --name $CONTAINER_NAME" | |
echo "Using image <$IMG_NAME> to start container <$CONTAINER_NAME>" | |
# Start the container | |
rocker ${ROCKER_ARGS} $IMG_NAME |