diff --git a/Docker/attachBash.sh b/Docker/attachBash.sh new file mode 100644 index 0000000..50cdc08 --- /dev/null +++ b/Docker/attachBash.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sudo docker exec -it ros-core bash \ No newline at end of file diff --git a/Docker/compose.yaml b/Docker/compose.yaml new file mode 100644 index 0000000..f123da5 --- /dev/null +++ b/Docker/compose.yaml @@ -0,0 +1,34 @@ +#Simon Tscherne +version: "3" +services: + novnc-backend: + image: theasp/novnc:latest + environment: + - DISPLAY_WIDTH=1700 + - DISPLAY_HEIGHT=901 + - RUN_XTERM=no + ports: + - 8080:8080 + networks: + - host + container_name: novnc + + ros-core: + image: ros_noetic_turtlebot + environment: + - DISPLAY=novnc:0.0 + devices: + - /dev/video0:/dev/video0 + - /dev/video1:/dev/video1 + volumes: + - ./turtle_control:/catkin_ws/src/turtle_control + depends_on: + - novnc-backend + command: bash -c "roscore" + networks: + - host + container_name: ros-core + +networks: + host: {} + diff --git a/Docker/removeAllContainer.sh b/Docker/removeAllContainer.sh new file mode 100644 index 0000000..545acbc --- /dev/null +++ b/Docker/removeAllContainer.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sudo docker rm -f $(docker ps -a -q) \ No newline at end of file diff --git a/Docker/ros_noetic_dockerfile b/Docker/ros_noetic_dockerfile new file mode 100644 index 0000000..7103984 --- /dev/null +++ b/Docker/ros_noetic_dockerfile @@ -0,0 +1,62 @@ +#Simon Tscherne +FROM osrf/ros:noetic-desktop-full + +# Change the default shell to Bash +SHELL [ "/bin/bash" , "-c" ] + +# Install some needed stuff +RUN apt update && apt install -y git vim liborocos-kdl-dev python3 python-is-python3 python3-pip tmux + +RUN pip install imutils opencv-python + + +RUN source ./ros_entrypoint.sh \ + && mkdir -p /catkin_ws/src \ + && cd /catkin_ws/ \ + && catkin_make \ + && cd src/ \ + && git clone https://github.com/turtlebot/turtlebot.git \ + && git clone https://github.com/turtlebot/turtlebot_msgs.git \ + && git clone https://github.com/turtlebot/turtlebot_apps.git \ + && git clone https://github.com/turtlebot/turtlebot_simulator \ + && git clone https://github.com/yujinrobot/yujin_ocs.git \ + && mv yujin_ocs/yocs_cmd_vel_mux yujin_ocs/yocs_controllers yujin_ocs/yocs_velocity_smoother . \ + && rm -rf yujin_ocs \ + && git clone https://github.com/yujinrobot/kobuki.git + +RUN source ./ros_entrypoint.sh \ + && cd /catkin_ws/src \ + && rosdep install --from-paths . --ignore-src -r -y \ + && cd .. \ + && source ./devel/setup.bash \ + && catkin_make \ + && cd build \ + && make install + +RUN echo "source /ros_entrypoint.sh" >> ~/.bashrc +RUN echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc + +#Now astra camera + +RUN apt install -y libgflags-dev ros-noetic-image-geometry ros-noetic-camera-info-manager ros-noetic-image-transport ros-noetic-image-publisher libgoogle-glog-dev libusb-1.0-0-dev libeigen3-dev + +RUN git clone https://github.com/libuvc/libuvc.git \ +&& cd libuvc \ +&& mkdir build \ +&& cd build \ +&& cmake .. \ +&& make -j4 \ +&& sudo make install \ +&& sudo ldconfig + +RUN source /catkin_ws/devel/setup.bash \ +&& cd /catkin_ws/src \ +&& git clone https://github.com/orbbec/ros_astra_camera.git \ +&& rosdep install --from-paths . --ignore-src -r -y \ +&& cd .. \ +&& catkin_make \ +&& roscd astra_camera + + +# Set the working folder at startup +WORKDIR /catkin_ws diff --git a/Docker/setupDocker.sh b/Docker/setupDocker.sh new file mode 100644 index 0000000..b9140e3 --- /dev/null +++ b/Docker/setupDocker.sh @@ -0,0 +1,9 @@ +#!/bin/bash +#Simon Tscherne +echo "This can take some time!" +echo "This does create new docker images. Press enter" +read nothing +sudo chmod -R 0777 ./turtle_control +sudo docker build -f ros_noetic_dockerfile -t ros_noetic_turtlebot . +sudo docker compose down --volumes --remove-orphans +sudo docker compose up --remove-orphans -d diff --git a/Docker/startX11-NOT-ISOLATED.sh b/Docker/startX11-NOT-ISOLATED.sh new file mode 100644 index 0000000..f2a6661 --- /dev/null +++ b/Docker/startX11-NOT-ISOLATED.sh @@ -0,0 +1,21 @@ +#!/bin/bash +#Simon Tscherne +echo "This starts a roscore container in a non safe, not isolated way!" +echo "Only works if youre using X11" +echo "Press enter" +read nothing +sh removeAllContainer.sh +sudo docker run -d \ + --net=host \ + --name=ros-core \ + --env="DISPLAY" \ + --env="QT_X11_NO_MITSHM=1" \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + --volume="./turtle_control:/catkin_ws/src/turtle_control" \ + --device=/dev/video0:/dev/video0 \ + --device=/dev/video1:/dev/video1 \ + ros_noetic_turtlebot \ + "rqt" +export containerId=$(docker ps -l -q) +sudo xhost +local:`docker inspect --format='{{ .Config.Hostname }}' $containerId` +sudo docker start $containerId \ No newline at end of file diff --git a/Docker/stopAllContainer.sh b/Docker/stopAllContainer.sh new file mode 100644 index 0000000..d468fbd --- /dev/null +++ b/Docker/stopAllContainer.sh @@ -0,0 +1,4 @@ +#!/bin/sh +#Stops all docker container +sudo docker stop $(docker ps -a -q) +sudo docker ps \ No newline at end of file