diff --git a/Dockerfile b/Dockerfile index 4cf621dc8c95ac3ca24feea914cca46b29b5fab5..323d264b7742c72a478819aa8e4ed43cfd68d7ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,36 @@ -FROM osrf/ros:melodic-desktop-full-bionic - -ARG uid=1000 -ARG gid=1000 - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENV USERNAME ros -RUN useradd -m $USERNAME && \ - echo "$USERNAME:$USERNAME" | chpasswd && \ - usermod --shell /bin/bash $USERNAME && \ - usermod -aG sudo $USERNAME && \ - echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ - chmod 0440 /etc/sudoers.d/$USERNAME && \ - # Replace 1000 with your user/group id - usermod --uid $uid $USERNAME && \ - groupmod --gid $gid $USERNAME - -RUN apt-get update && apt-get install -y \ - python-catkin-tools bash \ - mesa-utils libgl1-mesa-glx -WORKDIR /home/$USERNAME -COPY src /home/$USERNAME/src -RUN rosdep install --from-paths . -r -y +FROM dorowu/ubuntu-desktop-lxde-vnc:bionic + +# Fix dirmngr +RUN apt-get purge dirmngr -y && apt-get update && apt-get install dirmngr -y +RUN apt-get dist-upgrade -y + +# Adding keys for ROS +RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 + +# Installing ROS +RUN apt-get update && apt-get install -y ros-melodic-desktop-full wget nano python-rosdep +RUN apt-get install -y \ + ros-melodic-libfranka python-catkin-tools libeigen3-dev +RUN apt-get install -y python-rosinstall python-rosinstall-generator python-wstool build-essential +RUN rosdep init && rosdep update + +RUN mkdir -p /root/ws_tmp /root/Desktop && ln -s /usr/share/applications/lxterminal.desktop /root/Desktop/lxterminal.desktop +ENV ROS_DISTRO=melodic + +RUN /bin/bash -c "echo -e 'source /root/Desktop/ros_ws/devel/setup.bash\n \ + umask 000\n \ + cd /root/Desktop/ros_ws/\n' >> /root/.bashrc " + +WORKDIR /root/ws_tmp +COPY vnc/copyws.sh /root/copyws.sh +RUN chmod a+x /root/copyws.sh +COPY ./src /root/ws_tmp/src + +RUN apt-get update && rosdep install --from-paths . -r -y + RUN catkin config \ --extend /opt/ros/melodic && \ catkin build - -ENTRYPOINT ["/entrypoint.sh"] +ENV OPENBOX_ARGS --startup "/root/copyws.sh" +VOLUME /root/Desktop/ros_ws diff --git a/README.md b/README.md index 4c262e0adb02929df2902a0437b82855b9f86dfe..8ff5c6414c0a05df6bf10d1b5a4696443e9fb3fc 100644 --- a/README.md +++ b/README.md @@ -10,30 +10,11 @@ ## Docker To quickly run the graphical example applications, you can use Docker. For development purposes, please use the regular installation -instructions further below in this document. Please note that the setup for Windows and Mac OS systems uses X11 forwarding and thus -offers limited graphics performance. +instructions further below in this document. Please note that the setup uses vnc and thus offers limited graphics performance. -- Clone this repo and its submodules: - - as a guest: `git clone --recurse-submodules https://git-st.inf.tu-dresden.de/ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace` - - as a project member with a registered ssh key: `git clone --recurse-submodules git@git-st.inf.tu-dresden.de:ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace` -- Follow the steps for your operating system. - -### Linux - -- Install Docker for your linux distribution -- Run `./docker-run.sh roslaunch sample_applications sample_simple_simulation.launch` to build and run a docker image tagged with `ceti-panda-gazebo-workspace` - -### Windows 10 - -- Install [Docker Desktop for Windows](https://hub.docker.com/editions/community/docker-ce-desktop-windows) -- Install [Xming](https://sourceforge.net/projects/xming/) -- Run `docker-run.bat roslaunch sample_applications sample_simple_simulation.launch` - -### Mac OS - -- Install [Docker Destop for Mac OS](https://hub.docker.com/editions/community/docker-ce-desktop-mac) -- Install [XQuartz](https://www.xquartz.org/). Enable the `Allow connections from network clients` setting in the preferences (`Security` Tab). -- Run `docker-run-mac.sh roslaunch sample_applications sample_simple_simulation.launch` +- Install Docker for your system (for Windows and Mac OS, install Docker Desktop) +- Run the container: `docker run -it -p 6080:80 --rm git-st.inf.tu-dresden.de:4567/ceti/ros-internal/panda_gazebo_workspace`. A webserver is run inside the container that is exposed to port `6080` on your system. +- Open `http://localhost:6080` in a web browser ## Requirements for development diff --git a/config.xlaunch b/config.xlaunch deleted file mode 100644 index 04b7faeb2ff618014c25a18c332d40fa1053e284..0000000000000000000000000000000000000000 --- a/config.xlaunch +++ /dev/null @@ -1,2 +0,0 @@ -<?xml version="1.0"?> -<XLaunch xmlns="http://www.straightrunning.com/XmingNotes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.straightrunning.com/XmingNotes XLaunch.xsd" WindowMode="MultiWindow" ClientMode="NoClient" Display="0" Clipboard="true" NoAccessControl="true"/> diff --git a/docker-run-mac.sh b/docker-run-mac.sh deleted file mode 100644 index 1e407c85b6e309d59ccd04ddd2e70605480d7bf7..0000000000000000000000000000000000000000 --- a/docker-run-mac.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -docker build . -t ceti-panda-gazebo-workspace - -XSOCK=/tmp/.X11-unix - -/usr/X11/bin/xhost + 127.0.0.1 -defaults write org.macosforge.xquartz.X11 enable_iglx -bool true - -docker run -it \ - --volume=$XSOCK:$XSOCK:rw \ - --env="LIBGL_ALWAYS_INDIRECT=1" \ - --env="DISPLAY=host.docker.internal:0" \ - --user="ros" \ - ceti-panda-gazebo-workspace \ - "$@" \ No newline at end of file diff --git a/docker-run.bat b/docker-run.bat deleted file mode 100644 index 440af3a4c2242d593f1e85e201328adeaf9cf044..0000000000000000000000000000000000000000 --- a/docker-run.bat +++ /dev/null @@ -1,11 +0,0 @@ -start config.xlaunch - -docker build . -t ceti-panda-gazebo-workspace - -docker run -it^ - --env="DISPLAY=host.docker.internal:0"^ - --user="ros"^ - ceti-panda-gazebo-workspace^ - %* - -pause \ No newline at end of file diff --git a/docker-run.sh b/docker-run.sh deleted file mode 100755 index a53368027d31bcd98a437b0df6c52ec89968d23a..0000000000000000000000000000000000000000 --- a/docker-run.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# http://wiki.ros.org/docker/Tutorials/GUI - -docker build . -t ceti-panda-gazebo-workspace \ - --build-arg UID=$UID \ - --build-arg GID=$GID - -XSOCK=/tmp/.X11-unix -XAUTH=/tmp/.docker.xauth -touch $XAUTH -xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - - -docker run -it \ - --volume=$XSOCK:$XSOCK:rw \ - --volume=$XAUTH:$XAUTH:rw \ - --env="XAUTHORITY=${XAUTH}" \ - --env="DISPLAY" \ - --device=/dev/dri \ - --group-add video \ - --user="ros" \ - ceti-panda-gazebo-workspace \ - "$@" \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index 527ef79f97e119b848d1817fcec54f9bc4be1227..0000000000000000000000000000000000000000 --- a/entrypoint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -source /opt/ros/melodic/setup.bash -source $HOME/devel/setup.bash -exec "$@" \ No newline at end of file diff --git a/vnc/copyws.sh b/vnc/copyws.sh new file mode 100644 index 0000000000000000000000000000000000000000..f2e3afcebbb178197c70717a49d17fbac99569c3 --- /dev/null +++ b/vnc/copyws.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -z "$(ls -A /root/Desktop/ros_ws)" ]; then + echo "Copying workspace..." + cp /root/ws_tmp/* /root/Desktop/ros_ws -r + chmod a+rwx /root/Desktop/ros_ws/ -R +fi \ No newline at end of file