ROS2_pubsub/README.md

56 lines
3.9 KiB
Markdown
Raw Normal View History

2021-01-13 15:28:01 +01:00
# pubsub - Publisher & Subscriber Package
2021-04-13 16:30:51 +02:00
Minimal Publisher & Subscriber Template for ROS2.
2021-01-13 15:28:01 +01:00
2021-04-13 16:30:51 +02:00
```
2021-01-13 15:28:01 +01:00
Created for ROS Workshop 2020
2021-04-13 16:30:51 +02:00
Course Roverentwicklung für Explorationsaufgaben
2021-01-13 15:28:01 +01:00
Institute for Space Systems
University of Stuttgart.
2021-04-13 16:30:51 +02:00
```
2021-01-13 15:28:01 +01:00
Created by Patrick Winterhalder,
2021-04-13 16:30:51 +02:00
[IRS](https://www.irs.uni-stuttgart.de/en/institute/team/Winterhalder/), University of Stuttgart.
2021-01-13 15:28:01 +01:00
## Workshop Prerequisites
2021-03-16 13:59:12 +01:00
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!
* Install [Ubuntu 20.04](https://help.ubuntu.com/lts/installation-guide/index.html)
* Install Visual Studio Code using the [Ubuntu Software Installer](https://wiki.ubuntuusers.de/Ubuntu_Software/)
2021-01-13 15:28:01 +01:00
* Install [Git](https://linuxconfig.org/how-to-install-git-on-ubuntu-20-04-lts-focal-fossa-linux) (no account required yet)
2021-03-16 13:59:12 +01:00
* Install [ROS2](https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/) ("desktop" on PC, "base" on Raspberry Pi).
* 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/):
2021-03-16 14:48:43 +01:00
* 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)
2021-03-16 13:59:12 +01:00
* Add colcon_cd to .bashrc (shell startup script)
* Check environment variables (check for correct installation)
2021-03-16 14:48:43 +01:00
* Configure *ROS_DOMAIN_ID* (DDS Network Number)
* Work through the tutorials covering _turtlesim, rqt, topics, services, actions_
2021-01-13 15:28:01 +01:00
## Install Instructions
2021-03-16 14:48:43 +01:00
* Move to colcon workspace: `cd <workspace_path>`, eg. `cd ~/colcon_ws`
* Clone repository: `git clone git://github.com/patrickw135/pubsub.git .` (include "`.`" at the end of the command !!)
* 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.
Best would be to [add this command to _.bashrc_](https://egit.irs.uni-stuttgart.de/RoverLehre/ROS2_pubsub/src/branch/master/bashrc_addons.bash) (line 22-32) which is run everytime you start a new console.
This is also handy if you are working with multiple colcon workspaces simultaneously.
2021-01-13 15:28:01 +01:00
## During Workshop
2021-03-16 14:48:43 +01:00
In this workshop you will:
* Create a new colcon workspace
* Create a new package inside you new colcon workspace
2021-01-13 15:28:01 +01:00
* `ros2 pkg create --build-type [ament_cmake, ament-python] <package_name>`
2021-03-16 14:48:43 +01:00
* Build your 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).