Skip to content
Snippets Groups Projects
Commit 88524577 authored by Tommy Persson's avatar Tommy Persson
Browse files

Work on minimal dockers.

parent 4bf5628d
Branches
No related tags found
No related merge requests found
# waraps # waraps
Things needed to build a development docker image based on waraps base LRS image. - [Local ROS Installation and LRS Docker Modules](doc/local_ros_installation.md)
- [Install Software on Local Machine or Virtual Machine](doc/install.md)
- Build a Development Docker
Also instructions how to run different units from a docker. This will
replace the setup we have had with virtual machines that combitech
have used.
Will be used for more things in the future.
## Setup
Put the script dir in your PATH plus add somce variables that are needed. For example in .bashrc:
```bash
export PATH="/home/tompe/docker/waraps/script:$PATH"
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
```
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
### Start a ros core:
```bash
roscore
```
Add location granso to the parameter server.
```bash
wdb roslaunch lrs_launch location_granso.launch ns:=/dji0
```
### Start gazebo using docker:
```bash
gazebo roslaunch lrs_wara_gazebo gazebo.launch
```
### Load dji model using docker:
```bash
gazebo roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=0
```
### 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=/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
base_dji roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false gazebo:=true
```
### Create a LRS DJI
Add
```bash
dji_system roslaunch lrs_launch lrsdji.launch publish_pose:=false ns:=/dji0
```
### Create a WDB LRS DJI
Add
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=dji ns:=/dji0
```
### Create TST Factory for Execution Trees
Add
```
tst roslaunch lrs_launch tst_part ns:=/dji0
```
### Create Executors for DJI
Add
```bash
exec_dji roslaunch lrs_launch exec_part.launch ns:=/dji0 vehicle:=dji
```
### Create Needed Operator
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=/op0
```
```bash
tst roslaunch lrs_launch tst_part ns:=/op0
```
```bash
exec_op roslaunch lrs_launch exec_part.launch ns:=/op0 vehicle:=op
```
## Virtual Machine Ubuntu 18.04
```bash
sudo apt install gcc perl make # to build guest addition kernel modules
sudo apt install net-tools
sudo apt install openssh-server
```
## Installing Required Software on a Virtual Machine or an Ordinary Computer
Follow the steps below to setup the software required to execute
Jupyter Notebooks on your native comupter or in a virtual machine.
You must have the aministrator/root privileges on the machine and basic/intermediate knowledge of Linux.
### Ubuntu 18.04
Open a terminal window and execute the following command to update the list of packages available for your system:
```bash
sudo apt update
```
Install the openssh package:
```bash
sudo apt install openssh-server
```
Install and ansible package:
```bash
## sudo install --reinstall ca-certificates # Had to do this for the apt-add-repository to work
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
```
In the instructions below replace USER with the specific name of the user you logged in with.
You can check what name it is by executing the following command to display the value of the USER environment variable:
```bash
echo $USER
```
Test if you can ssh into the machine without providing the password. It is necessary for the remaining steps described below.
```bash
ssh USER@localhost
```
If you are asked to enter the password, cancel the command (Ctrl+C) and execute the following command to install the needed ssh key:
```bash
ssh-copy-id -i USER@localhost
```
If you don't have an ssh key generated on the machine yet, execute:
```bash
ssh-keygen
```
and repeat the previous step. You should now be able to login to the machine using: ```ssh USER@localhost```
After loging in make sure that
```bash
sudo ls
```
does not require a password. If it does you should fix the required permissions. Execute:
```bash
sudo visudo
```
and add ```NOPASSWD:``` by changing the line:
```bash
%sudo ALL=(ALL:ALL) ALL
```
to
```bash
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
```
If this is considered a security risk the alternative is to give the
password as argument to the ansible-playbook command:
```bash
ansible-playbook -i hosts playbooks/wara.yml -e ansible_sudo_pass=******
```
Install the playbooks repo:
```bash
sudo apt install git
git clone https://gitlab.liu.se/lrs/lrs_playbooks.git
```
In the command below the value of the environment variable specifying
the login name is used. You don't have to replace it.
Run playbook to install and update the wara developer programs. It can take several minutes to complete.
```bash
cd lrs_playbooks
git pull
ansible-playbook -i hosts playbooks/wara_develop.yml -e user=${USER} -e install_user=${USER}
```
Add the following commands at the end of ```~/.bashrc``` file:
```bash
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
#source /opt/ros/melodic/setup.bash
source ${HOME}/wara_ws/devel/setup.bash
export PATH=${HOME}/waraps/script:${PATH}
```
These commands will take effect next time you open a new terminal window or login to the system.
At this point your system now has the necessary software installed.
You can use the following commands to test the 3D graphics hardware and driver setup on your system:
```bash
glxgears
glmark2
```
If the above commands execute without errors you can test that Gazebo works correctly on your system:
```bash
roslaunch lrs_wara_gazebo gazebo.launch
roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=5
```
## Running Sub Systems from Docker
WORK IN PROGRESS!
### Define a location
```bash
roslaunch lrs_launch location_granso.launch ns:=/dji0
```
### Scripts to start docker containers (and pull)
- base_dji
- dji_system
- wdb
### Dji Simulator with MPC Trajectory Contoller
```bash
docker run \
--network host \
--security-opt apparmor:unconfined \
--ulimit nofile=1024 \
-e ROS_HOSTNAME=localhost \
--rm -it gitlab.liu.se:5000/lrs/waraps_docker_images/base-dji-minimal:v01 \
roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false
```
or
```bash
base_dji roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false gazebo:=true
```
### Create a LRS DJI
Add
```bash
dji_system roslaunch lrs_launch lrsdji.launch publish_pose:=false ns:=/dji0
```
### Create a WDB LRS DJI
Add
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=dji ns:=/dji0
```
### Create TST Factory for Execution Trees
Add
```
tst roslaunch lrs_launch tst_part.launch ns:=/dji0
```
### Create Executors for DJI
Add
```bash
exec_dji roslaunch lrs_launch exec_part.launch ns:=/dji0 vehicle:=dji
```
### Create Needed Operator
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=/op0
```
```bash
tst roslaunch lrs_launch tst_part.launch ns:=/op0
```
```bash
exec_op roslaunch lrs_launch exec_part.launch ns:=/op0 vehicle:=op
```
### Putting it all together in two screens
## Running units from docker
Start docker with wrun or wgrun. Use wgrun ig you have NVIDIA graphics
working in dockers using the new method with the flag "--gpus".
### Running units on different computer
To start /op0, /djisim0, /djisim1, /pirayasim0 do:
```bash
wrun op 0
```
```bash
wrun djisim 0
```
```bash
wrun djisim 1
```
```bash
wrun pirayasim 0
```
### Running units on the same computer
here we just start one container and then used "docker exec" to get different shells.
Start the docker container:
```bash
wrun bash
```
Can be detached with C-p C-q.
To start /op0, /djisim0, /djisim1, /pirayasim0 do:
```bash
wexec
op 0
```
```bash
wexec
djisim 0
```
```bash
wexec
djisim 1
```
```bash
wexec
pirayasim 0
```
## User Specific Development Docker
THIS INFORMATION IS NOT YET COMPLETE! DO NOT USE!
### Build user specific development docker image
```bash
cd docker
./build
```
### Run the user specific developer image
```bash
cd docker
./run.sh ${HOME}/wara_docker_home
```
The run.sh script takes one argument and it is the directory that is mounted as home directory.
### Init files
You have to create your own init files.
To get access to the ROS-repos put:
```bash
source /opt/lrs_wara/wara_devel_ws/deve/setup.bash
```
in your .bashrc file.
# Install Instructions
## Virtual Machine Ubuntu 18.04
```bash
sudo apt install gcc perl make # to build guest addition kernel modules
sudo apt install net-tools
sudo apt install openssh-server
```
## Installing Required Software on a Virtual Machine or an Ordinary Computer
Follow the steps below to setup the software required to execute
Jupyter Notebooks on your native comupter or in a virtual machine.
You must have the aministrator/root privileges on the machine and basic/intermediate knowledge of Linux.
### Ubuntu 18.04
Open a terminal window and execute the following command to update the list of packages available for your system:
```bash
sudo apt update
```
Install the openssh package:
```bash
sudo apt install openssh-server
```
Install and ansible package:
```bash
## sudo install --reinstall ca-certificates # Had to do this for the apt-add-repository to work
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible
```
In the instructions below replace USER with the specific name of the user you logged in with.
You can check what name it is by executing the following command to display the value of the USER environment variable:
```bash
echo $USER
```
Test if you can ssh into the machine without providing the password. It is necessary for the remaining steps described below.
```bash
ssh USER@localhost
```
If you are asked to enter the password, cancel the command (Ctrl+C) and execute the following command to install the needed ssh key:
```bash
ssh-copy-id -i USER@localhost
```
If you don't have an ssh key generated on the machine yet, execute:
```bash
ssh-keygen
```
and repeat the previous step. You should now be able to login to the machine using: ```ssh USER@localhost```
After loging in make sure that
```bash
sudo ls
```
does not require a password. If it does you should fix the required permissions. Execute:
```bash
sudo visudo
```
and add ```NOPASSWD:``` by changing the line:
```bash
%sudo ALL=(ALL:ALL) ALL
```
to
```bash
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
```
If this is considered a security risk the alternative is to give the
password as argument to the ansible-playbook command:
```bash
ansible-playbook -i hosts playbooks/wara.yml -e ansible_sudo_pass=******
```
Install the playbooks repo:
```bash
sudo apt install git
git clone https://gitlab.liu.se/lrs/lrs_playbooks.git
```
In the command below the value of the environment variable specifying
the login name is used. You don't have to replace it.
Run playbook to install and update the wara developer programs. It can take several minutes to complete.
```bash
cd lrs_playbooks
git pull
ansible-playbook -i hosts playbooks/wara_develop.yml -e user=${USER} -e install_user=${USER}
```
Add the following commands at the end of ```~/.bashrc``` file:
```bash
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
#source /opt/ros/melodic/setup.bash
source ${HOME}/wara_ws/devel/setup.bash
export PATH=${HOME}/waraps/script:${PATH}
```
These commands will take effect next time you open a new terminal window or login to the system.
At this point your system now has the necessary software installed.
You can use the following commands to test the 3D graphics hardware and driver setup on your system:
```bash
glxgears
glmark2
```
If the above commands execute without errors you can test that Gazebo works correctly on your system:
```bash
roslaunch lrs_wara_gazebo gazebo.launch
roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=5
```
Things needed to build a development docker image based on waraps base LRS image.
Also instructions how to run different units from a docker. This will
replace the setup we have had with virtual machines that combitech
have used.
Will be used for more things in the future.
### Basic Simulator
```bash
base_dji roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false gazebo:=true
```
### Create a LRS DJI
Add
```bash
dji_system roslaunch lrs_launch lrsdji.launch publish_pose:=false ns:=/dji0
```
### Create a WDB LRS DJI
Add
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=dji ns:=/dji0
```
### Create TST Factory for Execution Trees
Add
```
tst roslaunch lrs_launch tst_part ns:=/dji0
```
### Create Executors for DJI
Add
```bash
exec_dji roslaunch lrs_launch exec_part.launch ns:=/dji0 vehicle:=dji
```
### Create Needed Operator
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=/op0
```
```bash
tst roslaunch lrs_launch tst_part ns:=/op0
```
```bash
exec_op roslaunch lrs_launch exec_part.launch ns:=/op0 vehicle:=op
```
## Running Sub Systems from Docker
WORK IN PROGRESS!
### Define a location
```bash
roslaunch lrs_launch location_granso.launch ns:=/dji0
```
### Scripts to start docker containers (and pull)
- base_dji
- dji_system
- wdb
### Dji Simulator with MPC Trajectory Contoller
```bash
docker run \
--network host \
--security-opt apparmor:unconfined \
--ulimit nofile=1024 \
-e ROS_HOSTNAME=localhost \
--rm -it gitlab.liu.se:5000/lrs/waraps_docker_images/base-dji-minimal:v01 \
roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false
```
or
```bash
base_dji roslaunch lrs_dji_sim sim.launch dynamics:=true mpc:=true inair:=true ns:=/dji0 basic:=false gazebo:=true
```
### Create a LRS DJI
Add
```bash
dji_system roslaunch lrs_launch lrsdji.launch publish_pose:=false ns:=/dji0
```
### Create a WDB LRS DJI
Add
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=dji ns:=/dji0
```
### Create TST Factory for Execution Trees
Add
```
tst roslaunch lrs_launch tst_part.launch ns:=/dji0
```
### Create Executors for DJI
Add
```bash
exec_dji roslaunch lrs_launch exec_part.launch ns:=/dji0 vehicle:=dji
```
### Create Needed Operator
```bash
wdb roslaunch lrs_launch wdb.launch vehicle:=op ns:=/op0
```
```bash
tst roslaunch lrs_launch tst_part.launch ns:=/op0
```
```bash
exec_op roslaunch lrs_launch exec_part.launch ns:=/op0 vehicle:=op
```
### Putting it all together in two screens
## Running units from docker
Start docker with wrun or wgrun. Use wgrun ig you have NVIDIA graphics
working in dockers using the new method with the flag "--gpus".
### Running units on different computer
To start /op0, /djisim0, /djisim1, /pirayasim0 do:
```bash
wrun op 0
```
```bash
wrun djisim 0
```
```bash
wrun djisim 1
```
```bash
wrun pirayasim 0
```
### Running units on the same computer
here we just start one container and then used "docker exec" to get different shells.
Start the docker container:
```bash
wrun bash
```
Can be detached with C-p C-q.
To start /op0, /djisim0, /djisim1, /pirayasim0 do:
```bash
wexec
op 0
```
```bash
wexec
djisim 0
```
```bash
wexec
djisim 1
```
```bash
wexec
pirayasim 0
```
## User Specific Development Docker
THIS INFORMATION IS NOT YET COMPLETE! DO NOT USE!
### Build user specific development docker image
```bash
cd docker
./build
```
### Run the user specific developer image
```bash
cd docker
./run.sh ${HOME}/wara_docker_home
```
The run.sh script takes one argument and it is the directory that is mounted as home directory.
### Init files
You have to create your own init files.
To get access to the ROS-repos put:
```bash
source /opt/lrs_wara/wara_devel_ws/deve/setup.bash
```
in your .bashrc file.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment