Overview

The goals for this section:

  1. Create a ROS Workspace.
  2. Create a ROS Package.
  3. Create a ROS Node with a publisher and a subscriber.

Prep

Task 0.1 — Cleanup. Close any open windows and terminals. Remove directory ~/autonomy_ws if it exists. This might be leftover from a previous section.

Task 0.2 — GitHub Account. Use the following commands to logout of any existing GitHub accounts, and login to the account of one of your group members.

gh auth logout  # Log out of any accounts from previous sections.

gh auth login   # Login to the account your group is using.
# (1) press enter to select Github.com
# (2) select press enter to select HTTPS
# (3) type Y then hit enter
# (4) Take note of the supplied code, then press enter to open
#     the web browser. Follow the instructions in the browser to
#     login to your GH account.
# (5) Once you've logged in, return to the terminal and press enter
#     to finalize the authentication process.

Task 0.3 — Group Repo. If you haven’t already, go to github.com and create a private repository for your group (make sure to initialize this repository with a README file), and add the other members of your group as collaborators (to do this go to Settings > Collaborators in your repo once you’ve created it).

Untitled

Create a ROS Workspace

ROS Workspaces are used to organize packages that are under development. Here your group will create one that will be used during this section. Complete the following tasks using terminal commands only on the provided Skilling Laptops.

Task 1.1 — Directories. Create the base directory structure for your group’s ROS workspace, ~/autonomy_ws/src.

Task 1.2 — Clone and Branch. Clone your group’s GitHub repo to the src/ directory, and create a new branch called section2 .

Task 1.3 — Create a Package. Create an empty ROS package inside of your group’s git repository with the name s2_basic.

Task 1.4 — Build. Navigate back to the “root” of your workspace, ~/autonomy_ws/ , and build your ROS workspace using the command colcon build (do not run this command in any other directory). You should see something like the output below.

Starting >>> s2_basic
Finished <<< s2_basic [0.87s]

Summary: 1 packages finished [0.87s]

Cheat Sheet: