diff --git a/Dockerfile.Simulator b/Dockerfile.Simulator index 54dadae..67ee905 100644 --- a/Dockerfile.Simulator +++ b/Dockerfile.Simulator @@ -1,70 +1,9 @@ -FROM osrf/ros:noetic-desktop-full - - -ARG TELEOP_CONTROLLER -ENV TELEOP_CONTROLLER=${TELEOP_CONTROLLER} - -ARG ENABLE_MANIPULATOR -ENV ENABLE_MANIPULATOR=${ENABLE_MANIPULATOR} - -ARG OPEN_MANIPULATOR_GUI -ENV MANIPULATOR_GUI=${MANIPULATOR_GUI} - -ARG WORLD_NAME -ENV WORLD_NAME=${WORLD_NAME} - - -ENV NVIDIA_VISIBLE_DEVICES \ - ${NVIDIA_VISIBLE_DEVICES:-all} -ENV NVIDIA_DRIVER_CAPABILITIES \ - ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics - +FROM osrf/ros:jazzy-desktop WORKDIR /home/ -RUN apt-get update &&\ - apt-get install -y\ - gazebo11 \ - build-essential \ - python3-osrf-pycommon \ - python3-catkin-tools \ - python3-rosdep \ - libignition-rendering3 \ - git \ - xvfb - - -RUN mkdir -p catkin_ws/src - -WORKDIR /home/catkin_ws/src/ - -RUN git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git &&\ - git clone https://github.com/ROBOTIS-GIT/turtlebot3_manipulation.git &&\ - git clone https://github.com/ROBOTIS-GIT/turtlebot3_manipulation_simulations.git &&\ - git clone https://github.com/ROBOTIS-GIT/open_manipulator_dependencies.git - - -COPY ./ros_packages/ /home/catkin_ws/src/ -COPY ./docker_scripts/install_dep.sh /home/ -RUN /home/install_dep.sh - -RUN mkdir -p /usr/share/gazebo-11/models -COPY ./models /usr/share/gazebo-11/models -COPY ./docker_scripts/setup.sh /usr/share/gazebo-11/setup.sh -COPY ./docker_scripts/setup.sh /usr/share/gazebo/setup.sh - -COPY ./config /home/config -COPY ./docker_scripts/entrypoint.sh /home/ -COPY ./worlds /home/catkin_ws/src/isar_turtlebot/worlds/ -COPY ./maps /home/catkin_ws/src/isar_turtlebot/maps/ - - -# Change user to avoid running as root -# User needs to have an explicit guid for radix -RUN useradd -ms /bin/bash --uid 1001 -g users turtle_sim -RUN chown -R 1001 /home -RUN chmod 755 /home +COPY /docker_scripts/install_sim.sh /home/ -USER 1001 +RUN bash /home/install_sim.sh -CMD /home/entrypoint.sh +CMD ["sleep", "infinity"] diff --git a/docker-compose.yml b/docker-compose.yml index acf29b5..caed6e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,19 @@ -version: "2.3" services: - noetic: + simulator: image: turtle_sim:latest container_name: turtle_sim + platform: linux/amd64 build: context: ./ dockerfile: Dockerfile.Simulator - ports: - - "9090:9090" - - "5000:5000" - environment: - - TELEOP_CONTROLLER=${TELEOP_CONTROLLER:-disabled} - - ENABLE_MANIPULATOR=${ENABLE_MANIPULATOR:-false} - - MANIPULATOR_GUI=${MANIPULATOR_GUI:-disabled} - - HEADLESS=${HEADLESS:-true} - - WORLD_NAME=${WORLD_NAME:-house} tty: true networks: - turtlenet + environment: + - DISPLAY=${DISPLAY} # for gazebo gui + privileged: true # for gazebo gui + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix:ro # for gazebo gui networks: turtlenet: name: turtlenet diff --git a/docker_scripts/install_sim.sh b/docker_scripts/install_sim.sh new file mode 100644 index 0000000..df82903 --- /dev/null +++ b/docker_scripts/install_sim.sh @@ -0,0 +1,22 @@ +#!/bin/bash/ + +curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg +echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null + +apt-get update +apt-get install -y ros-dev-tools gz-harmonic + +mkdir -p /home/turtlebot4_ws/src +cd /home/turtlebot4_ws/src + +git clone https://github.com/turtlebot/turtlebot4_simulator.git -b jazzy +cd /home/turtlebot4_ws +rosdep install --from-path src -yi + +source /opt/ros/jazzy/setup.bash +colcon build --symlink-install + +source /home/turtlebot4_ws/install/setup.bash + +echo 'source /opt/ros/jazzy/setup.bash' >> /home/.bashrc +echo 'source /home/turtlebot4_ws/install/setup.bash'>> /home/.bashrc