Skip to content

Building Robots in Teams

In this tutorial you will work with your team to learn the basics of ROS2 and create a shared GitHub project. You'll make your first commits allowing you to share code via git. You will set up your editor, learn to use AI Coding tools responsibly, as well as best practices effective collaboration. With the ability to edit and share code, your team will implement several ROS2 nodes to solidify the core concepts of the Robot Operating System.

Learning Objectives

  • Understand the basics of ROS2 architecture
  • Understand basic Git commands and workflows
  • Collaborate effectively using GitHub repositories
  • Practice making commits, pushing, and pulling changes
  • Set up your coding environment with your teammate
  • Use an AI coding agent to assist with coding tasks
  • Implement simple ROS2 nodes collaboratively

Deliverables

  • A shared GitHub repository with contributions from both students
  • Several simple ROS2 nodes implemented collaboratively

Prerequisites

  • Have Git installed (git --version should work in the terminal).
  • Both have GitHub accounts and are logged in.
  • Have the VSCode editor installed.

The Robot Operating System (ROS) 2

The robot operating system (ROS) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms. ROS2 is the second generation of ROS, which includes improvements in performance, security, and real-time capabilities.

ROS2

If you're not familiar with ROS2, read the ROS2 overview and optionally complete the ROS2 tutorials before starting this tutorial.

git

git is a command-line tool for version control that allows multiple people to work on the same codebase simultaneously. It is closely related to github.com, which is one of the most popular platforms for hosting Git repositories. While git can be self-hosted or hosted on other platforms, such as gitlab.com, we will use github.com in this tutorial and for the class. In this portion of the tutorial, you will create a shared repository on GitHub and practice basic git commands such as clone, add, commit, push, and pull.

1. Student A creates the repository

  • Go to https://github.com and click New repository.
  • Check Add a README file.
  • Click Create repository.

Now Student A has a GitHub repo!

2. Student A clones the repo to their computer

In a terminal:

git clone https://github.com/<studentA-username>/git-practice.git
cd git-practice

3. Student A makes their first change and pushes it

  1. Create a new file, for example:

    echo "Hello from Student A" > hello.txt
    
  2. Check what’s new:

    git status
    
  3. Stage and commit the file:

    git add hello.txt
    git commit -m "Add hello.txt from Student A"
    
  4. Push to GitHub:

    git push
    

    Now, ensure the file is visible on the GitHub website: https://github.com//git-practice

4. Student B joins the project

  1. Student A should go to the repo on GitHub, open: Settings, Collaborators, Add collaborator, enter Student B’s GitHub username and invite them.

  2. Student B accepts the invitation (check email or notifications).

5. Student B clones the repo and pulls the latest changes

git clone https://github.com/<studentA-username>/git-practice.git
cd git-practice

Now Student B has the same files locally.

6. Student B makes a new change and pushes it

  1. Add another file:

    echo "Hello from Student B" > hello_b.txt
    
  2. Stage and commit:

    git add hello_b.txt
    git commit -m "Add hello_b.txt from Student B"
    
  3. Push the change:

    git push
    

7. Student A pulls the new changes

Back on Student A’s computer:

git pull

Student A will now see both hello.txt and hello_b.txt locally.

Lab Notebook

Include two screenshots of your terminal. One screenshot should show the contents of the project (run the ls command). One screenshot should show the output of the git log command displaying the commit history with both students' commits.

git Summary

You just:

  • Created a GitHub repo
  • Made commits
  • Pushed and pulled between collaborators

This is the foundation of real-world teamwork in software development.

Creating ROS 2 Nodes