all non-ros-files moved to folder and linked correctly

This commit is contained in:
winterhalderp 2021-04-19 16:18:50 +02:00
parent b84fa548de
commit 91bac99e0f

View File

@ -1,59 +1,58 @@
# pubsub - Publisher & Subscriber Package
Minimal Publisher & Subscriber Template for ROS2.
```
Created for ROS Workshop 2020
Course Roverentwicklung für Explorationsaufgaben
Institute for Space Systems
University of Stuttgart.
```
Created by Patrick Winterhalder,
[IRS](https://www.irs.uni-stuttgart.de/en/institute/team/Winterhalder/), University of Stuttgart.
Class Code created by [Patrick Winterhalder](https://www.irs.uni-stuttgart.de/en/institute/team/Winterhalder/),
[IRS](https://www.irs.uni-stuttgart.de), University of Stuttgart.
## Workshop Prerequisites
For the workshop to be conducted on your Ubuntu 20.04 (64 bit) you must conduct [this installation for desktop machines](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/workshopinstall.sh) or [this installation for the Raspberry Pi](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/rpi_install.bash). Go through the bash commands (console) step by step!
In order to run ROS2 you must install **Ubuntu 20.04 LTS** on a capable machine (preferrably desktop/laptop) first.
* Install [Ubuntu 20.04](https://help.ubuntu.com/lts/installation-guide/index.html)
For a successful workshop you must conduct [this installation on your desktop machine](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/workshopinstall.sh) or [this installation on your Raspberry Pi](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/rpi_install.bash). Go through the commands of these *.bash file line by line and check if every commands finishes without errors! Following these .bash files should do the following:
* Install Visual Studio Code using the [Ubuntu Software Installer](https://wiki.ubuntuusers.de/Ubuntu_Software/)
* Install [Git](https://linuxconfig.org/how-to-install-git-on-ubuntu-20-04-lts-focal-fossa-linux) (no account required yet)
* Install [ROS2](https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/) ("desktop" on PC, "base" on Raspberry Pi).
* Install [ROS2](https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/) (choose "desktop" on PC or "base" on Raspberry Pi, this eliminates all GUI tools from the installation, e.g. rviz and rqt).
* Also install _argcomplete_
* No need for _ROS 1 bridge_ or _RMW implementations_
* Install and update _rosdep_
After a successful installation of ROS2 you should get to know it by working through the ["Beginner: CLI Tools"](https://index.ros.org/doc/ros2/Tutorials/) tutorial. This will teach you how to [configure your ROS 2 environment](https://index.ros.org/doc/ros2/Tutorials/Configuring-ROS2-Environment/):
* Source setup files (Understand **Underlay** & **Overlay**)
* Configure .bashrc file (shell startup script), a good example is [here](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/rpi_install.bash), line 50-95)
* Add colcon_cd to .bashrc (shell startup script)
After successfully installing ROS2 you should get to know it by working through the ["Beginner: CLI Tools"](https://index.ros.org/doc/ros2/Tutorials/) tutorial. This will teach you how to [configure your ROS 2 environment](https://index.ros.org/doc/ros2/Tutorials/Configuring-ROS2-Environment/) and you will learn about:
* Source setup files (understand **Underlay** & **Overlay**)
* Configure .bashrc file (shell startup script), a good example is [here](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/rpi_install.bash), line 50-95)
* Add all _colcon_ workspaces to the shell startup script
* Check environment variables (check for correct installation)
* Configure *ROS_DOMAIN_ID* (DDS Network Number)
* Work through the tutorials covering _turtlesim, rqt, topics, services, actions_
## Install Instructions
The following steps describe how you can create a local copy of this repository containing ROS2 publisher and subscriber class templates.
* Move to your colcon workspace `cd <workspace_path>` (eg. `cd ~/colcon_ws`)
* Clone this repository: `git clone https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub.git .` (include `.` at the end of the command !!)
* Clone this repository: `git clone https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub.git .` (include `.` at the end of the command in oder to copy everything to this locations!)
* Build workspace: `colcon build` , __Note:__ Only the files inside _/src/_ are of importance.
* Remember to run `source ~/<workspace_path>/install/local_setup.sh` after every build.
In order to prevent this repetitive command add [this command to _.bashrc_](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/bashrc_addons.bash) (line 22-32). This runs everytime you start a new console.
This is also handy if you are working with multiple colcon workspaces (overlays) simultaneously.
In order to avoid this repetitive command, add line 22-32 from [_.bashrc_](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/nonros-files/bashrc_addons.bash) to your shell startup script. This script runs everytime you start a new console, thus loading your overlays automatically. This is very handy if you are working with multiple colcon workspaces (overlays) simultaneously.
## Workshop Content
In this workshop you will:
* Create a new colcon workspace
* Create a new package inside you new colcon workspace
* Create a new _colcon_ workspace
* Create a new package inside your newly created _colcon_ workspace
* `ros2 pkg create --build-type [ament_cmake, ament-python] <package_name>`
* Build your workspace, this means making it a functional ROS2 workspace from which you can start nodes:
* Build your _colcon_ workspace, this means making it a functional ROS2 workspace from which you can start nodes:
* First move to your workspace root: `cd ~/<workspace_path>`
* Run `colcon build --symlink-install`
* Add your newly created workspace to source everytime you open a new console (.bashrc):
* Add [this](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/bashrc_addons.bash) to end of .bashrc (`sudo nano .bashrc`)
* In the template above find all instances of "`~/ws_overlay_foxy`" and replace it with your path to your colcon workspace (keep the home directory variable `$HOME` as this indicates `~/` in bash script)
* Create a custom message (*.msg) in order to define custom interfaces between nodes by following these following [these instructions](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/instructions_custom_topics.md).
* Add your workspace overlay to the shell startup script for sourcing everytime you open a new console:
* Add [this](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/bashrc_addons.bash) to the end of .bashrc (`sudo nano .bashrc`)
* In [this template](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/bashrc_addons.bash) find all instances of "`~/ws_overlay_foxy`" and replace it with the path to your own _colcon_ workspace (replace `~/` with `$HOME` for representing the home directory variable in bash scripts)
* Create a custom ROS message (*.msg) in order to define custom topics to exchange information between nodes by following [these instructions](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/instructions_custom_topics.md).
## Presentation
The workshop's content is covered in [this presentation](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/non-ros-files/ws-05-ros-workshop%20%281%29.pdf).