From a2b03d53c4ef60bd93e62c0655b6758f12bb7ed3 Mon Sep 17 00:00:00 2001
From: Tim Kluge <timklge@gmail.com>
Date: Fri, 8 May 2020 13:56:05 +0200
Subject: [PATCH] ref #1: Add Mac OS, Windows Docker instructions

---
 README.md         | 37 +++++++++++++++++++++++++++----------
 config.xlaunch    |  2 ++
 docker-run-mac.sh | 11 +++++++++++
 docker-run.bat    | 11 +++++++++++
 4 files changed, 51 insertions(+), 10 deletions(-)
 create mode 100644 config.xlaunch
 create mode 100644 docker-run-mac.sh
 create mode 100644 docker-run.bat

diff --git a/README.md b/README.md
index 17a7ae6..2e1c0fc 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,33 @@
 - Currently, only very simple use cases are contained here. We will gradually update the code. Watch this space!
 - The examples only work when *all* projects in this workspace are checked out.
 
-## Requirements
+## 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.
+
+- 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`
+
+## Requirements for development
 
 - Ubuntu 18.4
 - ROS Melodic
@@ -43,12 +69,3 @@ See the [README.md of the submodule](../../../../sample_applications/-/blob/mast
 - Execution of a simple motion: `roslaunch sample_applications sample_simple_simulation.launch`
 - Execution of a simple motion costraint by a blocking object: `roslaunch sample_applications sample_constraint_simulation.launch`
 - Execution of a velocity constraint cartesian trajectory: `roslaunch sample_applications simulation.launch`
-
-## Docker
-
-To run via docker on any up-to-date linux system:
-
-- Clone this repo and its submodules (recommended for fresh installations):
-    - 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`
-- Run `./docker-run.sh roslaunch sample_applications sample_simple_simulation.launch` to build and run a docker image tagged with `ceti-panda-gazebo-workspace`
\ No newline at end of file
diff --git a/config.xlaunch b/config.xlaunch
new file mode 100644
index 0000000..04b7fae
--- /dev/null
+++ b/config.xlaunch
@@ -0,0 +1,2 @@
+<?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
new file mode 100644
index 0000000..8eaa744
--- /dev/null
+++ b/docker-run-mac.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+xhost + 127.0.0.1
+
+docker build . -t ceti-panda-gazebo-workspace
+
+docker run -it \
+    --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
new file mode 100644
index 0000000..440af3a
--- /dev/null
+++ b/docker-run.bat
@@ -0,0 +1,11 @@
+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
-- 
GitLab