Example Package on how to handle ROS2 Publishers & Subscribers, used for the Exploration Rover Lecture, Institute for Space Systems, University Stuttgart. Germany
Go to file
2021-04-13 17:51:12 +02:00
non-ros-files presentation added 2021-04-13 17:45:23 +02:00
src pubsub_v2 2021-03-09 22:12:06 +01:00
bashrc_addons.bash Update 'bashrc_addons.bash' 2021-03-16 18:11:16 +01:00
instructions_custom_topics.md Update 'instructions_custom_topics.md' 2021-02-06 16:18:35 +01:00
Links.md first test push 2021-01-13 15:28:01 +01:00
README.md Update 'README.md' 2021-04-13 17:51:12 +02:00
rpi_install.bash Update 'rpi_install.bash' 2021-03-16 18:11:00 +01:00
workshopinstall.sh first test push 2021-01-13 15:28:01 +01:00

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, 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 or this installation for the Raspberry Pi. Go through the bash commands (console) step by step!

  • Install Ubuntu 20.04
  • Install Visual Studio Code using the Ubuntu Software Installer
  • Install Git (no account required yet)
  • Install ROS2 ("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" tutorial. This will teach you how to configure your ROS 2 environment:

  • Source setup files (Understand Underlay & Overlay)
  • Configure .bashrc file (shell startup script), a good example is here, line 50-95)
  • Add colcon_cd to .bashrc (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

  • 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 !!)
  • 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 (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.

Workshop Content

In this workshop you will:

  • Create a new colcon workspace
  • Create a new package inside you new 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:
    • 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 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.

Presentation

The workshop's content is covered in this presentation.