Skip to content
Snippets Groups Projects
Commit 7586b20e authored by Jonas Kvarnström's avatar Jonas Kvarnström
Browse files

Instruction updates. Working on the interfacing part.

parent ec5eafdd
No related branches found
No related tags found
No related merge requests found
...@@ -14,10 +14,15 @@ To install and configure a development environment, follow these steps: ...@@ -14,10 +14,15 @@ To install and configure a development environment, follow these steps:
- [Install Nvidia Docker drivers](doc/docker_nvidia.md) if you have an Nvidia graphics card and you are not using a virtual machine - [Install Nvidia Docker drivers](doc/docker_nvidia.md) if you have an Nvidia graphics card and you are not using a virtual machine
- [Install the Development Docker Image](doc/docker_install.md) containing the Docker-based LRS modules.
## Development Environments ## Interacting with the Development Docker Container
The following document shows some general examples for interfacing between the Development System and the Development Docker Container.
- [Using a Local ROS Installation with LRS Docker Modules](doc/local_ros_installation.md) - [Interfacing to LRS Docker Modules](doc/docker_interfacing.md)
## Development Environments
For more information on how to integrate your code we have split the information in different sub-areas: For more information on how to integrate your code we have split the information in different sub-areas:
......
# Using LRS Dockers
To install the Docker-based LRS modules, you should first clone the `lrs_devenv_common` repo:
```bash
git clone git@gitlab.liu.se:lrs/lrs_devenv_common.git
```
or if you need to specify the `wara_deploy` deploy key to gain access:
```bash
GIT_SSH_COMMAND='ssh -i ~/.ssh/wara_deploy -o IdentitiesOnly=yes' git clone git@gitlab.liu.se:lrs/waraps.git
```
Put the script directory of the `lrs_devenv_common` repo in your `PATH` and add the following variables, for example in .bashrc:
```bash
export PATH="...../lrs_devenv_common/script:$PATH"
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
```
Finally, pull (download) the latest version of the Development Docker Image. You may have to start a new `bash` shell for this to work (scripts such as `wpull` are in the script directory that was just added to your PATH):
```bash
wpull
```
If you want to update this image to the latest version, run `wpull` again.
# Local ROS Installation and LRS # Using LRS Dockers
Here we describe how to use a local ROS installation and interface Here we describe how to interface with the Docker-based LRS modules from the local ROS installation of your Development System. The intention is that this should be enough for a person knowledgeable about ROS to start developing their own functionality and interface with the available ROS modules.
with the LRS Modules available through docker. The intention is that
this should be enough for a person knowledgeable about ROS to start
developing their own functionality and interface with the available ROS
modules.
See the following for en overview of the available functionality: See the following for an overview of the available functionality:
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-djisdk-md/ - https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-djisdk-md/
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent-md/ - https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent-md/
- https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent_tst-md/ - https://aiics.waraps.org/index.php/lrs-lrs_jupyter-md-single_agent_tst-md/
## Table of Content ## Table of Contents
- [Preparations](#preparations)
- [Scripts](#scripts) - [Scripts](#scripts)
- [How to start different parts](#how-to-start-different-parts) - [How to start different parts](#how-to-start-different-parts)
- [Flying with Gamepad](#flying-with-gamepad) - [Flying with Gamepad](#flying-with-gamepad)
- [Maintenance](#maintenance)
## Preparation
Get the lrs_devenv_common repo:
```bash
git clone git@gitlab.liu.se:lrs/lrs_devenv_common.git
```
or if you need to specify the key:
```bash
GIT_SSH_COMMAND='ssh -i ~/.ssh/wara_deploy -o IdentitiesOnly=yes' git clone git@gitlab.liu.se:lrs/waraps.git
```
Put the script directory of the lrs_devenv_common repo in your PATH plus add
some variables that are needed. For example in .bashrc:
```bash
export PATH="...../lrs_devenv_common/script:$PATH"
export WORLD_ORIGIN_LAT=57.7605573519
export WORLD_ORIGIN_LON=16.6827607783
export WORLD_ORIGIN_ELEVATION=29.8
```
If you have gotten a lot of running containers that interfere with
each other you can stop allrunning containers with:
```bash
docker stop $(docker container ls -q)
```
And to clean up:
```bash
docker system prune
```
## Scripts ## Scripts
You now have the following scripts in your path: Since you have [installed the Development Docker Images](docker_install.md), you now have the following scripts in your path. These scripts are intended to be executed directly on the Development System but are used to *interact* with the Docker Container. Concrete examples of using the scripts are given in the next section.
### wexec ### wpull
Execute commands in a running docker container. Pull (update to) the most recent version of the Development Environment docker image. You should already have done this once, but you can do it again if you want to check for (and download) a new version.
The contents of this script:
```bash ```bash
#!/bin/bash #!/bin/bash
docker exec -it lrsdevel "$@" if [[ $(lsb_release -rs) == "18.04" ]]; then
echo "Pulling gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-melodic:devel"
docker pull gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-melodic:devel
fi
if [[ $(lsb_release -rs) == "20.04" ]]; then
echo "Pulling gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-noetic:devel"
docker pull gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-noetic:devel
fi
``` ```
### wgrun ### wgrun
Start a docker container named `lrsdevel` and run the commands there. Use this if you have NVIDIA graphics. Start a docker container named `lrsdevel` and run the commands there. Use this if you have NVIDIA graphics.
The contents of this script:
```bash ```bash
#!/bin/bash #!/bin/bash
...@@ -105,6 +79,8 @@ fi ...@@ -105,6 +79,8 @@ fi
### wrun ### wrun
Start a docker container named lrsdevel and run the command there. Use if you do not have NVIDIA graphics. Start a docker container named lrsdevel and run the command there. Use if you do not have NVIDIA graphics.
The contents of this script:
```bash ```bash
#!/bin/bash #!/bin/bash
...@@ -134,124 +110,129 @@ fi ...@@ -134,124 +110,129 @@ fi
``` ```
### wpull ### wexec
Execute commands in an already running `lrsdevel` docker container.
Pull the image. The contents of this script:
```bash ```bash
#!/bin/bash #!/bin/bash
if [[ $(lsb_release -rs) == "18.04" ]]; then docker exec -it lrsdevel "$@"
echo "Pulling gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-melodic:devel"
docker pull gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-melodic:devel
fi
if [[ $(lsb_release -rs) == "20.04" ]]; then
echo "Pulling gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-noetic:devel"
docker pull gitlab.liu.se:5000/lrs/devenv_docker_images/lrs-noetic:devel
fi
``` ```
## How to start different parts ## How to start different parts
### Pull the Image ### Start a roscore and the docker container
Start by puling the image:
```bash
wpull
```
### Start a ros core and the docker container: There are two ways of running the roscore:
Either run the roscore locally or in the docker container. - Directly on the Development System:
Local roscore: ```bash
```bash # Start the roscore here
roscore roscore
wgrun bash # Start the Development Environment and make it run a simple bash shell
``` wgrun bash
```
Roscore in docker container: - Inside the Docker container
```bash
wgrun roscore ```bash
``` # Start the Development Environment and make it run the roscore
wgrun roscore
```
++++++++++++ Options, options.... When do we want to run the roscore where?
### Loading config files for units ### Loading config files for units
Assume we want to use unit /dji0 in Gränsö. The do: Assume we want to use unit /dji0 in Gränsö. Then do:
```bash ```bash
wexec roslaunch lrs_launch config.launch location:=granso no_airspace_booking:=true ns:=/dji0 wexec roslaunch lrs_launch config.launch location:=granso no_airspace_booking:=true ns:=/dji0
``` ```
### Start gazebo using docker (optionally) ### Starting Gazebo using Docker (optionally)
If you have a NVIDIA graphics card and support for that in docker then If you have an NVIDIA graphics card and support for that in docker, then you can if needed start gazebo (assuming that the container was already started with wgrun):
you can if needed start gazebo (and if the container was started with wgrun):
```bash ```bash
# Run roslaunch inside the docker container
wexec roslaunch lrs_wara_gazebo gazebo.launch wexec roslaunch lrs_wara_gazebo gazebo.launch
``` ```
Load the dji model in gazebo: Load the dji model in gazebo:
```bash ```bash
# Run roslaunch inside the docker container
wexec roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=0 wexec roslaunch lrs_wara_gazebo dji_to_gazebo.launch name:=dji0 with_laser:=true x:=0
``` ```
### dji 0 ### Starting a simulator for dji0
Begin simulating a DJI Matrice, `dji0`:
```bash ```bash
wexec roslaunch lrs_launch djisimtst.launch dynamics:=true publish_pose:=true mpc:=true ns:=/dji0 wexec roslaunch lrs_launch djisimtst.launch dynamics:=true publish_pose:=true mpc:=true ns:=/dji0
``` ```
In ONE roscore mode the following holds: In single-roscore mode the following holds:
- opunit.launch will start a program thet convert from geopose to pose for all units.
- opunit.launch will start a program that converts from geopose to pose for all units.
- So the flag publish_pose should only be set to true if you run opunit.launch. - So the flag publish_pose should only be set to true if you run opunit.launch.
In multiple roscore mode only geopose is sent to the op unit so there In multiple roscore mode, only geopose is sent to the op unit, so there we can choose freely if we want to generate the pose or not.
we can choose freely if we want to generate the pose or not.
### Start tstdisplayserver ### Starting tstdisplayserver to show TSTs
Show TSTs graphically (when they are created/delegated):
```bash ```bash
wexec rosrun lrs_util_tst tstdisplayserver.py __ns:=/dji0 wexec rosrun lrs_util_tst tstdisplayserver.py __ns:=/dji0
``` ```
### RVIZ ### Starting rviz
Gränsö: Use rviz to show the environment in Gränsö:
```bash ```bash
wexec roslaunch lrs_dji_sim rviz_granso.launch wexec roslaunch lrs_dji_sim rviz_granso.launch
``` ```
Geneneral, uses the location given to config. Currently only Gränsö orthophoto installed. Use rviz to show another location specified in the config. Currently only Gränsö has an orthophoto installed, though.
```bash ```bash
wexec roslaunch lrs_launch rviz_outside.launch wexec roslaunch lrs_launch rviz_outside.launch
``` ```
### Test the dji0 ### Testing the dji0
On the local machine do: On the Development System:
Watch the geopose: Watch the geopose:
```bash ```bash
rostopic echo /dji0/geopose rostopic echo /dji0/geopose
``` ```
Takeoff Try a Takeoff TST
```bash ```bash
wexec rosrun lrs_tst tstcommand.py --takeoff --exec __ns:=/dji0 --disp --op /dji0 wexec rosrun lrs_tst tstcommand.py --takeoff --exec __ns:=/dji0 --disp --op /dji0
``` ```
Flyto Try a Flyto TST
```bash ```bash
wexec rosrun lrs_tst tstcommand.py --fly -x 100 -y 100 -z 12 --speed 3 --exec __ns:=/dji0 --disp --op /dji0 wexec rosrun lrs_tst tstcommand.py --fly -x 100 -y 100 -z 12 --speed 3 --exec __ns:=/dji0 --disp --op /dji0
``` ```
## Flying with Gamepad ## Flying with Gamepad
For this case it is more convenient to run the roscore on the local machine: To fly with a Gamepad, it is more convenient to run the roscore on the local machine.
These instructions assume that you haven't already started the Docker container. If you have, stop it first.
On the development system:
```bash ```bash
roscore roscore
``` ```
...@@ -263,13 +244,13 @@ wgrun bash ...@@ -263,13 +244,13 @@ wgrun bash
On the local machine run the joy ros node: On the local machine run the joy ros node:
Set the variable: Set the variable according to your particular Gamepad. Example:
```bash ```bash
echo $JOY_EXTRA0 echo $JOY_EXTRA0
usb-Logitech_Wireless_Gamepad_F710_2CAE9E79-joystick usb-Logitech_Wireless_Gamepad_F710_2CAE9E79-joystick
``` ```
To get the id for the Gamepad do: To get the ID for the Gamepad do:
```bash ```bash
tompe@philo:~$ ls /dev/input/by-id/ tompe@philo:~$ ls /dev/input/by-id/
usb-046d_C922_Pro_Stream_Webcam_B16031EF-event-if00 usb-046d_C922_Pro_Stream_Webcam_B16031EF-event-if00
...@@ -288,7 +269,7 @@ Start the ROS driver for a joystick: ...@@ -288,7 +269,7 @@ Start the ROS driver for a joystick:
rosrun joy joy_node _dev:=/dev/input/by-id/${JOY_EXTRA0} _deadzone:=0.05 _autorepeat_rate:=50 _coalesce_interval:=0.1 __ns:=/extra0 rosrun joy joy_node _dev:=/dev/input/by-id/${JOY_EXTRA0} _deadzone:=0.05 _autorepeat_rate:=50 _coalesce_interval:=0.1 __ns:=/extra0
``` ```
Setup the simulation: Set up the simulation:
```bash ```bash
wexec roslaunch lrs_launch config.launch location:=granso no_airspace_booking:=true ns:=/dji0 wexec roslaunch lrs_launch config.launch location:=granso no_airspace_booking:=true ns:=/dji0
wexec roslaunch lrs_launch djisimtst.launch dynamics:=true publish_pose:=true mpc:=true inair:=true ns:=/dji0 wexec roslaunch lrs_launch djisimtst.launch dynamics:=true publish_pose:=true mpc:=true inair:=true ns:=/dji0
...@@ -300,7 +281,7 @@ wexec rosrun lrs_dji_sim joypose.py __ns:=/dji0 ...@@ -300,7 +281,7 @@ wexec rosrun lrs_dji_sim joypose.py __ns:=/dji0
``` ```
Rviz: Start rviz:
```bash ```bash
wexec roslaunch lrs_launch rviz_outside.launch wexec roslaunch lrs_launch rviz_outside.launch
``` ```
...@@ -308,3 +289,18 @@ wexec roslaunch lrs_launch rviz_outside.launch ...@@ -308,3 +289,18 @@ wexec roslaunch lrs_launch rviz_outside.launch
On the GamePad: On the GamePad:
- Green Button: Manual Mode, fly with gamepad - Green Button: Manual Mode, fly with gamepad
- Red Button: Auto - Red Button: Auto
## Maintenance
If you have ended up with a lot of running containers that interfere with each other you can stop all running containers with:
```bash
docker stop $(docker container ls -q)
```
And to clean up:
```bash
docker system prune
```
[Portainer](https://www.portainer.io/) is a useful tool if you want to manage your running containers.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment