From 4bf5628d8d1ca60b39ca5c38b41782c70dedc252 Mon Sep 17 00:00:00 2001
From: Tommy Persson <tommmy.persson@liu.se>
Date: Sun, 21 Jun 2020 20:59:27 +0200
Subject: [PATCH] Work on minimal dockers.

---
 README.md          | 43 +++++++++++++++++++++++++++++++++++++++++--
 script/exec_system |  4 ++--
 script/gazebo      | 18 ++++++++++++++++++
 script/tst         |  2 +-
 script/wdb         |  2 +-
 5 files changed, 63 insertions(+), 6 deletions(-)
 create mode 100755 script/gazebo

diff --git a/README.md b/README.md
index 92a518a..c2d07ac 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,14 @@ export WORLD_ORIGIN_LON=16.6827607783
 export WORLD_ORIGIN_ELEVATION=29.8
 ```
 
-The scren file are in: /home/tompe/docker/waraps/screen
+The screen file are in: /home/tompe/docker/waraps/screen
+
+NOTICE: C-o \ do not kill the docker containers.
+
+To stop the running containers do:
+```bash
+docker stop $(docker container ls -q)
+```
 
 ## Start System Using Only Dockers but use a local ROS Core
 
@@ -44,15 +51,47 @@ gazebo roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=tru
 ```
 
 ### Start /op0 using a screen:
+
 ```bash
 env NS=/op0 screen -c waraps/screen/screen_op
 ```
 
+This will start the following scripts which starts docker containers:
+```bash
+wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=${NS}
+tst roslaunch lrs_launch tst_part.launch ns:=${NS}
+exec_system roslaunch lrs_launch exec_part.launch ns:=${NS}
+```
+
 ### Start /dji0 simulation using a screen:
+
 ```bash
-env NS=/op0 screen -c waraps/screen/screen_djisim
+env NS=/dji0 screen -c waraps/screen/screen_djisim
 ```
 
+This will start the following scripts which starts docker containers:
+```bash
+base_dji roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false gazebo:=true
+dji_system roslaunch lrs_launch lrsdji.launch publish_pose:=true ns:=${NS}
+wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=${NS}
+tst roslaunch lrs_launch tst_part.launch ns:=${NS}
+exec_system roslaunch lrs_launch exec_part.launch ns:=${NS}
+exec_dji roslaunch lrs_launch exec_vehicle.launch vehicle:=dji ns:=${NS}
+```
+
+### Test the tqo running screens
+
+Takeoff
+```bash
+tst rosrun lrs_tst tstcommand.py --takeoff -x 100 -y 100 -z 12 --speed 7 --exec __ns:=/dji0
+```
+
+Flyto
+```bash
+tst rosrun lrs_tst tstcommand.py --fly -x 100 -y 100 -z 12 --speed 3 --exec __ns:=/dji0
+```
+
+
 
 ### Basic Simulator
 ```bash
diff --git a/script/exec_system b/script/exec_system
index f1587f5..5f30421 100755
--- a/script/exec_system
+++ b/script/exec_system
@@ -1,13 +1,13 @@
 #!/bin/bash
 
-tag=gitlab.liu.se:5000/lrs/waraps_docker_images/exec-minimal:v01
+tag=gitlab.liu.se:5000/lrs/waraps_docker_images/exec-exec-minimal:v01
 
 if [ $1 = "pull" ]; then
     docker pull $tag
     exit 0
 fi
 
-docker run \
+exec docker run \
   --network host \
   --security-opt apparmor:unconfined \
   --ulimit nofile=1024 \
diff --git a/script/gazebo b/script/gazebo
new file mode 100755
index 0000000..5a89ba1
--- /dev/null
+++ b/script/gazebo
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+tag=gitlab.liu.se:5000/lrs/waraps_docker_images/gazebo-minimal:v01
+
+if [ $1 = "pull" ]; then
+    docker pull $tag
+    exit 0
+fi
+
+docker run --gpus all \
+  --network host \
+  --security-opt apparmor:unconfined \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -e DISPLAY=unix${DISPLAY} \
+  --ulimit nofile=1024 \
+  -e ROS_HOSTNAME=localhost \
+  --rm -it ${tag} "$@"
+
diff --git a/script/tst b/script/tst
index 8207de8..b16e4cf 100755
--- a/script/tst
+++ b/script/tst
@@ -7,7 +7,7 @@ if [ $1 = "pull" ]; then
     exit 0
 fi
 
-docker run \
+exec docker run \
   --network host \
   --security-opt apparmor:unconfined \
   --ulimit nofile=1024 \
diff --git a/script/wdb b/script/wdb
index 9c03e6b..5bdd4f0 100755
--- a/script/wdb
+++ b/script/wdb
@@ -7,7 +7,7 @@ if [ $1 = "pull" ]; then
     exit 0
 fi
 
-docker run \
+exec docker run \
   --network host \
   --security-opt apparmor:unconfined \
   --ulimit nofile=1024 \
-- 
GitLab