From 3b97d5513a67687151c4a203062a22eeee4c8248 Mon Sep 17 00:00:00 2001
From: Tommy Persson <tommmy.persson@liu.se>
Date: Thu, 24 Sep 2020 20:35:35 +0200
Subject: [PATCH] Work on development environment.

---
 doc/local_ros_installation.md | 62 ++++++++++++++++++++++++++++++-----
 script/wgrun                  | 14 ++++++++
 script/wpull                  | 11 ++++++-
 script/wrun                   | 14 ++++++++
 4 files changed, 91 insertions(+), 10 deletions(-)

diff --git a/doc/local_ros_installation.md b/doc/local_ros_installation.md
index 35d915c..aeefee3 100644
--- a/doc/local_ros_installation.md
+++ b/doc/local_ros_installation.md
@@ -61,13 +61,31 @@ Start a docker container named waradevel and run the commands there. Use this if
 ```bash
 #!/bin/bash
 
+if [[ $(lsb_release -rs) == "18.04" ]]; then
 docker run --gpus all \
   --network host \
+  --security-opt apparmor:unconfined \
   --ulimit nofile=1024 \
+  --ipc=host \
   -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
   -e DISPLAY=unix${DISPLAY}\
   -e ROS_HOSTNAME=localhost \
-  --rm -it --name wara gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest "$@"
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel "$@"
+fi
+
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+docker run --gpus all \
+  --network host \
+  --security-opt apparmor:unconfined \
+  --ulimit nofile=1024 \
+  --ipc=host \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
+  -e DISPLAY=unix${DISPLAY}\
+  -e ROS_HOSTNAME=localhost \
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel "$@"
+fi
 ```
 
 
@@ -77,13 +95,29 @@ Start a docker container named waradevel and run the command there. Use if you d
 ```bash
 #!/bin/bash
 
+if [[ $(lsb_release -rs) == "18.04" ]]; then
 docker run \
   --network host \
   --ulimit nofile=1024 \
+  --ipc=host \
   -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
   -e DISPLAY=unix${DISPLAY}\
   -e ROS_HOSTNAME=localhost \
-  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest "$@"
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel "$@"
+fi
+
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+docker run \
+  --network host \
+  --ulimit nofile=1024 \
+  --ipc=host \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
+  -e DISPLAY=unix${DISPLAY}\
+  -e ROS_HOSTNAME=localhost \
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel "$@"
+fi
 ```
 
 
@@ -93,7 +127,15 @@ Pull the image.
 ```bash
 #!/bin/bash
 
-docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:latest
+if [[ $(lsb_release -rs) == "18.04" ]]; then
+    echo "Pulling gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel"
+    docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel
+fi
+
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+    echo "Pulling gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel"
+    docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel
+fi
 ```
 
 ## How to start different parts
@@ -147,6 +189,11 @@ wexec rosrun lrs_util_tst tstdisplayserver.py __ns:=/dji0
 
 ### RVIZ
 
+The 18.04 instructions kind of work in 20.04 but the background image
+do now work. Will add instructions later how to get this to work in 20.04.
+
+#### Ubuntu 18.04 with ROS Melodic
+
 Gränsö:
 ```bash
 wexec roslaunch lrs_dji_sim rviz_granso.launch
@@ -156,6 +203,9 @@ Geneneral, uses the location given to config. Currently only Gränsö ortho phot
 ```bash
 wexec roslaunch lrs_launch rviz_outside.launch
 ```
+#### Ubuntu 20.04 with ROS Melodic
+
+TO BE WRITTEN
 
 ### Test the dji0
 
@@ -247,9 +297,3 @@ In the docker run
 wexec roslaunch lrs_launch djisimtst.launch simulator:=false ns:=/dji0
 ```
 
-### Issues
-
-If the local machine is Ubuntu 20.04 and running ROS noetic there will
-be a possible mismatch in message checksums compared to melodic
-running in the docker. Most things seems to work.  Docker images for
-noetic will be coming soon.
diff --git a/script/wgrun b/script/wgrun
index 507a8f0..dedc956 100755
--- a/script/wgrun
+++ b/script/wgrun
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+if [[ $(lsb_release -rs) == "18.04" ]]; then
 docker run --gpus all \
   --network host \
   --security-opt apparmor:unconfined \
@@ -10,4 +11,17 @@ docker run --gpus all \
   -e DISPLAY=unix${DISPLAY}\
   -e ROS_HOSTNAME=localhost \
   --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel "$@"
+fi
 
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+docker run --gpus all \
+  --network host \
+  --security-opt apparmor:unconfined \
+  --ulimit nofile=1024 \
+  --ipc=host \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
+  -e DISPLAY=unix${DISPLAY}\
+  -e ROS_HOSTNAME=localhost \
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel "$@"
+fi
diff --git a/script/wpull b/script/wpull
index 72985dd..85f7149 100755
--- a/script/wpull
+++ b/script/wpull
@@ -1,4 +1,13 @@
 #!/bin/bash
 
-docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel
+if [[ $(lsb_release -rs) == "18.04" ]]; then
+    echo "Pulling gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel"
+    docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel
+fi
+
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+    echo "Pulling gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel"
+    docker pull gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel
+fi
+
 
diff --git a/script/wrun b/script/wrun
index ce6c61b..61902c5 100755
--- a/script/wrun
+++ b/script/wrun
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+if [[ $(lsb_release -rs) == "18.04" ]]; then
 docker run \
   --network host \
   --ulimit nofile=1024 \
@@ -9,3 +10,16 @@ docker run \
   -e DISPLAY=unix${DISPLAY}\
   -e ROS_HOSTNAME=localhost \
   --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-melodic:devel "$@"
+fi
+
+if [[ $(lsb_release -rs) == "20.04" ]]; then
+docker run \
+  --network host \
+  --ulimit nofile=1024 \
+  --ipc=host \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /tmp:/exttmp \
+  -e DISPLAY=unix${DISPLAY}\
+  -e ROS_HOSTNAME=localhost \
+  --rm -it --name waradevel gitlab.liu.se:5000/lrs/waraps_docker_images/waraps-noetic:devel "$@"
+fi
-- 
GitLab