Goodbye VM. Hello Docker

This commit is contained in:
2023-11-24 21:45:15 +01:00
parent bd3ea5a906
commit 1fe811e28a
7 changed files with 134 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
sudo docker exec -it ros-core bash
+34
View File
@@ -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: {}
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
sudo docker rm -f $(docker ps -a -q)
+62
View File
@@ -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
+9
View File
@@ -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
+21
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
#Stops all docker container
sudo docker stop $(docker ps -a -q)
sudo docker ps